This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
elf_backend_hide_symbol
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Tue, 19 Feb 2002 10:53:39 +1030
- Subject: elf_backend_hide_symbol
There's a minor problem with the way elf_backend_hide_symbol
interacts with elf_link_output_extsyms: If linking an application
(as distinct from a shared library), any symbol forced local due
to symbol visibility will not appear in the output file as a local
symbol. Instead, it disappears.
The obvious thing to do is hack things so that elf_link_output_extsyms
is called for these symbols. However, that means the backend
adjust_dynamic_symbol routine will be called on a new set of symbols,
with possibly bad results.
* elflink.h (elf_bfd_final_link): Call elf_link_output_extsym
to output forced local syms for non-shared link.
(elf_link_output_extsym): Tweak condition for calling backend
adjust_dynamic_symbol so that previous behaviour is kept.
Really, what I'd like to do is leave out the second hunk and fix any
breakage. There are backends that could benefit from calling the
backend adjust_dynamic_symbol function on all dynamic syms, eg.
hppa-linux.
Comments?
--
Alan Modra
IBM OzLabs - Linux Technology Centre
Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.141
diff -u -p -r1.141 elflink.h
--- elflink.h 2002/01/21 10:29:07 1.141
+++ elflink.h 2002/02/18 13:33:19
@@ -5304,7 +5304,7 @@ elf_bfd_final_link (abfd, info)
can, we still need to deal with those global symbols that got
converted to local in a version script. */
- if (info->shared)
+ if (1 || info->shared)
{
/* Output any global symbols that got converted to local in a
version script. We do this in a separate step since ELF
@@ -6033,6 +6033,8 @@ elf_link_output_extsym (h, data)
symbol. */
if ((h->dynindx != -1
|| (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+ && (finfo->info->shared
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
&& elf_hash_table (finfo->info)->dynamic_sections_created)
{
struct elf_backend_data *bed;