diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-10-18 15:46:57 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-10-18 15:47:35 -0700 |
commit | 8e354058532d48dce19fdf0b2e0653609a69f19e (patch) | |
tree | 25e81366b620631167e4264b5cfda8a314460461 /bfd/elfxx-tilegx.c | |
parent | 8dfa5d5a6389b7f0fdd7baaedc5f316f05debf63 (diff) | |
download | gdb-8e354058532d48dce19fdf0b2e0653609a69f19e.zip gdb-8e354058532d48dce19fdf0b2e0653609a69f19e.tar.gz gdb-8e354058532d48dce19fdf0b2e0653609a69f19e.tar.bz2 |
tile: Mark __tls_get_addr in gc_mark_hook
TLS_GD_CALL relocations implicitly reference __tls_get_addr. Since
elf_gc_mark_hook is called before check_relocs now, we need to call
_bfd_generic_link_add_one_symbol to mark __tls_get_addr for garbage
collection.
* elf32-tilepro.c (tilepro_elf_gc_mark_hook): Call
_bfd_generic_link_add_one_symbol to mark __tls_get_addr.
* elfxx-tilegx.c (tilegx_elf_gc_mark_hook): Likewise.
Diffstat (limited to 'bfd/elfxx-tilegx.c')
-rw-r--r-- | bfd/elfxx-tilegx.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index c9e860a..d7b0419 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -2103,6 +2103,8 @@ tilegx_elf_gc_mark_hook (asection *sec, dealing with TLS optimization, ought to be !bfd_link_executable (info). */ if (bfd_link_pic (info)) { + struct bfd_link_hash_entry *bh; + switch (TILEGX_ELF_R_TYPE (rel->r_info)) { case R_TILEGX_TLS_GD_CALL: @@ -2111,8 +2113,14 @@ tilegx_elf_gc_mark_hook (asection *sec, on this reloc, so the real symbol and section will be gc marked when processing the other reloc. That lets us handle __tls_get_addr here. */ - h = elf_link_hash_lookup (elf_hash_table (info), "__tls_get_addr", - FALSE, FALSE, TRUE); + bh = NULL; + if (! _bfd_generic_link_add_one_symbol (info, sec->owner, + "__tls_get_addr", 0, + bfd_und_section_ptr, + 0, NULL, FALSE, + FALSE, &bh)) + return NULL; + h = (struct elf_link_hash_entry *) bh; BFD_ASSERT (h != NULL); h->mark = 1; if (h->u.weakdef != NULL) |