* [PATCH] or1k: fix pc-relative relocation against dynamic on PC relative 26 bit relocation
@ 2021-07-12 10:32 Giulio Benetti
2021-07-16 14:04 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Giulio Benetti @ 2021-07-12 10:32 UTC (permalink / raw)
To: Openrisc
Cc: Stafford Horne, Richard Henderson, GNU Binutils,
Richard Henderson, Giulio Benetti
When building openal we were seeing the assert failure:
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
pc-relative relocation against dynamic symbol alSourcePausev
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
pc-relative relocation against dynamic symbol alSourceStopv
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
pc-relative relocation against dynamic symbol alSourceRewindv
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
pc-relative relocation against dynamic symbol alSourcePlayv
collect2: error: ld returned 1 exit status
This happens because in R_OR1K_INSN_REL_26 case we can't reference local
symbol as previously done but we need to make sure that calls to actual
symbol always call the version of current object.
bfd/Changelog:
* elf32-or1k.c (or1k_elf_relocate_section): use a separate entry
in switch case R_OR1K_INSN_REL_26 where we need to check for
!SYMBOL_CALLS_LOCAL() instead of !SYMBOL_REFERENCES_LOCAL().
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
bfd/elf32-or1k.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 4ae7f324d33..4f9092539f5 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -1543,6 +1543,18 @@ or1k_elf_relocate_section (bfd *output_bfd,
break;
case R_OR1K_INSN_REL_26:
+ /* For a non-shared link, these will reference plt or call the
+ version of actual object. */
+ if (bfd_link_pic (info) && !SYMBOL_CALLS_LOCAL (info, h))
+ {
+ _bfd_error_handler
+ (_("%pB: pc-relative relocation against dynamic symbol %s"),
+ input_bfd, name);
+ ret_val = false;
+ bfd_set_error (bfd_error_bad_value);
+ }
+ break;
+
case R_OR1K_PCREL_PG21:
case R_OR1K_LO13:
case R_OR1K_SLO13:
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] or1k: fix pc-relative relocation against dynamic on PC relative 26 bit relocation
2021-07-12 10:32 [PATCH] or1k: fix pc-relative relocation against dynamic on PC relative 26 bit relocation Giulio Benetti
@ 2021-07-16 14:04 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2021-07-16 14:04 UTC (permalink / raw)
To: Giulio Benetti, Openrisc
Cc: Richard Henderson, GNU Binutils, Richard Henderson
Hi Giulio,
> use a separate entry
> in switch case R_OR1K_INSN_REL_26 where we need to check for
> !SYMBOL_CALLS_LOCAL() instead of !SYMBOL_REFERENCES_LOCAL().
Patch approved and applied. Thanks for reporting and fixing this problem.
Cheers
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-16 14:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 10:32 [PATCH] or1k: fix pc-relative relocation against dynamic on PC relative 26 bit relocation Giulio Benetti
2021-07-16 14:04 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).