mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 19:09:31 +08:00
Patch from Thomas de Lellis to implement --section-start
This commit is contained in:
12
ld/ChangeLog
12
ld/ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2000-05-22 Thomas de Lellis <tdel@windriver.com>
|
||||||
|
|
||||||
|
* ld.1: Add documentation for new command line option:
|
||||||
|
--section-start <sectionname>=<sectionorg>
|
||||||
|
This is a generic version of -Ttext etc. which accepts
|
||||||
|
any section name as a parameter instead of just text/data/
|
||||||
|
bss.
|
||||||
|
* ld.texinfo: More docs.
|
||||||
|
* NEWS: More docs.
|
||||||
|
* lexsup.c: (parse_args): Recognize new command line option.
|
||||||
|
(ld_options): Add new option.
|
||||||
|
|
||||||
2000-05-18 H.J. Lu <hjl@gnu.org>
|
2000-05-18 H.J. Lu <hjl@gnu.org>
|
||||||
|
|
||||||
* lexsup.c (parse_args): `i' == `r', not `q'.
|
* lexsup.c (parse_args): `i' == `r', not `q'.
|
||||||
|
3
ld/NEWS
3
ld/NEWS
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
Changes in version 2.10:
|
Changes in version 2.10:
|
||||||
|
|
||||||
|
* Added command line switch --section-start to set the start address of any
|
||||||
|
specified section.
|
||||||
|
|
||||||
* Added ability to emit full relocation information in linked executables,
|
* Added ability to emit full relocation information in linked executables,
|
||||||
enabled by --emit-relocs. Some post-linkage optimization tools need
|
enabled by --emit-relocs. Some post-linkage optimization tools need
|
||||||
this information in order to be able to correctly identify and perform
|
this information in order to be able to correctly identify and perform
|
||||||
|
28
ld/ld.1
28
ld/ld.1
@ -39,7 +39,7 @@ ld \- the GNU linker
|
|||||||
.br
|
.br
|
||||||
.RB "[\|" "\-defsym\ "\c
|
.RB "[\|" "\-defsym\ "\c
|
||||||
.I symbol\c
|
.I symbol\c
|
||||||
\& = \c
|
\&=\c
|
||||||
.I expression\c
|
.I expression\c
|
||||||
\&\|]
|
\&\|]
|
||||||
.RB "[\|" \-\-demangle "\|]"
|
.RB "[\|" \-\-demangle "\|]"
|
||||||
@ -122,6 +122,11 @@ ld \- the GNU linker
|
|||||||
.RB "[\|" "\-T\ "\c
|
.RB "[\|" "\-T\ "\c
|
||||||
.I commandfile\c
|
.I commandfile\c
|
||||||
\&\|]
|
\&\|]
|
||||||
|
.RB "[\|" "\-\-section\-start\ "\c
|
||||||
|
.I sectionname\c
|
||||||
|
\&=\c
|
||||||
|
.I sectionorg\c
|
||||||
|
\&\|]
|
||||||
.RB "[\|" "\-Ttext\ "\c
|
.RB "[\|" "\-Ttext\ "\c
|
||||||
.I textorg\c
|
.I textorg\c
|
||||||
\&\|]
|
\&\|]
|
||||||
@ -253,8 +258,9 @@ The exceptions\(em\&which may meaningfully be used more than once\(em\&are
|
|||||||
.B \-format\c
|
.B \-format\c
|
||||||
\&), \c
|
\&), \c
|
||||||
.B \-defsym\c
|
.B \-defsym\c
|
||||||
\&,
|
\&, \c
|
||||||
\c
|
.B \-\-section\-start\c
|
||||||
|
\&, \c
|
||||||
.B \-L\c
|
.B \-L\c
|
||||||
\&, \c
|
\&, \c
|
||||||
.B \-l\c
|
.B \-l\c
|
||||||
@ -454,7 +460,7 @@ specified (\c
|
|||||||
\& has the same effect.
|
\& has the same effect.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI "-defsym " "symbol" "\fR = \fP" expression
|
.BI "-defsym " "symbol" "\fR=\fP" expression
|
||||||
Create a global symbol in the output file, containing the absolute
|
Create a global symbol in the output file, containing the absolute
|
||||||
address given by \c
|
address given by \c
|
||||||
.I expression\c
|
.I expression\c
|
||||||
@ -889,6 +895,20 @@ Similar to
|
|||||||
.B \-split\-by\-reloc
|
.B \-split\-by\-reloc
|
||||||
but creates a new output section for each input file.
|
but creates a new output section for each input file.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.BI "--section-start " "sectionname" "\fR=\fP"org
|
||||||
|
Locate a section in the output file at the absolute
|
||||||
|
address given by \c
|
||||||
|
.I org\c
|
||||||
|
\&. \c
|
||||||
|
\c
|
||||||
|
.I org\c
|
||||||
|
\& must be a hexadecimal integer.
|
||||||
|
You may use this option as many
|
||||||
|
times as necessary to locate multiple sections in the command
|
||||||
|
line. If you need more elaborate expressions, consider
|
||||||
|
using the linker command language from a script.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI "\-Tbss " "org"\c
|
.BI "\-Tbss " "org"\c
|
||||||
.TP
|
.TP
|
||||||
|
@ -1143,6 +1143,18 @@ full debugging information by over 30 percent. Unfortunately, the SunOS
|
|||||||
trouble). The @samp{--traditional-format} switch tells @code{ld} to not
|
trouble). The @samp{--traditional-format} switch tells @code{ld} to not
|
||||||
combine duplicate entries.
|
combine duplicate entries.
|
||||||
|
|
||||||
|
@kindex --section-start @var{sectionname}=@var{org}
|
||||||
|
@item --section-start @var{sectionname}=@var{org}
|
||||||
|
Locate a section in the output file at the absolute
|
||||||
|
address given by @var{org}. You may use this option as many
|
||||||
|
times as necessary to locate multiple sections in the command
|
||||||
|
line.
|
||||||
|
@var{org} must be a single hexadecimal integer;
|
||||||
|
for compatibility with other linkers, you may omit the leading
|
||||||
|
@samp{0x} usually associated with hexadecimal values. @emph{Note:} there
|
||||||
|
should be no white space between @var{sectionname}, the equals
|
||||||
|
sign (``@key{=}''), and @var{org}.
|
||||||
|
|
||||||
@kindex -Tbss @var{org}
|
@kindex -Tbss @var{org}
|
||||||
@kindex -Tdata @var{org}
|
@kindex -Tdata @var{org}
|
||||||
@kindex -Ttext @var{org}
|
@kindex -Ttext @var{org}
|
||||||
|
36
ld/lexsup.c
36
ld/lexsup.c
@ -123,6 +123,7 @@ int parsing_defsym = 0;
|
|||||||
#define OPTION_NO_UNDEFINED (OPTION_MPC860C0 + 1)
|
#define OPTION_NO_UNDEFINED (OPTION_MPC860C0 + 1)
|
||||||
#define OPTION_INIT (OPTION_NO_UNDEFINED + 1)
|
#define OPTION_INIT (OPTION_NO_UNDEFINED + 1)
|
||||||
#define OPTION_FINI (OPTION_INIT + 1)
|
#define OPTION_FINI (OPTION_INIT + 1)
|
||||||
|
#define OPTION_SECTION_START (OPTION_FINI + 1)
|
||||||
|
|
||||||
/* The long options. This structure is used for both the option
|
/* The long options. This structure is used for both the option
|
||||||
parsing and the help text. */
|
parsing and the help text. */
|
||||||
@ -336,6 +337,8 @@ static const struct ld_option ld_options[] =
|
|||||||
'\0', N_("SYMBOL"), N_("Do task level linking"), TWO_DASHES },
|
'\0', N_("SYMBOL"), N_("Do task level linking"), TWO_DASHES },
|
||||||
{ {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT},
|
{ {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT},
|
||||||
'\0', NULL, N_("Use same format as native linker"), TWO_DASHES },
|
'\0', NULL, N_("Use same format as native linker"), TWO_DASHES },
|
||||||
|
{ {"section-start", required_argument, NULL, OPTION_SECTION_START},
|
||||||
|
'\0', N_("SECTION=ADDRESS"), N_("Set address of named section"), TWO_DASHES },
|
||||||
{ {"Tbss", required_argument, NULL, OPTION_TBSS},
|
{ {"Tbss", required_argument, NULL, OPTION_TBSS},
|
||||||
'\0', N_("ADDRESS"), N_("Set address of .bss section"), ONE_DASH },
|
'\0', N_("ADDRESS"), N_("Set address of .bss section"), ONE_DASH },
|
||||||
{ {"Tdata", required_argument, NULL, OPTION_TDATA},
|
{ {"Tdata", required_argument, NULL, OPTION_TDATA},
|
||||||
@ -841,6 +844,39 @@ parse_args (argc, argv)
|
|||||||
parser_input = input_script;
|
parser_input = input_script;
|
||||||
yyparse ();
|
yyparse ();
|
||||||
break;
|
break;
|
||||||
|
case OPTION_SECTION_START:
|
||||||
|
{
|
||||||
|
char *optarg2;
|
||||||
|
|
||||||
|
/* Check for <something>=<somthing>... */
|
||||||
|
optarg2 = strchr (optarg, '=');
|
||||||
|
if (optarg2 == NULL)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("%s: Invalid argument to option \"--section-start\"\n"),
|
||||||
|
program_name);
|
||||||
|
xexit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
optarg2 ++;
|
||||||
|
|
||||||
|
/* So far so good. Are all the args present? */
|
||||||
|
if ((*optarg == '\0') || (*optarg2 == '\0'))
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("%s: Missing argument(s) to option \"--section-start\"\n"),
|
||||||
|
program_name);
|
||||||
|
xexit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
optarg2[-1] = '\0';
|
||||||
|
|
||||||
|
/* Then set it... */
|
||||||
|
set_section_start (optarg, optarg2);
|
||||||
|
|
||||||
|
optarg2[-1] = '=';
|
||||||
|
}
|
||||||
|
break;
|
||||||
case OPTION_TBSS:
|
case OPTION_TBSS:
|
||||||
set_section_start (".bss", optarg);
|
set_section_start (".bss", optarg);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user