mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-10 10:01:42 +00:00
Revert "r250372 - [ELF2/PPC64] Remove now-dead weak/undef check"
Unfortunately, the check was not as dead as I had thought, and adjusting the starting VA again exposed the problem. We end up trying to relocate the bl (using a 24-bit relative offset) to a symbol address of zero, and in general, that does not fit. Thus, reverting for now, and adding a test case. llvm-svn: 250423
This commit is contained in:
parent
2cd92f1cc7
commit
000561c2f5
@ -416,7 +416,7 @@ bool PPC64TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
|
||||
return false;
|
||||
|
||||
// These are function calls that need to be redirected through a PLT stub.
|
||||
return S.isShared();
|
||||
return S.isShared() || (S.isUndefined() && S.isWeak());
|
||||
}
|
||||
|
||||
bool PPC64TargetInfo::isRelRelative(uint32_t Type) const {
|
||||
|
23
lld/test/elf2/ppc64-weak-undef-call.s
Normal file
23
lld/test/elf2/ppc64-weak-undef-call.s
Normal file
@ -0,0 +1,23 @@
|
||||
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t
|
||||
# RUN: ld.lld2 %t -o %t2
|
||||
# RUN: llvm-objdump -d %t2 | FileCheck %s
|
||||
# REQUIRES: ppc
|
||||
|
||||
# CHECK: Disassembly of section .text:
|
||||
|
||||
.section ".opd","aw"
|
||||
.global _start
|
||||
_start:
|
||||
.quad .Lfoo,.TOC.@tocbase,0
|
||||
|
||||
.text
|
||||
.Lfoo:
|
||||
bl weakfunc
|
||||
nop
|
||||
blr
|
||||
|
||||
.weak weakfunc
|
||||
|
||||
# It does not really matter how we fixup the bl, if at all, because it needs to
|
||||
# be unreachable. But, we should link successfully.
|
||||
# CHECK: 10010008: 4e 80 00 20 blr
|
Loading…
Reference in New Issue
Block a user