e5978dae85
Actual patches are stubs suggested but now they are available as upstream. So let's substitute them since they make part of a or1k patchset and next patch will add the others. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> [Arnout: remove the PATCH M/N parts - cfr. check-package]
60 lines
2.4 KiB
Diff
60 lines
2.4 KiB
Diff
From 651c3617a04a1d1f78e89623b81be7ba32ff59a5 Mon Sep 17 00:00:00 2001
|
|
From: Stafford Horne <shorne@gmail.com>
|
|
Date: Sun, 2 May 2021 06:02:14 +0900
|
|
Subject: [PATCH] or1k: Fix issue with plt link failure for local calls
|
|
|
|
When building protobuf we were seeing the assert failure:
|
|
|
|
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
|
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
|
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
|
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
|
/home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld:
|
|
BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377
|
|
collect2: error: ld returned 1 exit status
|
|
|
|
This failure happens while writing out PLT entries, there is a check
|
|
"BFD_ASSERT (h->dynindx != -1)" to confirm all plt entries have dynamic
|
|
symbol attributes. This was failing for symbols that were
|
|
"forced_local" in previous linking code.
|
|
|
|
The fix adds logic to or1k_elf_adjust_dynamic_symbol to identify
|
|
"forced_local" symbols and exclude them from the the PLT.
|
|
|
|
bfd/ChangeLog:
|
|
|
|
PR 27624
|
|
* elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Change
|
|
condition used to cleanup plt entries to cleanup forced local
|
|
entries.
|
|
|
|
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
|
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
|
---
|
|
bfd/elf32-or1k.c | 9 ++++-----
|
|
1 file changed, 4 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
|
|
index 31ef758a926..58246875546 100644
|
|
--- a/bfd/elf32-or1k.c
|
|
+++ b/bfd/elf32-or1k.c
|
|
@@ -2535,11 +2535,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
|
if (h->type == STT_FUNC
|
|
|| h->needs_plt)
|
|
{
|
|
- if (! bfd_link_pic (info)
|
|
- && !h->def_dynamic
|
|
- && !h->ref_dynamic
|
|
- && h->root.type != bfd_link_hash_undefweak
|
|
- && h->root.type != bfd_link_hash_undefined)
|
|
+ if (h->plt.refcount <= 0
|
|
+ || (SYMBOL_CALLS_LOCAL (info, h)
|
|
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
|
|
+ && h->root.type == bfd_link_hash_undefweak)))
|
|
{
|
|
/* This case can occur if we saw a PLT reloc in an input
|
|
file, but the symbol was never referred to by a dynamic
|
|
--
|
|
2.25.1
|
|
|