Created attachment 6348 [details] Test case This is a test case which demonstrates that something changed with ld between binutils 2.10.1 and 2.22 which resulted in a number of our BSPs not being able to do the transform from an ELF file to a compressed binary with a bootloader header. I have attached an unfortunately large file with the binaries that generate this failure. rtems 4.10 - binutils 2.20.1 with patches rtems 4.11 - binutils 2.22 with no patches With the same set of binary files to link. -bash-4.2$ /opt/rtems-4.10/bin/powerpc-rtems4.10-ld -o hello.ralf bootloader.o --just-symbols=hello.exe -b binary rtems.gz -T ppcboot.lds -bash-4.2$ /opt/rtems-4.11/bin/powerpc-rtems4.11-ld -o hello.ralf bootloader.o --just-symbols=hello.exe -b binary rtems.gz -T ppcboot.lds ppcboot.lds:97: undefined symbol `__rtems_start' referenced in expression -bash-4.2$ powerpc-rtems4.10-nm -g hello.exe | grep rtems_start 00000000 T __rtems_start The symbol is there but not found by the reference in ppcboot.lds. ========================================= These is the RTEMS RPM information so this can be traced to that. -bash-4.2$ rpm -qf /opt/rtems-4.10/bin/powerpc-rtems4.10-ld rtems-4.10-powerpc-rtems4.10-binutils-2.20.1-3.fc16.i686 -bash-4.2$ rpm -qf /opt/rtems-4.11/bin/powerpc-rtems4.11-ld rtems-4.11-powerpc-rtems4.11-binutils-2.22-1.fc16.i686 =========================================
I don't think this is a bug in binutils, but a bug in RTEMS. cf. http://www.rtems.org/pipermail/rtems-users/2012-April/009843.html
(In reply to comment #1) > I don't think this is a bug in binutils, but a bug in RTEMS. > > cf. http://www.rtems.org/pipermail/rtems-users/2012-April/009843.html I respectfully think you are completely wrong. That change is a hack in the linker script to ignore the start address in __rtems_start that in the linked executable. It may be zero on some of the BSP variants using this linker script but it is a hack. This linker script and procedure has been in RTEMS since around 1999. The file only has 3 changes in that entire time. http://git.rtems.org/rtems/log/c/src/lib/libbsp/powerpc/shared/bootloader/ppcboot.lds The hack may be a work around but ld broke.
(In reply to comment #2) > (In reply to comment #1) > > I don't think this is a bug in binutils, but a bug in RTEMS. > > > > cf. http://www.rtems.org/pipermail/rtems-users/2012-April/009843.html > > I respectfully think you are completely wrong. That change is a hack in the > linker script to ignore the start address in __rtems_start that in the linked > executable. It may be zero on some of the BSP variants using this linker script > but it is a hack. My understanding of what is happening is RTEMS's linker script is accessing an _uninitialized_ symbol, something newer binutils seeming do not allow anymore. What my "hack" (I call it a fix to a defect in this linkerscript) is to conditionally initialize it to 0, if it's unused. The only change this does is to make an implicit initialization to 0 explict. > This linker script and procedure has been in RTEMS since around 1999. The file > only has 3 changes in that entire time. From what I can gather, binutils has changed its behavior. > http://git.rtems.org/rtems/log/c/src/lib/libbsp/powerpc/shared/bootloader/ppcboot.lds > > The hack may be a work around but ld broke. No, binutils has changed behavior and RTEMS is victim of this behavioral change.
If I run the following script rm -f log.txt for i in `nm -g hello.exe | awk '/ T / {print $3}'` ; do sed s%__rtems_start%$i% < ppcboot.lds > ppcboot.lds.tmp if powerpc-rtems4.11-ld -o hello.ralf bootloader.o --just-symbols=hello.exe -b binary rtems.gz -T ppcboot.lds.tmp -Map hello.map ; then echo good $i >> log.txt else echo bad $i >> log.txt fi done with the attached test case, then some symbols lead to the error and some not. It seems to be pretty arbitrary.
Following up on Sebastian's script to analyse the section of each global symbol to see if there was a pattern. I don't see any pattern and I don't see any difference between the symbols which work and don't work in any nm format output. This is the output: =========================== good: 25 27 T =========================== bad: 717 1 A 4 B 3 D 7 G 4 R 14 S 1036 T And this is the script: ==================================================== rm -f log.txt for i in `powerpc-rtems4.11-nm -g hello.exe | awk '/ T / {print $3}'` ; do sed s%__rtems_start%$i% < ppcboot.lds > ppcboot.lds.tmp powerpc-rtems4.11-ld -o hello.ralf bootloader.o --just-symbols=hello.exe -b binary rtems.gz -T ppcboot.lds.tmp -Map hello.map >/dev/null 2>&1 if test $? -eq 0 ; then echo good $i >> log.txt else echo bad $i >> log.txt fi done breakdown() { echo "===========================" echo "$1: " `grep $1 log.txt | wc -l` grep $1 log.txt | cut -d' ' -f2 | while read s; do powerpc-rtems4.11-nm -g hello.exe | grep $s done | cut -d' ' -f2 | sort | uniq -c } breakdown good breakdown bad ====================================================
I managed to narrow down the time frame when this broke to between 2011-07-09 and 2011-07-11: works - binutils 2.20.1 with rtems 4.10 patches works - binutils 2.21.1 with no patches broken - binutils 2.22 with no patches works - 2.21.52.20110627 works - 2.21.52.20110701 works - 2.21.52.20110708 works - 2.21.52.20110709 broken - 2.21.52.20110710 broken - 2.21.52.20110714 The timestamps for the file changes are so close except for the gold changes that I can't separate them. Ignoring the gold changes, I see two entries in the bfd and ld ChangeLogs. This is the single ld ChangeLog entry: +2011-07-09 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/12942 + * ldlang.c (section_already_linked): Pass "struct already_linked *" + to bfd_section_already_linked. + (lang_process): Set link_info.loading_lto_outputs before + loading LTO outputs. + * plugin.c: Include "libbfd.h". + (add_symbols): Call bfd_section_already_linked with comdat_key. + Since that mentions the phrase "already_linked" and our failure is on already linked code, this looks like the culprit. I don't see any indication that a test case like this one was tested for 12942.
I agree with Joel that this appears to be a bug in the GNU binutils. If you use --just-symbols=EXE, then any symbol defined in EXE should be defined for use in the link. It should be an absolute symbol with the value that it has in EXE. In this case __rtems_start is defined in EXE with a value of 0. The linker should not give an "undefined symbol" error here. I don't see how H.J.'s patch could lead to this problem, but perhaps it does somehow.
(In reply to comment #6) > I managed to narrow down the time frame when this broke to between 2011-07-09 > and 2011-07-11: > > works - binutils 2.20.1 with rtems 4.10 patches > works - binutils 2.21.1 with no patches > broken - binutils 2.22 with no patches > works - 2.21.52.20110627 > works - 2.21.52.20110701 > works - 2.21.52.20110708 > works - 2.21.52.20110709 > broken - 2.21.52.20110710 > broken - 2.21.52.20110714 > Please use "git bisect" on binutils git mirror to identify which checkin caused it.
$ git bisect bad 8b6ed5b4da2a02a7cefa7db05e99cce952cbcd54 is the first bad commit commit 8b6ed5b4da2a02a7cefa7db05e99cce952cbcd54 Author: Alan Modra <amodra@bigpond.net.au> Date: Sat Jul 9 06:20:50 2011 +0000 PR ld/12942 bfd/ * elflink.c (elf_link_add_object_symbols): Use elf_discarded_section rather than kept_section to determine whether a symbol is from a discarded section. * cofflink.c (coff_link_add_symbols): Make symbols from discarded sections appear undefined. * elf-bfd.h (_bfd_elf_section_already_linked): Replace "asection *" with "struct already_linked *". * libbfd-in.h (_bfd_nolink_section_already_linked): Likewise. (_bfd_generic_section_already_linked): Likewise. (bfd_section_already_linked_table_insert): Likewise. (struct already_linked): New. (struct bfd_section_already_linked): Use it. * elflink.c (_bfd_elf_section_already_linked): Replace. "asection *" with "struct already_linked *". Replace the plugin dummy with the LTO output. * linker.c (_bfd_generic_section_already_linked): Likewise. * targets.c (struct already_linked): Add forward declaration. (bfd_target): Replace "struct bfd_section *" with "struct already_linked *" in _section_already_linked. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. include/ * bfdlink.h (bfd_link_info): Add loading_lto_outputs. ld/ * ldlang.c (section_already_linked): Pass "struct already_linked *" to bfd_section_already_linked. (lang_process): Set link_info.loading_lto_outputs before loading LTO outputs. * plugin.c: Include "libbfd.h". (add_symbols): Call bfd_section_already_linked with comdat_key. :040000 040000 b74c43ec7468f632b6a9d46d8fdd8097c1d9a004 1ee60c94c23664ee75221d3d778704ecd60c6b41 M bfd :040000 040000 8fbaed852e51637be17fcd0fdf4d841df8399c26 108b5ddd493c9e4de599ba753f97d50b79d26522 M include :040000 040000 9251eb9c0bb7ca6c4fa6574d8f42551c5e1055e0 1f402ac26f7639b97146c3368964a712a0f3d0a0 M ld
Huh, the change I made in elf_link_add_object_symbols to use elf_discarded_section ought to be good. elf_discarded_section should say --just-symbols sections are not discarded (sec_info_type != ELF_INFO_TYPE_JUST_SYMS). But for some reason sec_info_type is left at zero in this case.
That's because the ld ouput is a binary format file. info-hash is a bfd_link_generic_hash_table which means we fail if (is_elf_hash_table (info->hash)) in _bfd_elf_link_just_syms. Testing a fix.
CVSROOT: /cvs/src Module name: src Changes by: amodra@sourceware.org 2012-04-24 05:12:40 Modified files: bfd : ChangeLog bfd-in.h bfd-in2.h elf-bfd.h elf-eh-frame.c elf-m10200.c elf-m10300.c elf.c elf32-arm.c elf32-avr.c elf32-bfin.c elf32-cr16.c elf32-cr16c.c elf32-cris.c elf32-crx.c elf32-d10v.c elf32-epiphany.c elf32-fr30.c elf32-frv.c elf32-h8300.c elf32-hppa.c elf32-i370.c elf32-i386.c elf32-i860.c elf32-ip2k.c elf32-iq2000.c elf32-lm32.c elf32-m32c.c elf32-m32r.c elf32-m68hc1x.c elf32-m68k.c elf32-mcore.c elf32-mep.c elf32-moxie.c elf32-msp430.c elf32-mt.c elf32-openrisc.c elf32-ppc.c elf32-rl78.c elf32-rx.c elf32-s390.c elf32-score.c elf32-score7.c elf32-sh.c elf32-spu.c elf32-tic6x.c elf32-tilepro.c elf32-v850.c elf32-vax.c elf32-xc16x.c elf32-xstormy16.c elf32-xtensa.c elf64-alpha.c elf64-hppa.c elf64-ia64-vms.c elf64-mmix.c elf64-ppc.c elf64-s390.c elf64-sh64.c elf64-x86-64.c elflink.c elfnn-ia64.c elfxx-mips.c elfxx-sparc.c elfxx-tilegx.c linker.c reloc.c section.c ld : ChangeLog ldlang.c ldwrite.c ld/emultempl : armelf.em hppaelf.em ppc64elf.em tic6xdsbt.em Log message: PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5659&r2=1.5660 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in.h.diff?cvsroot=src&r1=1.161&r2=1.162 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in2.h.diff?cvsroot=src&r1=1.564&r2=1.565 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-bfd.h.diff?cvsroot=src&r1=1.333&r2=1.334 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-eh-frame.c.diff?cvsroot=src&r1=1.87&r2=1.88 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-m10200.c.diff?cvsroot=src&r1=1.37&r2=1.38 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-m10300.c.diff?cvsroot=src&r1=1.112&r2=1.113 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf.c.diff?cvsroot=src&r1=1.551&r2=1.552 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-arm.c.diff?cvsroot=src&r1=1.286&r2=1.287 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-avr.c.diff?cvsroot=src&r1=1.53&r2=1.54 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-bfin.c.diff?cvsroot=src&r1=1.55&r2=1.56 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-cr16.c.diff?cvsroot=src&r1=1.17&r2=1.18 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-cr16c.c.diff?cvsroot=src&r1=1.16&r2=1.17 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-cris.c.diff?cvsroot=src&r1=1.119&r2=1.120 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-crx.c.diff?cvsroot=src&r1=1.16&r2=1.17 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-d10v.c.diff?cvsroot=src&r1=1.39&r2=1.40 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-epiphany.c.diff?cvsroot=src&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-fr30.c.diff?cvsroot=src&r1=1.40&r2=1.41 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-frv.c.diff?cvsroot=src&r1=1.74&r2=1.75 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-h8300.c.diff?cvsroot=src&r1=1.58&r2=1.59 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-hppa.c.diff?cvsroot=src&r1=1.184&r2=1.185 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-i370.c.diff?cvsroot=src&r1=1.71&r2=1.72 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-i386.c.diff?cvsroot=src&r1=1.270&r2=1.271 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-i860.c.diff?cvsroot=src&r1=1.42&r2=1.43 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-ip2k.c.diff?cvsroot=src&r1=1.28&r2=1.29 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-iq2000.c.diff?cvsroot=src&r1=1.27&r2=1.28 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-lm32.c.diff?cvsroot=src&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-m32c.c.diff?cvsroot=src&r1=1.24&r2=1.25 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-m32r.c.diff?cvsroot=src&r1=1.104&r2=1.105 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-m68hc1x.c.diff?cvsroot=src&r1=1.41&r2=1.42 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-m68k.c.diff?cvsroot=src&r1=1.130&r2=1.131 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-mcore.c.diff?cvsroot=src&r1=1.54&r2=1.55 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-mep.c.diff?cvsroot=src&r1=1.16&r2=1.17 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-moxie.c.diff?cvsroot=src&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-msp430.c.diff?cvsroot=src&r1=1.22&r2=1.23 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-mt.c.diff?cvsroot=src&r1=1.14&r2=1.15 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-openrisc.c.diff?cvsroot=src&r1=1.31&r2=1.32 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-ppc.c.diff?cvsroot=src&r1=1.308&r2=1.309 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-rl78.c.diff?cvsroot=src&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-rx.c.diff?cvsroot=src&r1=1.16&r2=1.17 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-s390.c.diff?cvsroot=src&r1=1.117&r2=1.118 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-score.c.diff?cvsroot=src&r1=1.22&r2=1.23 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-score7.c.diff?cvsroot=src&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-sh.c.diff?cvsroot=src&r1=1.177&r2=1.178 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-spu.c.diff?cvsroot=src&r1=1.103&r2=1.104 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-tic6x.c.diff?cvsroot=src&r1=1.29&r2=1.30 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-tilepro.c.diff?cvsroot=src&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-v850.c.diff?cvsroot=src&r1=1.81&r2=1.82 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-vax.c.diff?cvsroot=src&r1=1.65&r2=1.66 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-xc16x.c.diff?cvsroot=src&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-xstormy16.c.diff?cvsroot=src&r1=1.43&r2=1.44 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-xtensa.c.diff?cvsroot=src&r1=1.131&r2=1.132 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-alpha.c.diff?cvsroot=src&r1=1.182&r2=1.183 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-hppa.c.diff?cvsroot=src&r1=1.105&r2=1.106 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ia64-vms.c.diff?cvsroot=src&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-mmix.c.diff?cvsroot=src&r1=1.64&r2=1.65 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ppc.c.diff?cvsroot=src&r1=1.379&r2=1.380 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-s390.c.diff?cvsroot=src&r1=1.116&r2=1.117 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-sh64.c.diff?cvsroot=src&r1=1.89&r2=1.90 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-x86-64.c.diff?cvsroot=src&r1=1.256&r2=1.257 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&r1=1.437&r2=1.438 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfnn-ia64.c.diff?cvsroot=src&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfxx-mips.c.diff?cvsroot=src&r1=1.302&r2=1.303 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfxx-sparc.c.diff?cvsroot=src&r1=1.65&r2=1.66 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfxx-tilegx.c.diff?cvsroot=src&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/linker.c.diff?cvsroot=src&r1=1.93&r2=1.94 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/reloc.c.diff?cvsroot=src&r1=1.225&r2=1.226 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/section.c.diff?cvsroot=src&r1=1.111&r2=1.112 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2431&r2=1.2432 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlang.c.diff?cvsroot=src&r1=1.388&r2=1.389 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldwrite.c.diff?cvsroot=src&r1=1.35&r2=1.36 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/armelf.em.diff?cvsroot=src&r1=1.84&r2=1.85 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/hppaelf.em.diff?cvsroot=src&r1=1.57&r2=1.58 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/ppc64elf.em.diff?cvsroot=src&r1=1.81&r2=1.82 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/tic6xdsbt.em.diff?cvsroot=src&r1=1.3&r2=1.4
Fixed
Thanks. The head now works again. Can this patch be applied to the active release branches? From an earlier comment of mine: works - binutils 2.21.1 with no patches broken - binutils 2.22 with no patches If there are to be more 2.22 patches, this should be applied to that branch.
Created attachment 6371 [details] patch against binutis-2_22-branch This is my attempt at backporting Alan's patch to binutils-2.22. The patch seems to avoid the RTEMS linkage breakdown, however the general consequences and the consquences on other targets are unclear to me.
CVSROOT: /cvs/src Module name: src Branch: binutils-2_22-branch Changes by: nickc@sourceware.org 2012-05-11 12:24:39 Modified files: bfd : ChangeLog bfd-in.h bfd-in2.h elf-bfd.h elf-eh-frame.c elf-m10200.c elf-m10300.c elf.c elf32-arm.c elf32-avr.c elf32-bfin.c elf32-cr16.c elf32-cr16c.c elf32-cris.c elf32-crx.c elf32-d10v.c elf32-fr30.c elf32-frv.c elf32-h8300.c elf32-hppa.c elf32-i370.c elf32-i386.c elf32-i860.c elf32-ip2k.c elf32-iq2000.c elf32-lm32.c elf32-m32c.c elf32-m32r.c elf32-m68hc1x.c elf32-m68k.c elf32-mcore.c elf32-mep.c elf32-moxie.c elf32-msp430.c elf32-mt.c elf32-openrisc.c elf32-ppc.c elf32-rx.c elf32-s390.c elf32-score.c elf32-score7.c elf32-sh.c elf32-spu.c elf32-tic6x.c elf32-tilepro.c elf32-v850.c elf32-vax.c elf32-xc16x.c elf32-xstormy16.c elf32-xtensa.c elf64-alpha.c elf64-hppa.c elf64-mmix.c elf64-ppc.c elf64-s390.c elf64-sh64.c elf64-x86-64.c elflink.c elfnn-ia64.c elfxx-mips.c elfxx-sparc.c elfxx-tilegx.c linker.c reloc.c section.c ld : ChangeLog ldlang.c ldwrite.c ld/emultempl : armelf.em hppaelf.em ppc64elf.em tic6xdsbt.em Log message: PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.5473.2.37&r2=1.5473.2.38 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in.h.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.158&r2=1.158.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in2.h.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.549.2.1&r2=1.549.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-bfd.h.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.329&r2=1.329.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-eh-frame.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.87&r2=1.87.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-m10200.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.37&r2=1.37.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-m10300.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.108&r2=1.108.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.543&r2=1.543.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-arm.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.275.2.1&r2=1.275.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-avr.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.51.2.1&r2=1.51.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-bfin.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.54&r2=1.54.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-cr16.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.16&r2=1.16.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-cr16c.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.16&r2=1.16.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-cris.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.115.2.2&r2=1.115.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-crx.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.16&r2=1.16.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-d10v.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.39&r2=1.39.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-fr30.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.40&r2=1.40.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-frv.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.73&r2=1.73.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-h8300.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.58&r2=1.58.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-hppa.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.179.2.2&r2=1.179.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-i370.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.70&r2=1.70.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-i386.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.260.2.1&r2=1.260.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-i860.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.42&r2=1.42.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-ip2k.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.28&r2=1.28.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-iq2000.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.27&r2=1.27.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-lm32.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.9&r2=1.9.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-m32c.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.24&r2=1.24.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-m32r.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.102&r2=1.102.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-m68hc1x.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.40&r2=1.40.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-m68k.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.126.2.1&r2=1.126.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-mcore.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.54&r2=1.54.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-mep.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.16&r2=1.16.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-moxie.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.4&r2=1.4.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-msp430.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.22&r2=1.22.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-mt.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.14&r2=1.14.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-openrisc.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.31&r2=1.31.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-ppc.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.302.2.2&r2=1.302.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-rx.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.12&r2=1.12.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-s390.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.108&r2=1.108.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-score.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.22&r2=1.22.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-score7.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.9&r2=1.9.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-sh.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.172&r2=1.172.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-spu.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.101&r2=1.101.4.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-tic6x.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.27.2.1&r2=1.27.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-tilepro.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.3&r2=1.3.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-v850.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.81&r2=1.81.4.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-vax.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.64&r2=1.64.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-xc16x.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.9&r2=1.9.6.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-xstormy16.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.43&r2=1.43.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-xtensa.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.130&r2=1.130.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-alpha.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.180&r2=1.180.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-hppa.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.105&r2=1.105.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-mmix.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.64&r2=1.64.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ppc.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.363.2.5&r2=1.363.2.6 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-s390.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.108&r2=1.108.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-sh64.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.87&r2=1.87.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-x86-64.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.239.2.2&r2=1.239.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.420.2.11&r2=1.420.2.12 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfnn-ia64.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.4&r2=1.4.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfxx-mips.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.292.2.5&r2=1.292.2.6 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfxx-sparc.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.60.2.1&r2=1.60.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfxx-tilegx.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.3&r2=1.3.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/linker.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.90&r2=1.90.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/reloc.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.216.2.1&r2=1.216.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/section.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.111&r2=1.111.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.2373.2.9&r2=1.2373.2.10 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlang.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.378.2.1&r2=1.378.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldwrite.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.33&r2=1.33.4.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/armelf.em.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.82&r2=1.82.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/hppaelf.em.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.56&r2=1.56.4.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/ppc64elf.em.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.75.2.2&r2=1.75.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/tic6xdsbt.em.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.3&r2=1.3.2.1
Better I think to apply the full patch to the 2.22 branch sources. Which is what I have done.