aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-09-23 14:55:39 +0930
committerAlan Modra <amodra@gmail.com>2020-09-24 07:52:53 +0930
commitc94053440e29421dd8846530da73f09c9ede2e0f (patch)
tree0eda8206c14678ef2b6e4114f95fca798460ce7f /ld/emultempl
parentafdcafe89118cee761f9bf67ea1b1efc29311300 (diff)
downloadgdb-c94053440e29421dd8846530da73f09c9ede2e0f.zip
gdb-c94053440e29421dd8846530da73f09c9ede2e0f.tar.gz
gdb-c94053440e29421dd8846530da73f09c9ede2e0f.tar.bz2
PR26655, Power10 libstdc++.so R_PPC64_NONE dynamic relocs
Some of the powerpc64 code editing functions are better run after dynamic symbols have stabilised in order to make proper decisions based on SYMBOL_REFERENCES_LOCAL. The dynamic symbols are processed early in bfd_elf_size_dynamic_sections, before the backend always_size_sections function is called. One function, ppc64_elf_tls_setup must run before bfd_elf_size_dynamic_sections because it changes dynamic symbols. ppc64_elf_edit_opd and ppc64_elf_inline_plt can run early or late, I think. ppc64_elf_tls_optimize and ppc64_elf_edit_toc are better run later. So this patch arranges to call some edit functions later via always_size_sections. PR 26655 bfd/ * elf64-ppc.c (ppc64_elf_func_desc_adjust): Rename to.. (ppc64_elf_edit): Call params->edit. (ppc64_elf_tls_setup): Don't call _bfd_elf_tls_setup. Return a bfd_boolean. * elf64-ppc.h (struct ppc64_elf_params): Add "edit". (ppc64_elf_tls_setup): Update declaration. ld/ * emultempl/ppc64elf.em (params): Add ppc_edit. (ppc_before_allocation): Split off some edit functions to.. (ppc_edit): ..this, new function.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/ppc64elf.em18
1 files changed, 15 insertions, 3 deletions
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index 42b9bd4..2df5a21 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -32,10 +32,12 @@ fragment <<EOF
static asection *ppc_add_stub_section (const char *, asection *);
static void ppc_layout_sections_again (void);
+static void ppc_edit (void);
static struct ppc64_elf_params params = { NULL,
&ppc_add_stub_section,
&ppc_layout_sections_again,
+ &ppc_edit,
1, -1, -1, 0,
${DEFAULT_PLT_STATIC_CHAIN-0}, -1, 5,
-1, -1, 0, 0, -1, -1, 0};
@@ -294,7 +296,19 @@ ppc_before_allocation (void)
einfo (_("%X%P: inline PLT: %E\n"));
}
- if (ppc64_elf_tls_setup (&link_info)
+ if (!ppc64_elf_tls_setup (&link_info))
+ einfo (_("%X%P: TLS problem %E\n"));
+ }
+
+ gld${EMULATION_NAME}_before_allocation ();
+}
+
+static void
+ppc_edit (void)
+{
+ if (stub_file != NULL)
+ {
+ if (elf_hash_table (&link_info)->tls_sec != NULL
&& !no_tls_opt)
{
/* Size the sections. This is premature, but we want to know the
@@ -323,8 +337,6 @@ ppc_before_allocation (void)
sort_toc_sections (&toc_os->children, NULL, NULL);
}
}
-
- gld${EMULATION_NAME}_before_allocation ();
}
struct hook_stub_info