mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 06:17:47 +08:00
2005-02-10 Paul Brook <paul@codesourcery.com>
* elflink.c (bfd_elf_record_link_assignment): Make hidden and internal symbols local. (elf_link_renumber_hash_table_dynsyms): Ignore local symbols. (elf_link_renumber_local_hash_table_dynsyms): New function. (_bfd_elf_link_renumber_dynsyms): Number local dynamic symbols. ld/testsuite/ * ld-elfvsb/hidden2.s: New file * ld-elfvsb/hidden2.d: New file * ld-elfvsb/hidden2.ld: New file
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2005-02-10 Paul Brook <paul@codesourcery.com>
|
||||||
|
|
||||||
|
* elflink.c (bfd_elf_record_link_assignment): Make hidden and internal
|
||||||
|
symbols local.
|
||||||
|
(elf_link_renumber_hash_table_dynsyms): Ignore local symbols.
|
||||||
|
(elf_link_renumber_local_hash_table_dynsyms): New function.
|
||||||
|
(_bfd_elf_link_renumber_dynsyms): Number local dynamic symbols.
|
||||||
|
|
||||||
2005-02-10 Jakub Jelinek <jakub@redhat.com>
|
2005-02-10 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* bfd-in.h (BFD_LINKER_CREATED): Define.
|
* bfd-in.h (BFD_LINKER_CREATED): Define.
|
||||||
|
@ -484,6 +484,14 @@ bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
h->def_regular = 1;
|
h->def_regular = 1;
|
||||||
|
|
||||||
|
/* STV_HIDDEN and STV_INTERNAL symbols must be STB_LOCAL in shared objects
|
||||||
|
and executables. */
|
||||||
|
if (!info->relocatable
|
||||||
|
&& h->dynindx != -1
|
||||||
|
&& (ELF_ST_VISIBILITY (h->other) == STV_HIDDEN
|
||||||
|
|| ELF_ST_VISIBILITY (h->other) == STV_INTERNAL))
|
||||||
|
h->forced_local = 1;
|
||||||
|
|
||||||
if ((h->def_dynamic
|
if ((h->def_dynamic
|
||||||
|| h->ref_dynamic
|
|| h->ref_dynamic
|
||||||
|| info->shared)
|
|| info->shared)
|
||||||
@ -624,6 +632,31 @@ elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h,
|
|||||||
if (h->root.type == bfd_link_hash_warning)
|
if (h->root.type == bfd_link_hash_warning)
|
||||||
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||||
|
|
||||||
|
if (h->forced_local)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
if (h->dynindx != -1)
|
||||||
|
h->dynindx = ++(*count);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Like elf_link_renumber_hash_table_dynsyms, but just number symbols with
|
||||||
|
STB_LOCAL binding. */
|
||||||
|
|
||||||
|
static bfd_boolean
|
||||||
|
elf_link_renumber_local_hash_table_dynsyms (struct elf_link_hash_entry *h,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
size_t *count = data;
|
||||||
|
|
||||||
|
if (h->root.type == bfd_link_hash_warning)
|
||||||
|
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||||
|
|
||||||
|
if (!h->forced_local)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
if (h->dynindx != -1)
|
if (h->dynindx != -1)
|
||||||
h->dynindx = ++(*count);
|
h->dynindx = ++(*count);
|
||||||
|
|
||||||
@ -667,9 +700,10 @@ _bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Assign dynsym indices. In a shared library we generate a section
|
/* Assign dynsym indices. In a shared library we generate a section
|
||||||
symbol for each output section, which come first. Next come all of
|
symbol for each output section, which come first. Next come symbols
|
||||||
the back-end allocated local dynamic syms, followed by the rest of
|
which have been forced to local binding. Then all of the back-end
|
||||||
the global symbols. */
|
allocated local dynamic syms, followed by the rest of the global
|
||||||
|
symbols. */
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
_bfd_elf_link_renumber_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
|
_bfd_elf_link_renumber_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
|
||||||
@ -687,6 +721,10 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
|
|||||||
elf_section_data (p)->dynindx = ++dynsymcount;
|
elf_section_data (p)->dynindx = ++dynsymcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elf_link_hash_traverse (elf_hash_table (info),
|
||||||
|
elf_link_renumber_local_hash_table_dynsyms,
|
||||||
|
&dynsymcount);
|
||||||
|
|
||||||
if (elf_hash_table (info)->dynlocal)
|
if (elf_hash_table (info)->dynlocal)
|
||||||
{
|
{
|
||||||
struct elf_link_local_dynamic_entry *p;
|
struct elf_link_local_dynamic_entry *p;
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2005-02-10 Paul Brook <paul@codesourcery.com>
|
||||||
|
|
||||||
|
* ld-elfvsb/hidden2.s: New file
|
||||||
|
* ld-elfvsb/hidden2.d: New file
|
||||||
|
* ld-elfvsb/hidden2.ld: New file
|
||||||
|
|
||||||
2005-02-07 Alexandre Oliva <aoliva@redhat.com>
|
2005-02-07 Alexandre Oliva <aoliva@redhat.com>
|
||||||
|
|
||||||
* ld-frv/fdpic-shared-8-fail.d: Tweak error messages.
|
* ld-frv/fdpic-shared-8-fail.d: Tweak error messages.
|
||||||
|
9
ld/testsuite/ld-elfvsb/hidden2.d
Normal file
9
ld/testsuite/ld-elfvsb/hidden2.d
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#source: hidden2.s
|
||||||
|
#ld: -shared -T hidden2.ld
|
||||||
|
#readelf: -Ds
|
||||||
|
# It is also ok to remove this symbol, but we currently make it local.
|
||||||
|
|
||||||
|
Symbol table for image:
|
||||||
|
#...
|
||||||
|
[ ]*[0-9]+ +[0-9]+: [0-9a-fA-F]* +0 NOTYPE LOCAL HIDDEN +ABS foo
|
||||||
|
#pass
|
6
ld/testsuite/ld-elfvsb/hidden2.ld
Normal file
6
ld/testsuite/ld-elfvsb/hidden2.ld
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
. = 0x1000;
|
||||||
|
PROVIDE (foo = .);
|
||||||
|
.data : { *(.data) }
|
||||||
|
}
|
4
ld/testsuite/ld-elfvsb/hidden2.s
Normal file
4
ld/testsuite/ld-elfvsb/hidden2.s
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.data
|
||||||
|
.hidden foo
|
||||||
|
.global foo
|
||||||
|
.word foo
|
Reference in New Issue
Block a user