This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Add PIE support for Xtensa
- From: Bob Wilson <bwilson at tensilica dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 10 Oct 2006 13:57:54 -0700
- Subject: Add PIE support for Xtensa
I've committed this patch to add PIE support for Xtensa. Better late than never.
bfd/
* elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Add DT_DEBUG
for PIE executables.
ld/
* emulparams/elf32xtensa.sh (GENERATE_PIE_SCRIPT): Enable.
Index: bfd/elf32-xtensa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
retrieving revision 1.70
diff -u -r1.70 elf32-xtensa.c
--- bfd/elf32-xtensa.c 28 Sep 2006 13:27:32 -0000 1.70
+++ bfd/elf32-xtensa.c 10 Oct 2006 20:46:28 -0000
@@ -1123,8 +1123,7 @@
sname = (char *) bfd_malloc (10);
sprintf (sname, ".plt.%u", chunk);
- s = bfd_make_section_with_flags (dynobj, sname,
- flags | SEC_CODE);
+ s = bfd_make_section_with_flags (dynobj, sname, flags | SEC_CODE);
if (s == NULL
|| ! bfd_set_section_alignment (dynobj, s, 2))
return FALSE;
@@ -1471,7 +1470,7 @@
#define add_dynamic_entry(TAG, VAL) \
_bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (! info->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
return FALSE;
Index: ld/emulparams/elf32xtensa.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32xtensa.sh,v
retrieving revision 1.7
diff -u -r1.7 elf32xtensa.sh
--- ld/emulparams/elf32xtensa.sh 5 Oct 2006 01:06:13 -0000 1.7
+++ ld/emulparams/elf32xtensa.sh 10 Oct 2006 20:46:28 -0000
@@ -10,6 +10,7 @@
ARCH=xtensa
MACHINE=
GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
GENERATE_COMBRELOC_SCRIPT=yes
NO_SMALL_DATA=yes
PLT="/* .plt* sections are embedded in .text */"