This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 1/4] LD: Linker script hidden symbol support
- From: Alan Modra <amodra at gmail dot com>
- To: "Maciej W. Rozycki" <macro at codesourcery dot com>
- Cc: binutils at sourceware dot org, Richard Sandiford <rdsandiford at googlemail dot com>
- Date: Sat, 4 Aug 2012 17:35:53 +0930
- Subject: Re: [PATCH 1/4] LD: Linker script hidden symbol support
- References: <alpine.DEB.1.10.1208031755590.20608@tp.orcam.me.uk>
On Fri, Aug 03, 2012 at 07:00:05PM +0100, Maciej W. Rozycki wrote:
> http://sourceware.org/ml/binutils/2005-08/msg00045.html
>
> switched the scope of symbols created in linker scripts from object to
> global.
Not so. The above patch did not change the scope of symbols created
in linker scripts. What it did do is change some linker created
symbols to instead be created by PROVIDE in the linker script, and
shortly thereafter this was corrected to PROVIDE_HIDDEN. Linker
script symbols have been global forever.
> The original change also broke all MIPS SVR4 ABI binaries produced as
> with the switch from the object to the global scope the required _gp
> symbol was no longer defined such as the MIPS psABI mandated.
So the above change can't have been responsible for breaking MIPS..
Regardless of that, I like the patch. Please commit.
> 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.
> * ld/emultempl/beos.em (gld_${EMULATION_NAME}_set_symbols):
> Update call to exp_assign.
> * ld/emultempl/pe.em (gld_${EMULATION_NAME}_set_symbols):
> Likewise.
> * ld/emultempl/pep.em (gld_${EMULATION_NAME}_set_symbols):
> Likewise.
> * ld/emultempl/spuelf.em (spu_place_special_section): Likewise.
> * ld/emultempl/xtensaelf.em (ld_xtensa_insert_page_offsets):
> Likewise.
> * ld.texinfo (Assigning Values to Symbols): Add HIDDEN.
> (HIDDEN): New subsection.
--
Alan Modra
Australia Development Lab, IBM