File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed
include/llvm/ExecutionEngine/JITLink
lib/ExecutionEngine/JITLink
test/ExecutionEngine/JITLink/ppc64 Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -204,9 +204,11 @@ class PLTTableManager : public TableManager<PLTTableManager<Endianness>> {
204
204
if (isExternal) {
205
205
E.setKind (ppc64::CallBranchDeltaRestoreTOC);
206
206
this ->StubKind = LongBranchSaveR2;
207
+ // FIXME: We assume the addend to the external target is zero. It's
208
+ // quite unusual that the addend of an external target to be non-zero as
209
+ // if we have known the layout of the external object.
207
210
E.setTarget (this ->getEntryForTarget (G, E.getTarget ()));
208
- // We previously set branching to local entry. Now reverse that
209
- // operation.
211
+ // Addend to the stub is zero.
210
212
E.setAddend (0 );
211
213
} else
212
214
// TODO: There are cases a local function call need a call stub.
Original file line number Diff line number Diff line change @@ -346,9 +346,13 @@ class ELFLinkGraphBuilder_ppc64
346
346
break ;
347
347
case ELF::R_PPC64_REL24:
348
348
Kind = ppc64::RequestCall;
349
- assert (Addend == 0 && " Addend is expected to be 0 for a function call" );
350
- // We assume branching to local entry, will reverse the addend if not.
351
- Addend = ELF::decodePPC64LocalEntryOffset ((*ObjSymbol)->st_other );
349
+ // Determining a target is external or not is deferred in PostPrunePass.
350
+ // We assume branching to local entry by default, since in PostPrunePass,
351
+ // we don't have any context to determine LocalEntryOffset. If it finally
352
+ // turns out to be an external call, we'll have a stub for the external
353
+ // target, the target of this edge will be the stub and its addend will be
354
+ // set 0.
355
+ Addend += ELF::decodePPC64LocalEntryOffset ((*ObjSymbol)->st_other );
352
356
break ;
353
357
case ELF::R_PPC64_REL64:
354
358
Kind = ppc64::Delta64;
Original file line number Diff line number Diff line change 1
- # REQUIRES: asserts
2
1
# RUN: yaml2obj %S/Inputs/rel24-non-zero-addend.yaml -o %t.o
3
- # RUN: not --crash llvm-jitlink -noexec %t.o 2>&1 | FileCheck %s
4
- # CHECK: Addend == 0 && "Addend is expected to be 0 for a function call"
5
- #
2
+ # RUN: llvm-jitlink -noexec %t.o 2>&1
6
3
# The object is generated from llvm/test/ExecutionEngine/MCJIT/test-global-ctors.ll,
7
4
# containing an R_PPC64_REL24 whose addend is not zero.
You can’t perform that action at this time.
0 commit comments