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.
This commit is contained in:
H.J. Lu 2012-08-31 02:52:14 +00:00
parent b69fdb4ec9
commit 11cba4accf
6 changed files with 45 additions and 19 deletions

View File

@ -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.

View File

@ -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()

View File

@ -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.

View File

@ -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"}

View File

@ -0,0 +1,11 @@
#include <stdio.h>
extern void *__executable_start;
int
main()
{
if ((void **) &main >= &__executable_start)
printf ("OK\n");
return 0;
}

View File

@ -0,0 +1 @@
OK