Fix for cris-* regressions with "PATCH: PR ld/13177"
Tristan Gingold
gingold@adacore.com
Fri Oct 14 08:07:00 GMT 2011
More information about the Binutils mailing list
Fri Oct 14 08:07:00 GMT 2011
- Previous message (by thread): Fix for cris-* regressions with "PATCH: PR ld/13177"
- Next message (by thread): Handling R_ARM_JUMP24 with inter-working
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Oct 14, 2011, at 9:01 AM, Hans-Peter Nilsson wrote: >> Date: Fri, 16 Sep 2011 09:24:22 -0700 >> From: "H.J. Lu" <hjl.tools@gmail.com> > >>> cris-elf: >>> Running /tmp/hpautotest-binutils/bsrc/src/ld/testsuite/ld-cris/cris.exp ... >>> FAIL: ld-cris/pic-gc-72 >>> >>> ld.log: >>> Executing on host: sh -c {/tmp/hpautotest-binutils/cris-axis-elf/ld/../binutils/objdump -s -t -R -p -T tmpdir/dump > tmpdir/dump.out 2>ld.tmp} /dev/null (timeout = 300) >>> exited abnormally with 0, output:BFD: tmpdir/dump(.rela.dyn): relocation 0 has invalid symbol index 16777215 >>> >>> ... >> >> The problem is cris backend doesn't use plt.refcount nor got.refcount. > > Wrong, it does, modulo bugs of course. The problem is "just" > mismatching bookkeeping between cris_elf_gc_sweep_hook and > cris_elf_check_relocs. Fixed thus, committed. > > Yuck for that bookkeeping; a generally error-prone machinery. > There has to be a better way to "count down". Something like > registering the "increment" for each reloc and then just apply a > general method without having to inspect the reloc and the > related symbol? (Who said "C++"? :-) > > Tristan, ok for 2.22 as well? Yes. > What's policy there; are > target-specific fixes up to target maintainers or is explicit > approval required for that too? Asking is very welcome because it would avoid possible collision with the creation of a release. Tristan. > > bfd: > * elf32-cris.c (cris_elf_gc_sweep_hook) <R_CRIS_16_GOTPLT> > <R_CRIS_32_GOTPLT>: Fix missing update of gotplt refcount for > global symbols. > <R_CRIS_8, R_CRIS_16, R_CRIS_32>: New cases for similar missing > updates of the plt refcount. > (elf_cris_adjust_gotplt_to_got): Assert integrity of the gotplt > refcount in relation to the plt refcount. > > Index: elf32-cris.c > =================================================================== > RCS file: /cvs/src/src/bfd/elf32-cris.c,v > retrieving revision 1.115 > diff -p -u -r1.115 elf32-cris.c > --- elf32-cris.c 13 Jun 2011 00:59:10 -0000 1.115 > +++ elf32-cris.c 14 Oct 2011 06:43:36 -0000 > @@ -2663,6 +2663,9 @@ cris_elf_gc_sweep_hook (bfd *abfd, > /* For local symbols, treat these like GOT relocs. */ > if (h == NULL) > goto local_got_reloc; > + else > + /* For global symbols, adjust the reloc-specific refcount. */ > + elf_cris_hash_entry (h)->gotplt_refcount--; > /* Fall through. */ > > case R_CRIS_32_PLT_GOTREL: > @@ -2671,10 +2674,14 @@ cris_elf_gc_sweep_hook (bfd *abfd, > local_got_refcounts[-1]--; > /* Fall through. */ > > + case R_CRIS_8: > + case R_CRIS_16: > + case R_CRIS_32: > case R_CRIS_8_PCREL: > case R_CRIS_16_PCREL: > case R_CRIS_32_PCREL: > case R_CRIS_32_PLT_PCREL: > + /* Negate the increment we did in cris_elf_check_relocs. */ > if (h != NULL) > { > if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT > @@ -2733,6 +2740,11 @@ elf_cris_adjust_gotplt_to_got (h, p) > { > struct bfd_link_info *info = (struct bfd_link_info *) p; > > + /* A GOTPLT reloc, when activated, is supposed to be included into > + the PLT refcount. */ > + BFD_ASSERT (h->gotplt_refcount == 0 > + || h->gotplt_refcount <= h->root.plt.refcount); > + > /* If nobody wanted a GOTPLT with this symbol, we're done. */ > if (h->gotplt_refcount <= 0) > return TRUE; > > > ld/testsuite: > > * ld-cris/pic-gc-72.d: Adjust for dropping unused undefined > dynamic symbol "dsofn". > > Index: ld-cris/pic-gc-72.d > =================================================================== > RCS file: /cvs/src/src/ld/testsuite/ld-cris/pic-gc-72.d,v > retrieving revision 1.1 > diff -p -u -r1.1 pic-gc-72.d > --- ld-cris/pic-gc-72.d 25 Nov 2008 04:10:47 -0000 1.1 > +++ ld-cris/pic-gc-72.d 14 Oct 2011 06:41:41 -0000 > @@ -19,10 +19,11 @@ Contents of section .dynsym: > Contents of section .dynstr: > #... > Contents of section .text: > - 0188 0f050f05 .* > + 016e 0f050f05 .* > Contents of section .dynamic: > + 2174 .* > #... > Contents of section .got: > - 21e4 8c210000 00000000 00000000 .* > + 21cc 74210000 00000000 00000000 .* > Contents of section .data: > - 21f0 00000000 .* > + 21d8 00000000 .* > > brgds, H-P
- Previous message (by thread): Fix for cris-* regressions with "PATCH: PR ld/13177"
- Next message (by thread): Handling R_ARM_JUMP24 with inter-working
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list