+2009-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ * lexsup.c (option_values): Add OPTION_TTEXT_SEGMENT.
+ (ld_options): Add -Ttext-segment.
+ (parse_args): Handle OPTION_TTEXT_SEGMENT.
+
+ * ld.texinfo: Document -Ttext-segment.
+
+ * NEWS: Mention -Ttext-segment.
+
+ * scripttempl/elf.sc (TEXT_START_ADDR): Use SEGMENT_START.
+ (SHLIB_TEXT_START_ADDR): Likewise.
+
2009-01-13 Alan Modra <amodra@bigpond.net.au>
* emultempl/spu_icache.o_c: Regenerate.
-*- text -*-
+* Add a new command line option, -Ttext-segment ADDR, for ELF targets
+ to set the address of the first byte of the text segment.
+
* Add new option --use-nul-prefixed-import-tables to ld for PE targets to
allow fallback to old import table generation with null element prefix.
Same as --section-start, with @code{.bss}, @code{.data} or
@code{.text} as the @var{sectionname}.
+@kindex -Ttext-segment @var{org}
+@itemx -Ttext-segment @var{org}
+@cindex text segment origin, cmd line
+When creating an ELF executable or shared object, it will set the address
+of the first byte of the text segment.
+
@kindex --unresolved-symbols
@item --unresolved-symbols=@var{method}
Determine how to handle unresolved symbols. There are four possible
OPTION_TBSS,
OPTION_TDATA,
OPTION_TTEXT,
+ OPTION_TTEXT_SEGMENT,
OPTION_TRADITIONAL_FORMAT,
OPTION_UR,
OPTION_VERBOSE,
'\0', N_("ADDRESS"), N_("Set address of .data section"), ONE_DASH },
{ {"Ttext", required_argument, NULL, OPTION_TTEXT},
'\0', N_("ADDRESS"), N_("Set address of .text section"), ONE_DASH },
+ { {"Ttext-segment", required_argument, NULL, OPTION_TTEXT_SEGMENT},
+ '\0', N_("ADDRESS"), N_("Set address of text segment"), ONE_DASH },
{ {"unresolved-symbols=<method>", required_argument, NULL,
OPTION_UNRESOLVED_SYMBOLS},
'\0', NULL, N_("How to handle unresolved symbols. <method> is:\n"
case OPTION_TTEXT:
set_segment_start (".text", optarg);
break;
+ case OPTION_TTEXT_SEGMENT:
+ set_segment_start (".text-segment", optarg);
+ break;
case OPTION_TRADITIONAL_FORMAT:
link_info.traditional_format = TRUE;
break;
*(.stack)
}"
+TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${TEXT_START_ADDR})"
+SHLIB_TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${SHLIB_TEXT_START_ADDR:-0})"
+
# if this is for an embedded system, don't add SIZEOF_HEADERS.
if [ -z "$EMBEDDED" ]; then
test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
{
/* 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:-0} + SIZEOF_HEADERS;}}
- ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
+ ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR} + SIZEOF_HEADERS;}}
+ ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR} + SIZEOF_HEADERS;}}
${INITIAL_READONLY_SECTIONS}
.note.gnu.build-id : { *(.note.gnu.build-id) }
EOF
+2009-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-elf/textaddr1.d: New.
+ * ld-elf/textaddr2.d: Likewise.
+
2009-01-14 H.J. Lu <hongjiu.lu@intel.com>
PR ld/9727
--- /dev/null
+#source: maxpage1.s
+#ld: -Ttext-segment 0x7000000 -z max-page-size=0x200000
+#readelf: -l --wide
+#target: *-*-linux-gnu
+
+#...
+ LOAD +0x0+ 0x0*7000000 0x0*7000000 0x0*[0-9a-f][0-9a-f][0-9a-f] 0x0*[0-9a-f][0-9a-f][0-9a-f] R E 0x200000
+#pass
--- /dev/null
+#source: maxpage1.s
+#ld: -shared -Ttext-segment 0x7000000 -z max-page-size=0x200000
+#readelf: -l --wide
+#target: *-*-linux-gnu
+
+#...
+ LOAD +0x0+ 0x0*7000000 0x0*7000000 0x0*[0-9a-f][0-9a-f][0-9a-f] 0x0*[0-9a-f][0-9a-f][0-9a-f] R E 0x200000
+#pass