Without passing --enable-werror=no to configure the build fails here: make[4]: Entering directory `/home/cjanuary/code/patches/tarball/build-gdb-cvs-aix-53-ppc64/bfd' /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../src/bfd -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE -DAIX_CORE -DAIX_WEAK_SUPPORT -I. -I../../src/bfd -I../../src/bfd/../include -DHAVE_rs6000coff_vec -DHAVE_aix5coff64_vec -I./../intl -DBINDIR='"/usr/local/bin"' -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT reloc.lo -MD -MP -MF .deps/reloc.Tpo -c -o reloc.lo ../../src/bfd/reloc.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../src/bfd -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE -DAIX_CORE -DAIX_WEAK_SUPPORT -I. -I../../src/bfd -I../../src/bfd/../include -DHAVE_rs6000coff_vec -DHAVE_aix5coff64_vec -I./../intl -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT reloc.lo -MD -MP -MF .deps/reloc.Tpo -c ../../src/bfd/reloc.c -o reloc.o cc1: warnings being treated as errors ../../src/bfd/reloc.c: In function 'bfd_generic_lookup_section_flags': ../../src/bfd/reloc.c:6127: warning: declaration of 'finfo' shadows a global declaration /usr/include/unistd.h:937: warning: shadowed declaration is here make[4]: *** [reloc.lo] Error 1 The line in unistd.h: extern int ffinfo(int, int, void *, int32long64_t); and the line in reloc.c: void bfd_generic_lookup_section_flags (struct bfd_link_info *info ATTRIBUTE_UNUSED, struct flag_info *finfo) Obviously this warning can be ignored. Either configure needs to suppress the warning or not enable -Werror on AIX.
bfd is owned by binutils. Changing product.
I think we should just remove -Wshadow from WARN_CFLAGS, and fix gcc to stop warning about this sort of shadowing.
I was recently trying to build 2.22 on my AIX (6.1) system when I ran into this problem. My solution was simple: Change the variable name "finfo" to something less collision-prone ("flaginfo"): blue# diff -u bfd/reloc.c_orig bfd/reloc.c --- bfd/reloc.c_orig 2011-07-24 09:20:06.000000000 -0500 +++ bfd/reloc.c 2011-12-31 00:32:36.000000000 -0600 @@ -6124,9 +6124,9 @@ void bfd_generic_lookup_section_flags (struct bfd_link_info *info ATTRIBUTE_UNUSED, - struct flag_info *finfo) + struct flag_info *flaginfo) { - if (finfo != NULL) + if (flaginfo != NULL) { (*_bfd_error_handler) (_("INPUT_SECTION_FLAGS are not supported.\n")); return; To me, that seemed effective and harmless. Around here: blue# uname -a AIX blue 1 6 000F1F6E4C00 blue# gcc --version gcc (GCC) 4.2.0 [...]
Hi Steven, There are lots of instances of the use of "finfo" as a variable name in the binutils sources. Are you sure that just changing the one use in bfd/reloc.c is sufficient in order to allow the binutils to compile under AIX ? Cheers Nick
> Are you sure [...] Pretty sure, plus the other stuff described elsewhere: http://sourceware.org/bugzilla/show_bug.cgi?id=13558 If I ran the world (and cared about AIX), then I'd probably change them all, but that was the only instance which stopped the build here. The conflict was with <unistd.h>. Perhaps the other instances of "finfo" deftly avoid <unistd.h>?
CVSROOT: /cvs/src Module name: src Changes by: nickc@sourceware.org 2012-01-06 15:44:34 Modified files: bfd : ChangeLog reloc.c Log message: PR binutils/13121 * reloc.c (bfd_generic_lookup_section_flags): Rename 'finfo' to 'flaginfo' to avoid conflicts with AIX system headers. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5576&r2=1.5577 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/reloc.c.diff?cvsroot=src&r1=1.219&r2=1.220
Hi Steven, In which case I am happy to make a small change to the sources in order to continue to allow them to be compiled with -Werror. Cheers Nick
I encountered this same issue building binutils 2.22 on AIX 4.3. If you build with --enable-targets=all, however, then reloc.c isn't the only file that needs patching. As of current git master, the following files similarly make use of variables/parameters named "finfo" and thus need the same treatment: bfd/aoutx.h bfd/coff-ppc.c bfd/cofflink.c bfd/elf32-arm.c bfd/elf64-sparc.c bfd/elflink.c bfd/pdp11.c binutils/rescoff.c
CVSROOT: /cvs/src Module name: src Changes by: nickc@sourceware.org 2012-05-01 16:07:36 Modified files: bfd : ChangeLog aoutx.h coff-ppc.c cofflink.c elf32-arm.c elf64-sparc.c elflink.c pdp11.c binutils : ChangeLog rescoff.c Log message: PR binutils/13121 Rename 'finfo' to 'flaginfo' to avoid conflicts with AIX system headers. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5664&r2=1.5665 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/aoutx.h.diff?cvsroot=src&r1=1.87&r2=1.88 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/coff-ppc.c.diff?cvsroot=src&r1=1.41&r2=1.42 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/cofflink.c.diff?cvsroot=src&r1=1.80&r2=1.81 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-arm.c.diff?cvsroot=src&r1=1.288&r2=1.289 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-sparc.c.diff?cvsroot=src&r1=1.127&r2=1.128 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&r1=1.438&r2=1.439 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/pdp11.c.diff?cvsroot=src&r1=1.49&r2=1.50 http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1892&r2=1.1893 http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/rescoff.c.diff?cvsroot=src&r1=1.12&r2=1.13
Sources updated - all variables called 'finfo' should be renamed now.