GNU Binutils with patches for OS216
Revisão | 8f33925de3039f880e949280b6f26bf2855d44e3 (tree) |
---|---|
Hora | 2000-10-17 02:57:08 |
Autor | Phil Blundell <philb@gnu....> |
Commiter | Phil Blundell |
Merge from mainline
@@ -1,3 +1,34 @@ | ||
1 | +2000-10-15 Philip Blundell <philb@gnu.org> | |
2 | + | |
3 | + From 2000-09-08 Nick Clifton <nickc@redhat.com> | |
4 | + * elf32-arm.h (elf32_arm_merge_private_bfd_data): Do not | |
5 | + initialise flags in output bfd if the input bfd is the default | |
6 | + architecture with the default flags. | |
7 | + | |
8 | + From 2000-09-03 Philip Blundell <philb@gnu.org> | |
9 | + * elf32-arm.h (elf32_arm_relocate_section): Don't try to relocate | |
10 | + references to undefined symbols in debugging sections. | |
11 | + | |
12 | + From 2000-05-30 H.J. Lu <hjl@gnu.org> | |
13 | + * elflink.c (_bfd_elf_link_record_dynamic_symbol): Clear the | |
14 | + visibility bits if the symbol is undefined. Correctly handle | |
15 | + weak undefined symbols with hidden and internal attributes. | |
16 | + * elflink.h (elf_link_add_object_symbols): Always turn the | |
17 | + symbol into local if it has the hidden or internal attribute. | |
18 | + | |
19 | + From 2000-05-22 H.J. Lu <hjl@gnu.org> | |
20 | + * elflink.h (elf_link_output_extsym): Clear the visibility | |
21 | + field for symbols not defined locally. | |
22 | + | |
23 | + From 2000-05-03 Martin v. Löwis <loewis@informatik.hu-berlin.de> | |
24 | + * elflink.h (elf_link_add_object_symbols): Reset dynindx for | |
25 | + hidden and internal symbols. | |
26 | + (elf_fix_symbol_flags): Clear NEEDS_PLT for symbols with | |
27 | + visibility. | |
28 | + * elflink.c (_bfd_elf_link_record_dynamic_symbol): Do not | |
29 | + assign a PLT or GOT entry to symbols with hidden and | |
30 | + internal visibility. | |
31 | + | |
1 | 32 | 2000-10-16 Philip Blundell <pb@futuretv.com> |
2 | 33 | |
3 | 34 | * configure.in: Set version to 2.10.1. |
@@ -1756,7 +1756,14 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, | ||
1756 | 1756 | (!info->symbolic && h->dynindx != -1) |
1757 | 1757 | || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 |
1758 | 1758 | ) |
1759 | - && ((input_section->flags & SEC_ALLOC) != 0) | |
1759 | + && ((input_section->flags & SEC_ALLOC) != 0 | |
1760 | + /* DWARF will emit R_ARM_ABS32 relocations in its | |
1761 | + sections against symbols defined externally | |
1762 | + in shared libraries. We can't do anything | |
1763 | + with them here. */ | |
1764 | + || ((input_section->flags & SEC_DEBUGGING) != 0 | |
1765 | + && (h->elf_link_hash_flags | |
1766 | + & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) | |
1760 | 1767 | ) |
1761 | 1768 | relocation_needed = 0; |
1762 | 1769 | break; |
@@ -1994,13 +2001,14 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd) | ||
1994 | 2001 | |
1995 | 2002 | if (!elf_flags_init (obfd)) |
1996 | 2003 | { |
1997 | - /* If the input is the default architecture then do not | |
1998 | - bother setting the flags for the output architecture, | |
1999 | - instead allow future merges to do this. If no future | |
2000 | - merges ever set these flags then they will retain their | |
2001 | - unitialised values, which surprise surprise, correspond | |
2004 | + /* If the input is the default architecture and had the default | |
2005 | + flags then do not bother setting the flags for the output | |
2006 | + architecture, instead allow future merges to do this. If no | |
2007 | + future merges ever set these flags then they will retain their | |
2008 | + uninitialised values, which surprise surprise, correspond | |
2002 | 2009 | to the default values. */ |
2003 | - if (bfd_get_arch_info (ibfd)->the_default) | |
2010 | + if (bfd_get_arch_info (ibfd)->the_default | |
2011 | + && elf_elfheader (ibfd)->e_flags == 0) | |
2004 | 2012 | return true; |
2005 | 2013 | |
2006 | 2014 | elf_flags_init (obfd) = true; |
@@ -235,11 +235,17 @@ _bfd_elf_link_record_dynamic_symbol (info, h) | ||
235 | 235 | |
236 | 236 | (*info->callbacks->undefined_symbol) |
237 | 237 | (info, name, abfd, bfd_und_section_ptr, 0, true); |
238 | + | |
239 | + /* We have flaged a fatal error. We now treat this as | |
240 | + a normal symbol to avoid further error messages. */ | |
241 | + h->other ^= ELF_ST_VISIBILITY (h->other); | |
238 | 242 | } |
239 | - | |
240 | - h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; | |
241 | - break; | |
242 | - | |
243 | + else if (h->root.type != bfd_link_hash_undefweak) | |
244 | + { | |
245 | + h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; | |
246 | + return true; | |
247 | + } | |
248 | + | |
243 | 249 | default: |
244 | 250 | break; |
245 | 251 | } |
@@ -1852,6 +1852,18 @@ elf_link_add_object_symbols (abfd, info) | ||
1852 | 1852 | goto error_return; |
1853 | 1853 | } |
1854 | 1854 | } |
1855 | + else if (dynsym && h->dynindx != -1) | |
1856 | + /* If the symbol already has a dynamic index, but | |
1857 | + visibility says it should not be visible, turn it into | |
1858 | + a local symbol. */ | |
1859 | + switch (ELF_ST_VISIBILITY (h->other)) | |
1860 | + { | |
1861 | + case STV_INTERNAL: | |
1862 | + case STV_HIDDEN: | |
1863 | + h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; | |
1864 | + (*bed->elf_backend_hide_symbol) (h); | |
1865 | + break; | |
1866 | + } | |
1855 | 1867 | } |
1856 | 1868 | } |
1857 | 1869 |
@@ -3339,10 +3351,12 @@ elf_fix_symbol_flags (h, eif) | ||
3339 | 3351 | /* If -Bsymbolic was used (which means to bind references to global |
3340 | 3352 | symbols to the definition within the shared object), and this |
3341 | 3353 | symbol was defined in a regular object, then it actually doesn't |
3342 | - need a PLT entry. */ | |
3354 | + need a PLT entry. Likewise, if the symbol has any kind of | |
3355 | + visibility (internal, hidden, or protected), it doesn't need a | |
3356 | + PLT. */ | |
3343 | 3357 | if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0 |
3344 | 3358 | && eif->info->shared |
3345 | - && eif->info->symbolic | |
3359 | + && (eif->info->symbolic || ELF_ST_VISIBILITY (h->other)) | |
3346 | 3360 | && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) |
3347 | 3361 | { |
3348 | 3362 | h->elf_link_hash_flags &=~ ELF_LINK_HASH_NEEDS_PLT; |
@@ -5072,6 +5086,11 @@ elf_link_output_extsym (h, data) | ||
5072 | 5086 | sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info)); |
5073 | 5087 | } |
5074 | 5088 | |
5089 | + /* If a symbol is not defined locally, we clear the visibility | |
5090 | + field. */ | |
5091 | + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) | |
5092 | + sym.st_other ^= ELF_ST_VISIBILITY(sym.st_other); | |
5093 | + | |
5075 | 5094 | /* If this symbol should be put in the .dynsym section, then put it |
5076 | 5095 | there now. We have already know the symbol index. We also fill |
5077 | 5096 | in the entry in the .hash section. */ |