* libelf.h (ELF_LINK_HASH_DEFINED_WEAK): Define.
* elfcode.h (elf_link_add_object_symbols): If symbol is defined as weak, set ELF_LINK_HASH_DEFINED_WEAK. (elf_link_output_extsym): If symbol is defined as weak, mark it STB_WEAK.
This commit is contained in:
parent
ea61717495
commit
bf73e4f3fe
@ -1,5 +1,11 @@
|
|||||||
Sat Jul 16 21:10:39 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
Sat Jul 16 21:10:39 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
||||||
|
|
||||||
|
* libelf.h (ELF_LINK_HASH_DEFINED_WEAK): Define.
|
||||||
|
* elfcode.h (elf_link_add_object_symbols): If symbol is defined as
|
||||||
|
weak, set ELF_LINK_HASH_DEFINED_WEAK.
|
||||||
|
(elf_link_output_extsym): If symbol is defined as weak, mark it
|
||||||
|
STB_WEAK.
|
||||||
|
|
||||||
* libelf.h (struct bfd_elf_section_data): Add relocs field.
|
* libelf.h (struct bfd_elf_section_data): Add relocs field.
|
||||||
(shdr_name): Remove; unused.
|
(shdr_name): Remove; unused.
|
||||||
* elfcode.h (elf_slurp_reloc_table): Rewrote to handle both REL
|
* elfcode.h (elf_slurp_reloc_table): Rewrote to handle both REL
|
||||||
|
@ -4286,7 +4286,19 @@ elf_link_add_object_symbols (abfd, info)
|
|||||||
with the new definition. */
|
with the new definition. */
|
||||||
h->root.type = bfd_link_hash_undefined;
|
h->root.type = bfd_link_hash_undefined;
|
||||||
h->root.u.undef.abfd = h->root.u.def.section->owner;
|
h->root.u.undef.abfd = h->root.u.def.section->owner;
|
||||||
|
h->elf_link_hash_flags &=~ ELF_LINK_HASH_DEFINED_WEAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If this is a weak definition which we are going to use,
|
||||||
|
and the symbol is currently undefined, record that the
|
||||||
|
definition is weak. */
|
||||||
|
if (definition
|
||||||
|
&& (flags & BSF_WEAK) != 0
|
||||||
|
&& ! bfd_is_und_section (sec)
|
||||||
|
&& (h->root.type == bfd_link_hash_new
|
||||||
|
|| h->root.type == bfd_link_hash_undefined
|
||||||
|
|| h->root.type == bfd_link_hash_weak))
|
||||||
|
h->elf_link_hash_flags |= ELF_LINK_HASH_DEFINED_WEAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! (_bfd_generic_link_add_one_symbol
|
if (! (_bfd_generic_link_add_one_symbol
|
||||||
@ -5613,8 +5625,12 @@ elf_link_output_extsym (h, data)
|
|||||||
|
|
||||||
sym.st_value = 0;
|
sym.st_value = 0;
|
||||||
sym.st_size = h->size;
|
sym.st_size = h->size;
|
||||||
sym.st_info = ELF_ST_INFO (STB_GLOBAL, h->type);
|
|
||||||
sym.st_other = 0;
|
sym.st_other = 0;
|
||||||
|
if (h->root.type == bfd_link_hash_weak
|
||||||
|
|| (h->elf_link_hash_flags & ELF_LINK_HASH_DEFINED_WEAK) != 0)
|
||||||
|
sym.st_info = ELF_ST_INFO (STB_WEAK, h->type);
|
||||||
|
else
|
||||||
|
sym.st_info = ELF_ST_INFO (STB_GLOBAL, h->type);
|
||||||
|
|
||||||
switch (h->root.type)
|
switch (h->root.type)
|
||||||
{
|
{
|
||||||
@ -5631,7 +5647,6 @@ elf_link_output_extsym (h, data)
|
|||||||
case bfd_link_hash_weak:
|
case bfd_link_hash_weak:
|
||||||
input_sec = bfd_und_section_ptr;
|
input_sec = bfd_und_section_ptr;
|
||||||
sym.st_shndx = SHN_UNDEF;
|
sym.st_shndx = SHN_UNDEF;
|
||||||
sym.st_info = ELF_ST_INFO (STB_WEAK, h->type);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case bfd_link_hash_defined:
|
case bfd_link_hash_defined:
|
||||||
|
@ -111,6 +111,8 @@ struct elf_link_hash_entry
|
|||||||
#define ELF_LINK_HASH_DEF_DYNAMIC_MULTIPLE 040
|
#define ELF_LINK_HASH_DEF_DYNAMIC_MULTIPLE 040
|
||||||
/* Dynamic symbol has been adjustd. */
|
/* Dynamic symbol has been adjustd. */
|
||||||
#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 0100
|
#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 0100
|
||||||
|
/* Symbol is defined as weak. */
|
||||||
|
#define ELF_LINK_HASH_DEFINED_WEAK 0200
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ELF linker hash table. */
|
/* ELF linker hash table. */
|
||||||
|
Loading…
Reference in New Issue
Block a user