From b2529df1becf15546fd9ac60192c93042ed36e7b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 3 Jul 1998 18:25:46 +0000 Subject: [PATCH] * ldgram.y (extern_name_list): Do not require symbols to be separated by commas. (ifile_p1): Add EXTERN. * ldlex.l: Accept EXTERN in BOTH and SCRIPT mode as well as MRI mode. * ld.texinfo (Options): Mention that EXTERN is equivalent to -u. (Miscellaneous Commands): Document EXTERN. --- ld/ChangeLog | 10 ++++++++++ ld/NEWS | 11 +++++++---- ld/ld.texinfo | 20 ++++++++++++++------ ld/ldgram.y | 3 +++ ld/ldlex.l | 2 +- 5 files changed, 35 insertions(+), 11 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index dea26e1c313..07e9695c2a7 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +Fri Jul 3 14:19:06 1998 Ian Lance Taylor + + * ldgram.y (extern_name_list): Do not require symbols to be + separated by commas. + (ifile_p1): Add EXTERN. + * ldlex.l: Accept EXTERN in BOTH and SCRIPT mode as well as MRI + mode. + * ld.texinfo (Options): Mention that EXTERN is equivalent to -u. + (Miscellaneous Commands): Document EXTERN. + Wed Jul 1 19:40:34 1998 Richard Henderson * ld.h (args_type): Add gc_sections. diff --git a/ld/NEWS b/ld/NEWS index 6e4b8f19bd3..b696804f9bc 100644 --- a/ld/NEWS +++ b/ld/NEWS @@ -2,14 +2,17 @@ Changes in version 2.10: +* Added garbage collection of unused sections, enabled by --gc-sections. + It does require a bit of backend support; currently implemented are + ppc-elf, mips-elf, and mn10300-elf. Others will ignore the option. + * Added SORT to the linker script language to permit sorting sections by file name or section name. -* The -e option now accepts a number as well as a symbol name. +* Added EXTERN to the linker script language as an equivalent to the -u + command-line option. -* Added garbage collection of unused sections, enabled by --gc-sections. - It does require a bit of backend support; currently implemented are - ppc-elf, mips-elf, and mn10300-elf. Others will ignore the option. +* The -e option now accepts a number as well as a symbol name. Changes in version 2.9: diff --git a/ld/ld.texinfo b/ld/ld.texinfo index b23d7c93b7c..e4731c7abbd 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -626,12 +626,11 @@ options. Multiple @samp{-T} options accumulate. @cindex undefined symbol @item -u @var{symbol} @itemx --undefined=@var{symbol} -Force @var{symbol} to be entered in the output file as an undefined symbol. -Doing this may, for example, trigger linking of additional modules from -standard libraries. @samp{-u} may be repeated with different option -arguments to enter additional undefined symbols. -@c Nice idea, but no such command: This option is equivalent -@c to the @code{EXTERN} linker command. +Force @var{symbol} to be entered in the output file as an undefined +symbol. Doing this may, for example, trigger linking of additional +modules from standard libraries. @samp{-u} may be repeated with +different option arguments to enter additional undefined symbols. This +option is equivalent to the @code{EXTERN} linker script command. @kindex -v @kindex -V @@ -1663,6 +1662,15 @@ command is also used to set the format for the output file. @xref{BFD}. There are a few other linker scripts commands. @table @code +@item EXTERN(@var{symbol} @var{symbol} @dots{}) +@kindex EXTERN +@cindex undefined symbol in linker script +Force @var{symbol} to be entered in the output file as an undefined +symbol. Doing this may, for example, trigger linking of additional +modules from standard libraries. You may list several @var{symbol}s for +each @code{EXTERN}, and you may use @code{EXTERN} multiple times. This +command has the same effect as the @samp{-u} command-line option. + @item FORCE_COMMON_ALLOCATION @kindex FORCE_COMMON_ALLOCATION @cindex common allocation in linker script diff --git a/ld/ldgram.y b/ld/ldgram.y index da8d2145a15..68ff0a244e1 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -264,6 +264,8 @@ casesymlist: extern_name_list: NAME { ldlang_add_undef ($1); } + | extern_name_list NAME + { ldlang_add_undef ($2); } | extern_name_list ',' NAME { ldlang_add_undef ($3); } ; @@ -325,6 +327,7 @@ ifile_p1: { lang_add_nocrossref ($3); } + | EXTERN '(' extern_name_list ')' ; input_list: diff --git a/ld/ldlex.l b/ld/ldlex.l index 12c9f0e7b29..09c89ad1435 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -242,6 +242,7 @@ V_IDENTIFIER [*?.$_a-zA-Z][*?_a-zA-Z0-9]* "MAX" { RTOKEN(MAX); } "MIN" { RTOKEN(MIN); } "ENTRY" { RTOKEN(ENTRY);} +"EXTERN" { RTOKEN(EXTERN);} "NEXT" { RTOKEN(NEXT);} "sizeof_headers" { RTOKEN(SIZEOF_HEADERS);} "SIZEOF_HEADERS" { RTOKEN(SIZEOF_HEADERS);} @@ -304,7 +305,6 @@ V_IDENTIFIER [*?.$_a-zA-Z][*?_a-zA-Z0-9]* "NAME" { RTOKEN(NAMEWORD); } "FORMAT" { RTOKEN(FORMAT); } "CASE" { RTOKEN(CASE); } -"EXTERN" { RTOKEN(EXTERN); } "START" { RTOKEN(START); } "LIST".* { RTOKEN(LIST); /* LIST and ignore to end of line */ } "SECT" { RTOKEN(SECT); } -- 2.30.2