This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH,take3] Add plugin interface to LD, respun. [1..6/6]
On 13/10/2010 05:38, H.J. Lu wrote:
> On Tue, Oct 12, 2010 at 9:22 PM, Dave Korn <dave.korn.cygwin@gmail.com> wrote:
>> Ah, there's one last thing. I get this non-fatal warning when building on
>> i686-pc-linux with --enable-64-bit-bfd:
>>
>>> /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I/gnu/binutils/src/ld -I. -I/gnu/binutils/src/ld -I../bfd -I/gnu/binutils/src/ld/../bfd -I/gnu/binutils/src/ld/../include -g -O2 -DENABLE_PLUGINS -DLOCALEDIR="\"/opt/gold/share/locale\"" -g -O2 -g -O2 -MT libldtestplug_la-testplug.lo -MD -MP -MF .deps/libldtestplug_la-testplug.Tpo -c -o libldtestplug_la-testplug.lo `test -f 'testplug.c' || echo '/gnu/binutils/src/ld/'`testplug.c
>>> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I/gnu/binutils/src/ld -I. -I/gnu/binutils/src/ld -I../bfd -I/gnu/binutils/src/ld/../bfd -I/gnu/binutils/src/ld/../include -g -O2 -DENABLE_PLUGINS -DLOCALEDIR=\"/opt/gold/share/locale\" -g -O2 -g -O2 -MT libldtestplug_la-testplug.lo -MD -MP -MF .deps/libldtestplug_la-testplug.Tpo -c /gnu/binutils/src/ld/testplug.c -fPIC -DPIC -o .libs/libldtestplug_la-testplug.o
>>> /gnu/binutils/src/ld/testplug.c: In function ‘dump_tv_tag’:
>>> /gnu/binutils/src/ld/testplug.c:371:4: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>> It comes from this code:
>>
>>> 368 case LDPT_ADD_INPUT_LIBRARY:
>>> 369 case LDPT_SET_EXTRA_LIBRARY_PATH:
>>> 370 TV_MESSAGE (LDPL_INFO, "func@0x%v\n",
>>> 371 (bfd_vma)(tv->tv_u.tv_message));
>>> 372 break;
>> With 64-bit-bfd on a 32-bit host, bfd_vma is an unsigned long long (64-bit)
>> int, and the tv_message is a 32-bit function pointer, so the warning is true,
>> but it seems pretty useless to me. What's so bad about a cast that doesn't
>> lose any data? It doesn't break the build because there's no -Werror in the
>> test plugin's CFLAGS, and it's of no functional consequence, so I'm not sure
>> whether to do anything about it.
>
> You can cast pointer to uintptr_t/intptr_t first.
That's not C90 though. I couldn't find it used anywhere else in
bfd/binutils/gas/ld, only gold. I think that means I shouldn't use it.
cheers,
DaveK