This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Xtensa] always emit DT_PLTGOT
- From: Bob Wilson <bwilson at tensilica dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 04 Dec 2007 14:49:53 -0800
- Subject: [Xtensa] always emit DT_PLTGOT
The DT_PLTGOT dynamic entry for Xtensa was produced by the linker only when
there was a PLT. This caused a problem for uClibc with an empty program that
had no PLT, because we were relying on uClibc's INIT_GOT hook to do some
initialization. This patch changes BFD to always emit DT_PLTGOT for Xtensa
dynamic objects. Aside from the uClibc issue, this makes sense since DT_PLTGOT
for Xtensa identifies the .got section, which is always present even if there is
no PLT. Tested by building a uClibc toolchain and compiling an empty program.
I've committed this.
2007-12-04 Bob Wilson <bob.wilson@acm.org>
* elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Create DT_PLTGOT
entry for all dynamic objects.
Index: elf32-xtensa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
retrieving revision 1.101
diff -u -p -r1.101 elf32-xtensa.c
--- elf32-xtensa.c 17 Oct 2007 00:30:31 -0000 1.101
+++ elf32-xtensa.c 4 Dec 2007 01:18:48 -0000
@@ -1504,8 +1504,7 @@ elf_xtensa_size_dynamic_sections (bfd *o
if (relplt)
{
- if (!add_dynamic_entry (DT_PLTGOT, 0)
- || !add_dynamic_entry (DT_PLTRELSZ, 0)
+ if (!add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_RELA)
|| !add_dynamic_entry (DT_JMPREL, 0))
return FALSE;
@@ -1519,7 +1518,8 @@ elf_xtensa_size_dynamic_sections (bfd *o
return FALSE;
}
- if (!add_dynamic_entry (DT_XTENSA_GOT_LOC_OFF, 0)
+ if (!add_dynamic_entry (DT_PLTGOT, 0)
+ || !add_dynamic_entry (DT_XTENSA_GOT_LOC_OFF, 0)
|| !add_dynamic_entry (DT_XTENSA_GOT_LOC_SZ, 0))
return FALSE;
}