diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-08-31 02:52:14 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-08-31 02:52:14 +0000 |
commit | 11cba4accf7f9a82fdb7902f0e36521038eda205 (patch) | |
tree | 1e4ea45acd8dea6d96ebd718ca1e8727704f2738 /ld | |
parent | b69fdb4ec950776d74fb10ed44a624089dbb23af (diff) | |
download | gdb-11cba4accf7f9a82fdb7902f0e36521038eda205.zip gdb-11cba4accf7f9a82fdb7902f0e36521038eda205.tar.gz gdb-11cba4accf7f9a82fdb7902f0e36521038eda205.tar.bz2 |
Provide __executable_start for PIE
ld/
PR ld/14525
* scripttempl/elf.sc: Also provide __executable_start for PIE.
ld/testsuite/
PR ld/14525
* ld-elf/elf.exp: Run pr14525.
* ld-elf/pr14525.c: New.
* ld-elf/pr14525.out: Likewise.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 23 | ||||
-rw-r--r-- | ld/scripttempl/elf.sc | 2 | ||||
-rw-r--r-- | ld/testsuite/ChangeLog | 26 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/elf.exp | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr14525.c | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr14525.out | 1 |
6 files changed, 45 insertions, 19 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index ab233cc..22f7c69 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2012-08-30 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/14525 + * scripttempl/elf.sc: Also provide __executable_start for PIE. + 2012-08-17 Kai Tietz <ktietz@redhat.com> PR ld/14326 @@ -10,15 +15,15 @@ * po/uk.po: New Ukranian translation. 2012-08-13 Ian Bolton <ian.bolton@arm.com> - Laurent Desnogues <laurent.desnogues@arm.com> - Jim MacArthur <jim.macarthur@arm.com> - Marcus Shawcroft <marcus.shawcroft@arm.com> - Nigel Stephens <nigel.stephens@arm.com> - Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> - Richard Earnshaw <rearnsha@arm.com> - Sofiane Naci <sofiane.naci@arm.com> - Tejas Belagod <tejas.belagod@arm.com> - Yufeng Zhang <yufeng.zhang@arm.com> + Laurent Desnogues <laurent.desnogues@arm.com> + Jim MacArthur <jim.macarthur@arm.com> + Marcus Shawcroft <marcus.shawcroft@arm.com> + Nigel Stephens <nigel.stephens@arm.com> + Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> + Richard Earnshaw <rearnsha@arm.com> + Sofiane Naci <sofiane.naci@arm.com> + Tejas Belagod <tejas.belagod@arm.com> + Yufeng Zhang <yufeng.zhang@arm.com> * Makefile.am: Add AArch64. * Makefile.in: Regenerate. diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 51a655e..72d2af7 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -335,7 +335,7 @@ SECTIONS /* Read-only sections, merged into text segment: */ ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}} ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}} - ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}} + ${CREATE_PIE+${RELOCATING+PROVIDE (__executable_start = ${SHLIB_TEXT_START_ADDR}); . = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}} EOF emit_early_ro() diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index eca4181..5537d0a 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2012-08-30 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/14525 + * ld-elf/elf.exp: Run pr14525. + + * ld-elf/pr14525.c: New. + * ld-elf/pr14525.out: Likewise. + 2012-08-28 Maciej W. Rozycki <macro@codesourcery.com> * ld-elf/export-class.sd: New test. @@ -81,15 +89,15 @@ * ld-mips-elf/mips-elf.exp: Run the new tests. 2012-08-13 Ian Bolton <ian.bolton@arm.com> - Laurent Desnogues <laurent.desnogues@arm.com> - Jim MacArthur <jim.macarthur@arm.com> - Marcus Shawcroft <marcus.shawcroft@arm.com> - Nigel Stephens <nigel.stephens@arm.com> - Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> - Richard Earnshaw <rearnsha@arm.com> - Sofiane Naci <sofiane.naci@arm.com> - Tejas Belagod <tejas.belagod@arm.com> - Yufeng Zhang <yufeng.zhang@arm.com> + Laurent Desnogues <laurent.desnogues@arm.com> + Jim MacArthur <jim.macarthur@arm.com> + Marcus Shawcroft <marcus.shawcroft@arm.com> + Nigel Stephens <nigel.stephens@arm.com> + Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> + Richard Earnshaw <rearnsha@arm.com> + Sofiane Naci <sofiane.naci@arm.com> + Tejas Belagod <tejas.belagod@arm.com> + Yufeng Zhang <yufeng.zhang@arm.com> * ld-aarch64/aarch64-elf.exp: New file. * ld-aarch64/aarch64.ld: New file. diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index 1780b50..a97e3df 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -151,6 +151,7 @@ set array_tests_pie { {"PIE init array" "-pie" "" {init.c} "init" "init.out" "-fPIE"} {"PIE fini array" "-pie" "" {fini.c} "fini" "fini.out" "-fPIE"} {"PIE init array mixed" "-pie" "" {init-mixed.c} "init-mixed" "init-mixed.out" "-I. -fPIE"} + {"PIE PR ld/14525" "-pie" "" {pr14525.c} "pr14525" "pr14525.out" "-fPIE"} } set array_tests_static { {"static preinit array" "-static" "" {preinit.c} "preinit" "preinit.out"} diff --git a/ld/testsuite/ld-elf/pr14525.c b/ld/testsuite/ld-elf/pr14525.c new file mode 100644 index 0000000..082eb87 --- /dev/null +++ b/ld/testsuite/ld-elf/pr14525.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +extern void *__executable_start; + +int +main() +{ + if ((void **) &main >= &__executable_start) + printf ("OK\n"); + return 0; +} diff --git a/ld/testsuite/ld-elf/pr14525.out b/ld/testsuite/ld-elf/pr14525.out new file mode 100644 index 0000000..d86bac9 --- /dev/null +++ b/ld/testsuite/ld-elf/pr14525.out @@ -0,0 +1 @@ +OK |