diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-07-17 02:15:24 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-07-17 02:15:24 +0000 |
commit | bf73e4f3fe7e4a4da67fae7444084343209ee6e6 (patch) | |
tree | f660760ac29a303f847c9c3e7b87ef6b6f225e87 /bfd/elfcode.h | |
parent | ea61717495bad0a5fe182954bbb1c8a80890a98a (diff) | |
download | gdb-bf73e4f3fe7e4a4da67fae7444084343209ee6e6.zip gdb-bf73e4f3fe7e4a4da67fae7444084343209ee6e6.tar.gz gdb-bf73e4f3fe7e4a4da67fae7444084343209ee6e6.tar.bz2 |
* 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.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r-- | bfd/elfcode.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 223b751..31452c8 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -4286,7 +4286,19 @@ elf_link_add_object_symbols (abfd, info) with the new definition. */ h->root.type = bfd_link_hash_undefined; 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 @@ -5613,8 +5625,12 @@ elf_link_output_extsym (h, data) sym.st_value = 0; sym.st_size = h->size; - sym.st_info = ELF_ST_INFO (STB_GLOBAL, h->type); 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) { @@ -5631,7 +5647,6 @@ elf_link_output_extsym (h, data) case bfd_link_hash_weak: input_sec = bfd_und_section_ptr; sym.st_shndx = SHN_UNDEF; - sym.st_info = ELF_ST_INFO (STB_WEAK, h->type); break; case bfd_link_hash_defined: |