From eb8476a6e2fc115c0a953392e61ab27c7568a2a8 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Mon, 6 Aug 2012 22:27:52 +0000 Subject: bfd/ * elflink.c (bfd_elf_record_link_assignment): Remove --defsym symbols special case. ld/ * ldexp.h (etree_union): Add defsym member to the assign member structure. (exp_assign): Add hidden argument to prototype. * ldexp.c (exp_fold_tree_1): Use the defsym member to handle --defsym symbols. (exp_assop): Add defsym argument, initialize the defsym member of the assign structure. (exp_assign): Handle hidden symbols. (exp_defsym): Update to use the defsym argument to exp_assop. (exp_provide): Update to handle the defsym argument to exp_assop. * ldlex.l (HIDDEN): New token. * ldgram.y (HIDDEN): Likewise. (assignment, section): Update calls to exp_assign. * ldctor.c (ldctor_build_sets): Likewise. * mri.c (mri_format): Likewise. * ldlang.c (lang_insert_orphan, lang_leave_overlay): Likewise. (open_input_bfds): Remove --defsym symbols special case. * emultempl/beos.em (gld_${EMULATION_NAME}_set_symbols): Update call to exp_assign. * emultempl/pe.em (gld_${EMULATION_NAME}_set_symbols): Likewise. * emultempl/pep.em (gld_${EMULATION_NAME}_set_symbols): Likewise. * emultempl/spuelf.em (spu_place_special_section): Likewise. * emultempl/xtensaelf.em (ld_xtensa_insert_page_offsets): Likewise. * ld.texinfo (Assigning Values to Symbols): Add HIDDEN. (HIDDEN): New subsection. --- ld/ld.texinfo | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'ld/ld.texinfo') diff --git a/ld/ld.texinfo b/ld/ld.texinfo index d0a5d90..dd3149c 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -3410,6 +3410,7 @@ the symbol and place it into the symbol table with a global scope. @menu * Simple Assignments:: Simple Assignments +* HIDDEN:: HIDDEN * PROVIDE:: PROVIDE * PROVIDE_HIDDEN:: PROVIDE_HIDDEN * Source Code Reference:: How to use a linker script defined symbol in source code @@ -3473,6 +3474,31 @@ the last @samp{.text} input section. The symbol @samp{_bdata} will be defined as the address following the @samp{.text} output section aligned upward to a 4 byte boundary. +@node HIDDEN +@subsection HIDDEN +@cindex HIDDEN +For ELF targeted ports, define a symbol that will be hidden and won't be +exported. The syntax is @code{HIDDEN(@var{symbol} = @var{expression})}. + +Here is the example from @ref{Simple Assignments}, rewritten to use +@code{HIDDEN}: + +@smallexample +HIDDEN(floating_point = 0); +SECTIONS +@{ + .text : + @{ + *(.text) + HIDDEN(_etext = .); + @} + HIDDEN(_bdata = (. + 3) & ~ 3); + .data : @{ *(.data) @} +@} +@end smallexample +@noindent +In this case none of the three symbols will be visible outside this module. + @node PROVIDE @subsection PROVIDE @cindex PROVIDE -- cgit v1.1