* PATCH: PR ld/14525: __executable_start isn't defined for PIE
@ 2012-08-28 18:34 H.J. Lu
2012-08-31 2:43 ` Alan Modra
0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2012-08-28 18:34 UTC (permalink / raw)
To: binutils
Hi,
This patch provides __executable_start for PIE, similar to gold. OK
to install?
Thanks.
H.J.
--
diff --git a/ld/ChangeLog.pr14525 b/ld/ChangeLog.pr14525
new file mode 100644
index 0000000..e175be7
--- /dev/null
+++ b/ld/ChangeLog.pr14525
@@ -0,0 +1,4 @@
+2012-08-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/14525
+ * scripttempl/elf.sc: Also provide __executable_start for PIE.
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.pr14525 b/ld/testsuite/ChangeLog.pr14525
new file mode 100644
index 0000000..b3bad30
--- /dev/null
+++ b/ld/testsuite/ChangeLog.pr14525
@@ -0,0 +1,7 @@
+2012-08-28 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.
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: PR ld/14525: __executable_start isn't defined for PIE
2012-08-28 18:34 PATCH: PR ld/14525: __executable_start isn't defined for PIE H.J. Lu
@ 2012-08-31 2:43 ` Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2012-08-31 2:43 UTC (permalink / raw)
To: H.J. Lu; +Cc: binutils
On Tue, Aug 28, 2012 at 07:57:23AM -0700, H.J. Lu wrote:
> This patch provides __executable_start for PIE, similar to gold. OK
> to install?
OK.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-31 2:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-28 18:34 PATCH: PR ld/14525: __executable_start isn't defined for PIE H.J. Lu
2012-08-31 2:43 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).