Symbol *s = p.first;
uint64_t offset = p.second * config->wordsize;
if (s == nullptr) {
- if (!config->isPic)
+ if (!config->shared)
continue;
mainPart->relaDyn->addReloc(target->tlsModuleIndexRel, this, offset, s);
} else {
// for the module index. Therefore only checking for
// S->isPreemptible is not sufficient (this happens e.g. for
// thread-locals that have been marked as local through a linker script)
- if (!s->isPreemptible && !config->isPic)
+ if (!s->isPreemptible && !config->shared)
continue;
mainPart->relaDyn->addReloc(target->tlsModuleIndexRel, this, offset, s);
// However, we can skip writing the TLS offset reloc for non-preemptible
for (const std::pair<Symbol *, size_t> &p : g.tls)
write(p.second, p.first, p.first->isPreemptible ? 0 : -0x7000);
for (const std::pair<Symbol *, size_t> &p : g.dynTlsSymbols) {
- if (p.first == nullptr && !config->isPic)
+ if (p.first == nullptr && !config->shared)
write(p.second, nullptr, 1);
else if (p.first && !p.first->isPreemptible) {
- // If we are emitting PIC code with relocations we mustn't write
+ // If we are emitting a shared libary with relocations we mustn't write
// anything to the GOT here. When using Elf_Rel relocations the value
// one will be treated as an addend and will cause crashes at runtime
- if (!config->isPic)
+ if (!config->shared)
write(p.second, nullptr, 1);
write(p.second + 1, p.first, -0x8000);
}
# RUN: | FileCheck -check-prefix=DIS %s
# RUN: llvm-readobj -r -A %t.exe | FileCheck %s
+# RUN: ld.lld -pie %t.o %t.so -script %t.script -o %t.pie
+# RUN: llvm-objdump -d -s -t --no-show-raw-insn %t.pie \
+# RUN: | FileCheck -check-prefix=DIS %s
+# RUN: llvm-readobj -r -A %t.pie | FileCheck %s
+
# RUN: ld.lld -shared %t.o %t.so -script %t.script -o %t-out.so
# RUN: llvm-objdump -d -s -t --no-show-raw-insn %t-out.so \
# RUN: | FileCheck -check-prefix=DIS-SO %s
# RUN: | FileCheck -check-prefix=DIS %s
# RUN: llvm-readobj -r -A %t.exe | FileCheck %s
+# RUN: ld.lld -pie %t.o %t.so -script %t.script -o %t.pie
+# RUN: llvm-objdump -d -s -t --no-show-raw-insn %t.pie \
+# RUN: | FileCheck -check-prefix=DIS %s
+# RUN: llvm-readobj -r -A %t.pie | FileCheck %s
+
# RUN: ld.lld -shared %t.o %t.so -script %t.script -o %t-out.so
# RUN: llvm-objdump -d -s -t --no-show-raw-insn %t-out.so \
# RUN: | FileCheck -check-prefix=DIS-SO %s