Fix Relocs for x86-64
Andreas Jaeger
aj@suse.de
Sat Mar 10 01:12:00 GMT 2001
Hans-Peter Nilsson <hans-peter.nilsson@axis.com> writes:
> > From: Andreas Jaeger <aj@suse.de>
> > Date: 07 Mar 2001 14:48:08 +0100
>
> > We didn't handle some relocations correctly for x86-64, I've committed
> > the appended patch to both branches after testing on both branches.
>
> I see the same hunk of code in several targets, but rarely a
> line indicating what situations the code reflects. If you
> happen to know and have this in clear memory, how about adding a
> descriptive comment line or two? See the DWARF comment. I'll
> help with an example which should match here.
>
> /* When creating a shared library, we can have an
> ordinary relocation for a symbol defined in a shared
> library (perhaps the one we create). We then make
> the relocation value zero, as it will be added into
> the relocation addend in this shared library.
> FIXME: Not sure this example covers the
> h->elf_link_hash_flags test. */
That description looks fine. What do others think? I'm in favour of
including it for x86-64.
Thanks,
Andreas
> > + || (info->shared
> > + && ((! info->symbolic && h->dynindx != -1)
> > + || (h->elf_link_hash_flags
> > + & ELF_LINK_HASH_DEF_REGULAR) == 0)
> > + && ( r_type == R_X86_64_8 ||
> > + r_type == R_X86_64_16 ||
> > + r_type == R_X86_64_32 ||
> > + r_type == R_X86_64_64 ||
> > + r_type == R_X86_64_PC16 ||
> > + r_type == R_X86_64_PC32)
> > + && ((input_section->flags & SEC_ALLOC) != 0
> > + /* DWARF will emit R_X86_64_32 relocations in its
> > + sections against symbols defined externally
> > + in shared libraries. We can't do anything
> > + with them here. */
> > + || ((input_section->flags & SEC_DEBUGGING) != 0
> > + && (h->elf_link_hash_flags
> > + & ELF_LINK_HASH_DEF_DYNAMIC) != 0))))
>
> brgds, H-P
>
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj
More information about the Binutils
mailing list