aboutsummaryrefslogtreecommitdiff
path: root/ld/ld.texinfo
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-01-25 12:03:37 +0000
committerAlan Modra <amodra@gmail.com>2008-01-25 12:03:37 +0000
commit53d25da64b00c1cf7f10d04785d66fa003f8bfc9 (patch)
treeb1bad03e3da788202674fed0b1233f865cbad54d /ld/ld.texinfo
parent5ca3b13d654923e893cb2661700bc06e7af32a49 (diff)
downloadgdb-53d25da64b00c1cf7f10d04785d66fa003f8bfc9.zip
gdb-53d25da64b00c1cf7f10d04785d66fa003f8bfc9.tar.gz
gdb-53d25da64b00c1cf7f10d04785d66fa003f8bfc9.tar.bz2
ld/
* ld.texinfo (INSERT): Describe. * ldgram.y (ldgram_in_script, ldgram_had_equals): Delete. (INSERT_K, AFTER, BEFORE): Add as tokens. (ifile_p1): Handle INSERT statements. (saved_script_handle, force_make_executable): Move to.. * ldmain.c: ..here. (previous_script_handle): New global var. * ldmain.h (saved_script_handle, force_make_executable): Declare. (previous_script_handle): Likewise. * ldlex.l (INSERT_K, AFTER, BEFORE): Add tokens. * lexsup.c (parge_args <-T>): Set previous_script_handle. * ldlang.c (lang_for_each_statement_worker): Handle insert statement. (map_input_to_output_sections, print_statement): Likewise. (lang_size_sections_1, lang_do_assignments_1): Likewise. (insert_os_after): New function, extracted from.. (lang_insert_orphan): ..here. (process_insert_statements): New function. (lang_process): Call it. (lang_add_insert): New function. * ldlang.h (lang_insert_statement_enum): New. (lang_insert_statement_type): New. (lang_statement_union_type): Add insert_statement. (lang_add_insert): Declare. ld/testsuite/ * ld-spu/ovl.lnk: Delete overlay. * ld-spu/ovl1.lnk: New file. * ld-spu/ovl2.lnk: New file. * ld-spu/ovl.d: Update. * ld-spu/ovl2.d: Update.
Diffstat (limited to 'ld/ld.texinfo')
-rw-r--r--ld/ld.texinfo38
1 files changed, 34 insertions, 4 deletions
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 7d77d1c..00081da 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -297,10 +297,11 @@ augments the main linker script used for the link (either the default
linker script or the one specified by using @samp{-T}). This feature
permits the linker to link against a file which appears to be an object
or an archive, but actually merely defines some symbol values, or uses
-@code{INPUT} or @code{GROUP} to load other objects. Note that
-specifying a script in this way merely augments the main linker script;
-use the @samp{-T} option to replace the default linker script entirely.
-@xref{Scripts}.
+@code{INPUT} or @code{GROUP} to load other objects. Specifying a
+script in this way merely augments the main linker script, with the
+extra commands placed after the main script; use the @samp{-T} option
+to replace the default linker script entirely, but note the effect of
+the @code{INSERT} command. @xref{Scripts}.
For options whose names are a single letter,
option arguments must either follow the option letter without intervening
@@ -2903,6 +2904,35 @@ This command has the same effect as the @samp{--no-define-common}
command-line option: to make @code{ld} omit the assignment of addresses
to common symbols even for a non-relocatable output file.
+@item INSERT [ AFTER | BEFORE ] @var{output_section}
+@kindex INSERT
+@cindex insert user script into default script
+This command is typically used in a script specified by @samp{-T} to
+augment the default @code{SECTIONS} with, for example, overlays. It
+inserts all prior linker script statements after (or before)
+@var{output_section}, and also causes @samp{-T} to not override the
+default linker script. The exact insertion point is as for orphan
+sections. @xref{Location Counter}. The insertion happens after the
+linker has mapped input sections to output sections. Prior to the
+insertion, since @samp{-T} scripts are parsed before the default
+linker script, statements in the @samp{-T} script occur before the
+default linker script statements in the internal linker representation
+of the script. In particular, input section assignments will be made
+to @samp{-T} output sections before those in the default script. Here
+is an example of how a @samp{-T} script using @code{INSERT} might look:
+
+@smallexample
+SECTIONS
+@{
+ OVERLAY :
+ @{
+ .ov1 @{ ov1*(.text) @}
+ .ov2 @{ ov2*(.text) @}
+ @}
+@}
+INSERT AFTER .text;
+@end smallexample
+
@item NOCROSSREFS(@var{section} @var{section} @dots{})
@kindex NOCROSSREFS(@var{sections})
@cindex cross references