Fix building with Sun CC breakage.
Pedro Alves
pedro_alves@portugalmail.pt
Thu Oct 25 14:38:00 GMT 2007
Hi guys,
For a while now, it hasn't been possible to build binutils with Sun CC.
$cc -V
cc: Sun WorkShop 6 update 2 C 5.3 2001/05/15
It bails out with this:
/bin/bash ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I.
-I../../binutils-2.18.50/bfd -I. -I. -I../../binutils-2.18.50/bfd
-I../../binutils-2.18.50/bfd/../include -I./../intl -g -c -o
elf.lo ../../binutils-2.18.50/bfd/elf.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -I../../binutils-2.18.50/bfd
-I. -I. -I../../binutils-2.18.50/bfd
-I../../binutils-2.18.50/bfd/../include -I./../intl -g -c
../../binutils-2.18.50/bfd/elf.c -o elf.o
"../../binutils-2.18.50/bfd/elf.c", line 856: non-constant initializer: op "?"
"../../binutils-2.18.50/bfd/elf.c", line 859: non-constant initializer: op "?"
"../../binutils-2.18.50/bfd/elf.c", line 864: non-constant initializer: op "?"
"../../binutils-2.18.50/bfd/elf.c", line 871: non-constant initializer: op "?"
"../../binutils-2.18.50/bfd/elf.c", line 993: cannot recover from
previous errors
That comes from usage of STRING_COMMA_LEN which is defined as:
bfd-in.h:#define STRING_COMMA_LEN(STR) (STR), ((STR) ? sizeof (STR) - 1 : 0)
It turns out that supporting a NULL STR doesn't have much value, as it is
only used 6 times:
$egrep -e "STRING_COMMA_LEN \(([A-Z]|[a-z]|0|_)" * -rn
ld/pe-dll.c:198: { STRING_COMMA_LEN (NULL) }
ld/pe-dll.c:234: { STRING_COMMA_LEN (NULL) }
ld/pe-dll.c:324: { STRING_COMMA_LEN (NULL) }
ld/pe-dll.c:339: { STRING_COMMA_LEN (NULL) }
ld/pe-dll.c:353: { STRING_COMMA_LEN (NULL) }
ld/pe-dll.c:359: { STRING_COMMA_LEN (NULL) }
The attached patches inline those usages, and remove the support
for passing a NULL STR, making Sun CC happy again.
Cheers,
Pedro Alves
-------------- next part --------------
A non-text attachment was scrubbed...
Name: solaris_bfd.diff
Type: text/x-patch
Size: 2274 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20071025/beddb69e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: solaris_ld.diff
Type: text/x-patch
Size: 2220 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20071025/beddb69e/attachment-0001.bin>
More information about the Binutils
mailing list