GNU Binutils with patches for OS216
リビジョン | 0dc9a308a1ec9675bf6b33bae9e8b1faa0bad9ed (tree) |
---|---|
日時 | 2017-04-25 05:42:33 |
作者 | H.J. Lu <hjl.tools@gmai...> |
コミッター | H.J. Lu |
i386: Force symbol dynamic if it isn't undefined weak
Force symbol dynamic if it isn't undefined weak. Generate R_386_RELATIVE
relocation for R_386_GOT32 relocation against non-dynamic symbol in PIC.
PR ld/21402
* elf32-i386.c (elf_i386_allocate_dynrelocs): If a symbol isn't
undefined weak symbol, don't make it dynamic.
(elf_i386_relocate_section): If a symbol isn't dynamic in PIC,
set no_finish_dynamic_symbol and generate R_386_RELATIVE
relocation for R_386_GOT32.
@@ -1,5 +1,14 @@ | ||
1 | 1 | 2017-04-24 H.J. Lu <hongjiu.lu@intel.com> |
2 | 2 | |
3 | + PR ld/21402 | |
4 | + * elf32-i386.c (elf_i386_allocate_dynrelocs): If a symbol isn't | |
5 | + undefined weak symbol, don't make it dynamic. | |
6 | + (elf_i386_relocate_section): If a symbol isn't dynamic in PIC, | |
7 | + set no_finish_dynamic_symbol and generate R_386_RELATIVE | |
8 | + relocation for R_386_GOT32. | |
9 | + | |
10 | +2017-04-24 H.J. Lu <hongjiu.lu@intel.com> | |
11 | + | |
3 | 12 | PR ld/21425 |
4 | 13 | * elf32-i386.c (ELF_MAXPAGESIZE): Set to 0x1000 for VxWorks. |
5 | 14 |
@@ -2748,7 +2748,8 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) | ||
2748 | 2748 | Undefined weak syms won't yet be marked as dynamic. */ |
2749 | 2749 | if (h->dynindx == -1 |
2750 | 2750 | && !h->forced_local |
2751 | - && !resolved_to_zero) | |
2751 | + && !resolved_to_zero | |
2752 | + && h->root.type == bfd_link_hash_undefweak) | |
2752 | 2753 | { |
2753 | 2754 | if (! bfd_elf_link_record_dynamic_symbol (info, h)) |
2754 | 2755 | return FALSE; |
@@ -2867,14 +2868,11 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) | ||
2867 | 2868 | int tls_type = elf_i386_hash_entry(h)->tls_type; |
2868 | 2869 | |
2869 | 2870 | /* Make sure this symbol is output as a dynamic symbol. |
2870 | - Undefined weak syms won't yet be marked as dynamic. | |
2871 | - PR ld/21402: If this symbol isn't undefined weak symbol, | |
2872 | - don't make it dynamic in PIE. */ | |
2871 | + Undefined weak syms won't yet be marked as dynamic. */ | |
2873 | 2872 | if (h->dynindx == -1 |
2874 | 2873 | && !h->forced_local |
2875 | 2874 | && !resolved_to_zero |
2876 | - && (h->root.type == bfd_link_hash_undefweak | |
2877 | - || !bfd_link_pie (info))) | |
2875 | + && h->root.type == bfd_link_hash_undefweak) | |
2878 | 2876 | { |
2879 | 2877 | if (! bfd_elf_link_record_dynamic_symbol (info, h)) |
2880 | 2878 | return FALSE; |
@@ -3035,7 +3033,8 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) | ||
3035 | 3033 | Undefined weak syms won't yet be marked as dynamic. */ |
3036 | 3034 | if (h->dynindx == -1 |
3037 | 3035 | && !h->forced_local |
3038 | - && !resolved_to_zero) | |
3036 | + && !resolved_to_zero | |
3037 | + && h->root.type == bfd_link_hash_undefweak) | |
3039 | 3038 | { |
3040 | 3039 | if (! bfd_elf_link_record_dynamic_symbol (info, h)) |
3041 | 3040 | return FALSE; |
@@ -4315,10 +4314,10 @@ r_386_got32: | ||
4315 | 4314 | if (h->dynindx == -1 |
4316 | 4315 | && !h->forced_local |
4317 | 4316 | && h->root.type != bfd_link_hash_undefweak |
4318 | - && bfd_link_pie (info)) | |
4317 | + && bfd_link_pic (info)) | |
4319 | 4318 | { |
4320 | 4319 | /* PR ld/21402: If this symbol isn't dynamic |
4321 | - in PIE, generate R_386_RELATIVE here. */ | |
4320 | + in PIC, generate R_386_RELATIVE here. */ | |
4322 | 4321 | eh->no_finish_dynamic_symbol = 1; |
4323 | 4322 | relative_reloc = TRUE; |
4324 | 4323 | } |