} else {
section = _sectionMap[sectionKey];
}
- return section->appendAtom(atom);
// Add runtime relocations to the .rela section.
for (const auto &reloc : *definedAtom)
if (_targetInfo.isRuntimeRelocation(*definedAtom, *reloc))
getRelocationTable()->addRelocation(*definedAtom, *reloc);
+ return section->appendAtom(atom);
} else if (const AbsoluteAtom *absoluteAtom = dyn_cast<AbsoluteAtom>(atom)) {
// Absolute atoms are not part of any section, they are global for the whole
// link
auto ga = new (_file._alloc) GOTAtom(_file, ".got.plt");
ga->addReference(R_X86_64_IRELATIVE, 0, &da, 0);
auto pa = new (_file._alloc) PLTAtom(_file, ".plt");
- pa->addReference(R_X86_64_PC32, 2, ga, 0);
+ pa->addReference(R_X86_64_PC32, 2, ga, -4);
#ifndef NDEBUG
ga->_name = "__got_ifunc_";
ga->_name += da.name();
RUN: lld -core -target x86_64-linux -emit-yaml -output=- %p/Inputs/ifunc.x86-64 \
RUN: | FileCheck %s
+
RUN: lld -core -target x86_64-linux -emit-yaml -output=- %p/Inputs/ifunc.x86-64 \
RUN: %p/Inputs/ifunc.cpp.x86-64 | FileCheck %s --check-prefix=PLT
+RUN: lld -core -target x86_64-linux -output=%t %p/Inputs/ifunc.x86-64 \
+RUN: %p/Inputs/ifunc.cpp.x86-64 && llvm-objdump -d %t| FileCheck %s \
+RUN: --check-prefix=BIN
+
CHECK: name: hey
CHECK: scope: global
CHECK: type: resolver
PLT: type: stub
PLT: references
PLT: kind: R_X86_64_PC32
+
+// This is a horribly brittle test. We need a way to do arithmetic on captured
+// variables.
+BIN: 400136: ff 25 c4 0e 00 00 jumpq *3780(%rip)
+BIN: .got.plt:
+BIN-NEXT: 401000 00000000 00000000