PATCH: Provide __executable_start

H. J. Lu hjl@lucon.org
Thu Oct 9 21:11:00 GMT 2003


Sometimes, we want to know the start address of an executable. It can
be used to get the ELF header.


H.J.
-----
2003-10-09  H.J. Lu  <hongjiu.lu@intel.com>

	* scripttempl/elf.sc (__executable_start): Provide.

--- ld/scripttempl/elf.sc.phdr	2003-07-10 07:27:30.000000000 -0700
+++ ld/scripttempl/elf.sc	2003-10-09 13:49:21.000000000 -0700
@@ -182,7 +182,7 @@ ${RELOCATING- /* For some reason, the So
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
-  ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${TEXT_BASE_ADDRESS};}}}
+  ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
   ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
   ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
   ${CREATE_SHLIB-${INTERP}}



More information about the Binutils mailing list