Added warning for static TLS reloc.
Fixed issue related to TLS and partial static linking of libraries:
This issue was detected when throwing exceptions in C++ while linking with
-static-libstdc++.
TLS relocation from the libstdc++ wasn't being patched as local now that it was
static linked with the executable.
Fix for TLS with static and pie. Problem introduced by earlier patch:
Fixes the following glibc tests:
- elf/tst-tls1-static
bfd/
xxxx-xx-xx Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h (arc_got_entry_type_for_reloc): Changed to
correct static TLS relocs.
* elf32-arc.c (elf_arc_check_relocs): Introduced warning to
TLS relocs which require -fPIC.
(arc_create_forced_local_got_entries_for_tls): Created.
Traverses list of GOT entries to be resolved statically
when needed.
(elf_arc_finish_dynamic_sections): Changed. Calls
arc_create_forced_local_got_entries_for_tls for each known
possibly GOT symbol.
Fix a memory leak appearing when the local got entry list was constructed.
bfd/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* arc-got.h (arc_get_local_got_ents): Revamp it; use
elf_local_got_ents to store the local got list.
(get_got_entry_list_for_symbo): Restructure it.
* elf32-arc.c (elf_arc_relocate_section): Correct the call to
get_got_entry_list_for_symbol.
Inserted offset in final section in the GOT entry of type DTSOFF soon to be
relocated by the dynamic loader.
bfd/
2018-09-06 Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h (relocate_fix_got_relocs_for_got_info): Changed. Take TLS
section alignment in consideration for this relocation.
* elf32-arc.c (FINAL_SECTSTART): Added this formula macro.
(ARC_TLS_DTPOFF) Updated reloc to use new created macro instead.
Change location where GOT information is collected for ARC target, avoiding
posible use conflicts of the previous .got field in the symbols hash_entry.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h (get_got_entry_list_for_symbol): Changed.
* ef32-arc.c (struct elf_arc_link_hash_entry): Moved and changed.
(elf_arc_link_hash_newfunc): Changed.
(arc_elf_link_hash_table_create): Removed old initializations.
(elf_arc_relocate_section, elf_arc_finish_dynamic_symbol): Changed.
In the case of static relocation, the GOT entries are fixed at link time
and are set by the linker.
In order to compute the right TLS offset it is necessary to add TCB_SIZE
to the offset, just in case the dynamic linker is not expected to be
executed (static linked case).
This problem does appear in dynamic linked applications, as the dynamic
linker is adding this TCB_SIZE by operating the TCB block structure.
Problem revealed in GLIBC with static linking.
bfd/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
arc-got.h (relocate_fix_got_relocs_for_got_info): Added TCB_SIZE to
patched section contents for TLS IE reloc.
elf32-arc.c: Remove TCB_SIZE preprocessor macro.
Rebase to 0006
When no dynamic relocation was generated the .got content would not be
updated for the TLS_IE_GOT relocation addresses.
bfd/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h (relocate_fix_got_relocs_for_got_info): Fixed addresses in
debug comments. Fixed address in .got related to TLS_IE_GOT dynamic
relocation.
ld/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
* testsuite/ld-arc/tls_ie-01.s: Added to verify associated fix.
* testsuite/ld-arc/tls_ie-01.d: Likewise
bfd * arc-got.h (relocate_fix_got_relocs_for_got_info): Handle the case
where there's no elf_link_hash_entry while processing GOT_NORMAL got
entries.
ld * testsuite/ld-arc/got-01.d: New file.
* testsuite/ld-arc/got-01.s: New file.
bfd * elf32-arc.c (PR_DEBUG): Delete.
Fix printing of debug information. Fix formatting of debug
statements.
(debug_arc_reloc): Handle symbols that are not from an input file.
(arc_do_relocation): Remove excessive exclamation points.
(elf_arc_relocate_section): Print an informative message if the
relocation fails, even if debugging is not enabled.
* arc-got.h: Fix formatting. Fix printing of debug information.
(new_got_entry_to_list): Use xmalloc.
* config.bfd: use the big-endian arc vector as the default vector
for big-endian arc targets.
ld * testsuite/ld-arc/arc.exp: Always run the sda-relocs test in
little endian mode.
TLS relocations did not support multiple TLS modes for the same
symbol in a single object file.
Refactored how GOT and TLS is implemented. Removed code duplications between
local and global symbols conditioning.
bfd/ChangeLog:
2016-06-14 Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h: Moved got related structures from elf32-arc.c to
this file. More precisely, tls_type_e, tls_got_entries, got_entry.
* (arc_get_local_got_ents,
got_entry_for_type,
new_got_entry_to_list,
tls_type_for_reloc,
symbol_has_entry_of_type,
get_got_entry_list_for_symbol,
arc_got_entry_type_for_reloc,
ADD_SYMBOL_REF_SEC_AND_RELOC,
arc_fill_got_info_for_reloc,
relocate_fix_got_relocs_for_got_info,
create_got_dynrelocs_for_single_entry,
create_got_dynrelocs_for_got_info): Added to file.
* elf32-arc.c: Removed GOT & TLS related structs and functions to
arc-got.h.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>