This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] LD: PROVIDE_HIDDEN export class problem
- From: Alan Modra <amodra at gmail dot com>
- To: "Maciej W. Rozycki" <macro at codesourcery dot com>
- Cc: Dave Anglin <dave dot anglin at nrc dot ca>, Jeff Law <law at redhat dot com>, binutils at sourceware dot org
- Date: Tue, 30 Apr 2013 10:51:24 +0930
- Subject: Re: [PATCH] LD: PROVIDE_HIDDEN export class problem
- References: <alpine dot DEB dot 1 dot 10 dot 1304292220350 dot 1453 at tp dot orcam dot me dot uk>
On Mon, Apr 29, 2013 at 11:30:12PM +0100, Maciej W. Rozycki wrote:
> While testing the __ehdr_start fix (PR ld/15365) I have realised we have
> a problem with the PROVIDE_HIDDEN linker script command or
> bfd_elf_record_link_assignment that implements this command's export class
> handling. The issue is the symbol named is always assigned the hidden
> export class even if it was actually created by other means and the
> PROVIDE part of the command wasn't used.
Is that really a problem? The ELF gABI says that in both references
and definitions, a visibility attribute must be propagated. I reckon
a PROVIDEd symbol counts as a definition, so I think it quite
reasonable that the symbol becomes hidden. The bug in
bfd_elf_record_link_assignment that I was referring to in
http://sourceware.org/ml/binutils/2013-04/msg00262.html is just that
the attributes are not merged properly. Fixed as follows and
committed.
* elflink.c (bfd_elf_record_link_assignment): Dont make
STV_INTERNAL symbols STV_HIDDEN.
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.489
diff -u -p -r1.489 elflink.c
--- bfd/elflink.c 24 Apr 2013 13:24:30 -0000 1.489
+++ bfd/elflink.c 25 Apr 2013 23:53:58 -0000
@@ -573,7 +573,8 @@ bfd_elf_record_link_assignment (bfd *out
if (hidden)
{
bed = get_elf_backend_data (output_bfd);
- h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
+ if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
+ h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
(*bed->elf_backend_hide_symbol) (info, h, TRUE);
}
--
Alan Modra
Australia Development Lab, IBM