diff options
author | Yi Kong <yikong@google.com> | 2019-02-27 14:18:31 -0800 |
---|---|---|
committer | Yi Kong <yikong@google.com> | 2019-02-27 14:18:31 -0800 |
commit | 958317e226bf38ef5e647d0b056e8e95eb472c70 (patch) | |
tree | 931efffa9cb05aee46a4bcb41be035962d0418ad | |
parent | 0f50d2239d204e2f2026b9db97f30b5d54753f0c (diff) | |
download | lld-958317e226bf38ef5e647d0b056e8e95eb472c70.tar.gz |
revert to previous base llvm-svn.349610
Change-Id: Ib0010bb41abcf296cd09c0808410dce0c5ccbfd6
-rw-r--r-- | ELF/Driver.cpp | 4 | ||||
-rw-r--r-- | ELF/InputFiles.cpp | 8 | ||||
-rw-r--r-- | ELF/InputFiles.h | 8 | ||||
-rw-r--r-- | ELF/InputSection.cpp | 4 | ||||
-rw-r--r-- | ELF/LinkerScript.cpp | 4 | ||||
-rw-r--r-- | ELF/Relocations.cpp | 6 | ||||
-rw-r--r-- | ELF/SymbolTable.cpp | 24 | ||||
-rw-r--r-- | ELF/SymbolTable.h | 1 | ||||
-rw-r--r-- | ELF/Symbols.cpp | 1 | ||||
-rw-r--r-- | ELF/Symbols.h | 3 | ||||
-rw-r--r-- | ELF/SyntheticSections.cpp | 4 | ||||
-rw-r--r-- | ELF/Writer.cpp | 42 | ||||
-rw-r--r-- | test/ELF/aarch64-cortex-a53-843419-tlsrelax.s | 4 | ||||
-rw-r--r-- | test/ELF/aarch64-gnu-ifunc-address.s | 40 | ||||
-rw-r--r-- | test/ELF/aarch64-tls-gdle.s | 6 | ||||
-rw-r--r-- | test/ELF/aarch64-tls-iele.s | 6 | ||||
-rw-r--r-- | test/ELF/aarch64-tls-le.s | 10 | ||||
-rw-r--r-- | test/ELF/aarch64-tlsld-ldst.s | 50 | ||||
-rw-r--r-- | test/ELF/arm-gnu-ifunc.s | 5 | ||||
-rw-r--r-- | test/ELF/arm-tls-le32.s | 12 | ||||
-rw-r--r-- | test/ELF/arm-tls-norelax-ie-le.s | 4 | ||||
-rw-r--r-- | test/ELF/comdat-linkonce.s | 7 | ||||
-rw-r--r-- | test/ELF/gnu-ifunc-empty.s | 16 | ||||
-rw-r--r-- | test/ELF/no-discard-this_module.s | 41 | ||||
-rw-r--r-- | test/ELF/shlib-undefined-archive.s | 19 | ||||
-rw-r--r-- | test/ELF/trace-symbols.s | 2 |
26 files changed, 88 insertions, 243 deletions
diff --git a/ELF/Driver.cpp b/ELF/Driver.cpp index c50f1e9ec..51daa81ed 100644 --- a/ELF/Driver.cpp +++ b/ELF/Driver.cpp @@ -1541,10 +1541,6 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) { // They also might be exported if referenced by DSOs. Script->declareSymbols(); - // Handle undefined symbols in DSOs. - if (!Config->Shared) - Symtab->scanShlibUndefined<ELFT>(); - // Handle the -exclude-libs option. if (Args.hasArg(OPT_exclude_libs)) excludeLibs<ELFT>(Args); diff --git a/ELF/InputFiles.cpp b/ELF/InputFiles.cpp index dfc33d5af..a85e5e6af 100644 --- a/ELF/InputFiles.cpp +++ b/ELF/InputFiles.cpp @@ -739,8 +739,7 @@ InputSectionBase *ObjFile<ELFT>::createInputSection(const Elf_Shdr &Sec) { // sections. Drop those sections to avoid duplicate symbol errors. // FIXME: This is glibc PR20543, we should remove this hack once that has been // fixed for a while. - if (Name == ".gnu.linkonce.t.__x86.get_pc_thunk.bx" || - Name == ".gnu.linkonce.t.__i686.get_pc_thunk.bx") + if (Name.startswith(".gnu.linkonce.")) return &InputSection::Discarded; // If we are creating a new .build-id section, strip existing .build-id @@ -1020,7 +1019,10 @@ template <class ELFT> void SharedFile<ELFT>::parseRest() { } if (Sym.isUndefined()) { - this->Undefs.insert(Name); + Symbol *S = Symtab->addUndefined<ELFT>(Name, Sym.getBinding(), + Sym.st_other, Sym.getType(), + /*CanOmitFromDynSym=*/false, this); + S->ExportDynamic = true; continue; } diff --git a/ELF/InputFiles.h b/ELF/InputFiles.h index 1d2a6a018..5094ddd80 100644 --- a/ELF/InputFiles.h +++ b/ELF/InputFiles.h @@ -94,13 +94,6 @@ public: return Symbols; } - // Returns undefined symbols of a shared library. - // It is a runtime error to call this function on files of other types. - const llvm::DenseSet<StringRef> &getUndefinedSymbols() { - assert(FileKind == SharedKind); - return Undefs; - } - // Filename of .a which contained this file. If this file was // not in an archive file, it is the empty string. We use this // string for creating error messages. @@ -136,7 +129,6 @@ protected: InputFile(Kind K, MemoryBufferRef M); std::vector<InputSectionBase *> Sections; std::vector<Symbol *> Symbols; - llvm::DenseSet<StringRef> Undefs; private: const Kind FileKind; diff --git a/ELF/InputSection.cpp b/ELF/InputSection.cpp index 7de3507c7..30a9fc288 100644 --- a/ELF/InputSection.cpp +++ b/ELF/InputSection.cpp @@ -575,10 +575,6 @@ static int64_t getTlsTpOffset() { // Variant 1. The thread pointer points to a TCB with a fixed 2-word size, // followed by a variable amount of alignment padding, followed by the TLS // segment. - // - // NB: While the ARM/AArch64 ABI formally has a 2-word TCB size, lld - // effectively increases the TCB size to 8 words for Android compatibility. - // It accomplishes this by increasing the segment's alignment. return alignTo(Config->Wordsize * 2, Out::TlsPhdr->p_align); case EM_386: case EM_X86_64: diff --git a/ELF/LinkerScript.cpp b/ELF/LinkerScript.cpp index f3f686782..fbc025416 100644 --- a/ELF/LinkerScript.cpp +++ b/ELF/LinkerScript.cpp @@ -157,10 +157,6 @@ static bool shouldDefineSym(SymbolAssignment *Cmd) { Symbol *B = Symtab->find(Cmd->Name); if (B && !B->isDefined()) return true; - // It might also be referenced by a DSO. - for (InputFile *F : SharedFiles) - if (F->getUndefinedSymbols().count(Cmd->Name)) - return true; return false; } diff --git a/ELF/Relocations.cpp b/ELF/Relocations.cpp index 16f9afd56..c75ae4f82 100644 --- a/ELF/Relocations.cpp +++ b/ELF/Relocations.cpp @@ -361,8 +361,8 @@ static bool isStaticLinkTimeConstant(RelExpr E, RelType Type, const Symbol &Sym, if (isRelExprOneOf<R_GOT_FROM_END, R_GOT_OFF, R_HEXAGON_GOT, R_TLSLD_GOT_OFF, R_MIPS_GOT_LOCAL_PAGE, R_MIPS_GOTREL, R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32, R_MIPS_GOT_GP_PC, R_MIPS_TLSGD, - R_AARCH64_GOT_PAGE_PC, R_AARCH64_GOT_PAGE_PC_PLT, R_GOT_PC, - R_GOTONLY_PC, R_GOTONLY_PC_FROM_END, R_PLT_PC, R_TLSGD_GOT, + R_AARCH64_GOT_PAGE_PC, R_GOT_PC, R_GOTONLY_PC, + R_GOTONLY_PC_FROM_END, R_PLT_PC, R_TLSGD_GOT, R_TLSGD_GOT_FROM_END, R_TLSGD_PC, R_PPC_CALL_PLT, R_TLSDESC_CALL, R_AARCH64_TLSDESC_PAGE, R_HINT, R_TLSLD_HINT, R_TLSIE_HINT>(E)) @@ -370,7 +370,7 @@ static bool isStaticLinkTimeConstant(RelExpr E, RelType Type, const Symbol &Sym, // These never do, except if the entire file is position dependent or if // only the low bits are used. - if (E == R_GOT || E == R_GOT_PLT || E == R_PLT || E == R_TLSDESC) + if (E == R_GOT || E == R_PLT || E == R_TLSDESC) return Target->usesOnlyLowPageBits(Type) || !Config->Pic; if (Sym.IsPreemptible) diff --git a/ELF/SymbolTable.cpp b/ELF/SymbolTable.cpp index 4d7d2afc5..e372461ee 100644 --- a/ELF/SymbolTable.cpp +++ b/ELF/SymbolTable.cpp @@ -595,24 +595,6 @@ template <class ELFT> void SymbolTable::fetchLazy(Symbol *Sym) { addFile<ELFT>(File); } -// This function takes care of the case in which shared libraries depend on -// the user program (not the other way, which is usual). Shared libraries -// may have undefined symbols, expecting that the user program provides -// the definitions for them. An example is BSD's __progname symbol. -// We need to put such symbols to the main program's .dynsym so that -// shared libraries can find them. -// Except this, we ignore undefined symbols in DSOs. -template <class ELFT> void SymbolTable::scanShlibUndefined() { - for (InputFile *F : SharedFiles) { - for (StringRef U : F->getUndefinedSymbols()) { - Symbol *Sym = find(U); - if (!Sym || !Sym->isDefined()) - continue; - Sym->ExportDynamic = true; - } - } -} - // Initialize DemangledSyms with a map from demangled symbols to symbol // objects. Used to handle "extern C++" directive in version scripts. // @@ -828,9 +810,3 @@ template void SymbolTable::addShared<ELF64LE>(StringRef, SharedFile<ELF64LE> &, template void SymbolTable::addShared<ELF64BE>(StringRef, SharedFile<ELF64BE> &, const typename ELF64BE::Sym &, uint32_t Alignment, uint32_t); - -template void SymbolTable::scanShlibUndefined<ELF32LE>(); -template void SymbolTable::scanShlibUndefined<ELF32BE>(); -template void SymbolTable::scanShlibUndefined<ELF64LE>(); -template void SymbolTable::scanShlibUndefined<ELF64BE>(); - diff --git a/ELF/SymbolTable.h b/ELF/SymbolTable.h index 8c4f6c607..b5fd8d3b4 100644 --- a/ELF/SymbolTable.h +++ b/ELF/SymbolTable.h @@ -72,7 +72,6 @@ public: template <class ELFT> void fetchLazy(Symbol *Sym); - template <class ELFT> void scanShlibUndefined(); void scanVersionScript(); Symbol *find(StringRef Name); diff --git a/ELF/Symbols.cpp b/ELF/Symbols.cpp index a713ec539..da7fdb5dc 100644 --- a/ELF/Symbols.cpp +++ b/ELF/Symbols.cpp @@ -38,7 +38,6 @@ Defined *ElfSym::GlobalOffsetTable; Defined *ElfSym::MipsGp; Defined *ElfSym::MipsGpDisp; Defined *ElfSym::MipsLocalGp; -Defined *ElfSym::RelaIpltStart; Defined *ElfSym::RelaIpltEnd; static uint64_t getSymVA(const Symbol &Sym, int64_t &Addend) { diff --git a/ELF/Symbols.h b/ELF/Symbols.h index 4d55405d8..803cb80dd 100644 --- a/ELF/Symbols.h +++ b/ELF/Symbols.h @@ -352,8 +352,7 @@ struct ElfSym { static Defined *MipsGpDisp; static Defined *MipsLocalGp; - // __rel{,a}_iplt_{start,end} symbols. - static Defined *RelaIpltStart; + // __rela_iplt_end or __rel_iplt_end static Defined *RelaIpltEnd; }; diff --git a/ELF/SyntheticSections.cpp b/ELF/SyntheticSections.cpp index ff05827dd..293d8452c 100644 --- a/ELF/SyntheticSections.cpp +++ b/ELF/SyntheticSections.cpp @@ -1513,10 +1513,8 @@ void RelocationBaseSection::finalizeContents() { else getParent()->Link = 0; - if (In.RelaPlt == this) + if (In.RelaIplt == this || In.RelaPlt == this) getParent()->Info = In.GotPlt->getParent()->SectionIndex; - if (In.RelaIplt == this) - getParent()->Info = In.IgotPlt->getParent()->SectionIndex; } RelrBaseSection::RelrBaseSection() diff --git a/ELF/Writer.cpp b/ELF/Writer.cpp index 17f4c7961..37a53a1e7 100644 --- a/ELF/Writer.cpp +++ b/ELF/Writer.cpp @@ -910,18 +910,12 @@ void PhdrEntry::add(OutputSection *Sec) { template <class ELFT> void Writer<ELFT>::addRelIpltSymbols() { if (Config->Relocatable || needsInterpSection()) return; + StringRef S = Config->IsRela ? "__rela_iplt_start" : "__rel_iplt_start"; + addOptionalRegular(S, In.RelaIplt, 0, STV_HIDDEN, STB_WEAK); - // By default, __rela_iplt_{start,end} belong to a dummy section 0 - // because .rela.plt might be empty and thus removed from output. - // We'll override Out::ElfHeader with In.RelaIplt later when we are - // sure that .rela.plt exists in output. - ElfSym::RelaIpltStart = addOptionalRegular( - Config->IsRela ? "__rela_iplt_start" : "__rel_iplt_start", - Out::ElfHeader, 0, STV_HIDDEN, STB_WEAK); - - ElfSym::RelaIpltEnd = addOptionalRegular( - Config->IsRela ? "__rela_iplt_end" : "__rel_iplt_end", - Out::ElfHeader, 0, STV_HIDDEN, STB_WEAK); + S = Config->IsRela ? "__rela_iplt_end" : "__rel_iplt_end"; + ElfSym::RelaIpltEnd = + addOptionalRegular(S, In.RelaIplt, 0, STV_HIDDEN, STB_WEAK); } template <class ELFT> @@ -955,12 +949,8 @@ template <class ELFT> void Writer<ELFT>::setReservedSymbolSections() { ElfSym::GlobalOffsetTable->Section = GotSection; } - // .rela_iplt_{start,end} mark the start and the end of .rela.plt section. - if (ElfSym::RelaIpltStart && !In.RelaIplt->empty()) { - ElfSym::RelaIpltStart->Section = In.RelaIplt; - ElfSym::RelaIpltEnd->Section = In.RelaIplt; + if (ElfSym::RelaIpltEnd) ElfSym::RelaIpltEnd->Value = In.RelaIplt->getSize(); - } PhdrEntry *Last = nullptr; PhdrEntry *LastRO = nullptr; @@ -2191,23 +2181,11 @@ template <class ELFT> void Writer<ELFT>::setPhdrs() { P->p_memsz = alignTo(P->p_memsz, Target->PageSize); } - if (P->p_type == PT_TLS && P->p_memsz) { - if (!Config->Shared && - (Config->EMachine == EM_ARM || Config->EMachine == EM_AARCH64)) { - // On ARM/AArch64, reserve extra space (8 words) between the thread - // pointer and an executable's TLS segment by overaligning the segment. - // This reservation is needed for backwards compatibility with Android's - // TCB, which allocates several slots after the thread pointer (e.g. - // TLS_SLOT_STACK_GUARD==5). For simplicity, this overalignment is also - // done on other operating systems. - P->p_align = std::max<uint64_t>(P->p_align, Config->Wordsize * 8); - } - - // The TLS pointer goes after PT_TLS for variant 2 targets. At least glibc - // will align it, so round up the size to make sure the offsets are - // correct. + // The TLS pointer goes after PT_TLS for variant 2 targets. At least glibc + // will align it, so round up the size to make sure the offsets are + // correct. + if (P->p_type == PT_TLS && P->p_memsz) P->p_memsz = alignTo(P->p_memsz, P->p_align); - } } } diff --git a/test/ELF/aarch64-cortex-a53-843419-tlsrelax.s b/test/ELF/aarch64-cortex-a53-843419-tlsrelax.s index 2db5c7e36..bff72d372 100644 --- a/test/ELF/aarch64-cortex-a53-843419-tlsrelax.s +++ b/test/ELF/aarch64-cortex-a53-843419-tlsrelax.s @@ -26,9 +26,9 @@ _start: // CHECK: _start: // CHECK-NEXT: 210ff8: 41 d0 3b d5 mrs x1, TPIDR_EL0 // CHECK-NEXT: 210ffc: 00 00 a0 d2 movz x0, #0, lsl #16 -// CHECK-NEXT: 211000: 01 08 80 f2 movk x1, #64 +// CHECK-NEXT: 211000: 01 02 80 f2 movk x1, #16 // CHECK-NEXT: 211004: 00 00 a0 d2 movz x0, #0, lsl #16 -// CHECK-NEXT: 211008: 01 08 80 f2 movk x1, #64 +// CHECK-NEXT: 211008: 01 02 80 f2 movk x1, #16 // CHECK-NEXT: 21100c: c0 03 5f d6 ret .type v,@object diff --git a/test/ELF/aarch64-gnu-ifunc-address.s b/test/ELF/aarch64-gnu-ifunc-address.s deleted file mode 100644 index 9321fe35e..000000000 --- a/test/ELF/aarch64-gnu-ifunc-address.s +++ /dev/null @@ -1,40 +0,0 @@ -# REQUIRES: aarch64 -# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %s -o %t.o -# RUN: ld.lld -shared %t.o -o %tout -# RUN: llvm-objdump -D %tout | FileCheck %s -# RUN: llvm-readobj -r %tout | FileCheck %s --check-prefix=CHECK-RELOCS - -# Test that when we take the address of a preemptible ifunc in a shared object -# we get R_AARCH64_GLOB_DAT to the symbol as it could be defined in another -# link unit and preempt our definition. -.text -.globl myfunc -.type myfunc,@gnu_indirect_function -myfunc: - ret - -.text -.globl main -.type main,@function -main: - adrp x8, :got:myfunc - ldr x8, [x8, :got_lo12:myfunc] - ret -# CHECK: 0000000000010004 main: -# x8 = 0x30000 -# CHECK-NEXT: 10004: 08 01 00 90 adrp x8, #131072 -# x8 = 0x300e0 = .got entry for myfunc with R_AARCH64_GLOB_DAT -# CHECK-NEXT: 10008: 08 71 40 f9 ldr x8, [x8, #224] -# CHECK-NEXT: 1000c: c0 03 5f d6 ret - -# CHECK: Disassembly of section .got: -# CHECK-NEXT: 00000000000300e0 .got: - -# CHECK-RELOCS: Relocations [ -# CHECK-RELOCS-NEXT: Section {{.*}} .rela.dyn { -# CHECK-RELOCS-NEXT: 0x300E0 R_AARCH64_GLOB_DAT myfunc 0x0 -# CHECK-RELOCS-NEXT: } -# CHECK-RELOCS-NEXT: Section {{.*}} .rela.plt { -# CHECK-RELOCS-NEXT: 0x20018 R_AARCH64_JUMP_SLOT myfunc 0x0 -# CHECK-RELOCS-NEXT: } -# CHECK-RELOCS-NEXT: ] diff --git a/test/ELF/aarch64-tls-gdle.s b/test/ELF/aarch64-tls-gdle.s index 882ec8c1a..e91d3976d 100644 --- a/test/ELF/aarch64-tls-gdle.s +++ b/test/ELF/aarch64-tls-gdle.s @@ -5,15 +5,15 @@ # RUN: llvm-objdump -d %tout | FileCheck %s # RUN: llvm-readobj -s -r %tout | FileCheck -check-prefix=RELOC %s -#Local-Dynamic to Local-Exec relax creates no +#Local-Dynamic to Initial-Exec relax creates no #RELOC: Relocations [ #RELOC-NEXT: ] -# TCB size = 64 and foo is first element from TLS register. +# TCB size = 0x16 and foo is first element from TLS register. # CHECK: Disassembly of section .text: # CHECK: _start: # CHECK: 210000: 00 00 a0 d2 movz x0, #0, lsl #16 -# CHECK: 210004: 00 08 80 f2 movk x0, #64 +# CHECK: 210004: 00 02 80 f2 movk x0, #16 # CHECK: 210008: 1f 20 03 d5 nop # CHECK: 21000c: 1f 20 03 d5 nop diff --git a/test/ELF/aarch64-tls-iele.s b/test/ELF/aarch64-tls-iele.s index 0229d6676..9fec4ee7d 100644 --- a/test/ELF/aarch64-tls-iele.s +++ b/test/ELF/aarch64-tls-iele.s @@ -9,13 +9,13 @@ # RELOC: Relocations [ # RELOC-NEXT: ] -# TCB size = 64 and foo is first element from TLS register. +# TCB size = 0x16 and foo is first element from TLS register. # CHECK: Disassembly of section .text: # CHECK: _start: # CHECK-NEXT: 210000: 00 00 a0 d2 movz x0, #0, lsl #16 -# CHECK-NEXT: 210004: 80 08 80 f2 movk x0, #68 +# CHECK-NEXT: 210004: 80 02 80 f2 movk x0, #20 # CHECK-NEXT: 210008: 00 00 a0 d2 movz x0, #0, lsl #16 -# CHECK-NEXT: 21000c: 00 08 80 f2 movk x0, #64 +# CHECK-NEXT: 21000c: 00 02 80 f2 movk x0, #16 .section .tdata .align 2 diff --git a/test/ELF/aarch64-tls-le.s b/test/ELF/aarch64-tls-le.s index 49c322fac..85cd3beac 100644 --- a/test/ELF/aarch64-tls-le.s +++ b/test/ELF/aarch64-tls-le.s @@ -4,7 +4,7 @@ # RUN: llvm-objdump -d %tout | FileCheck %s # RUN: llvm-readobj -s -r %tout | FileCheck -check-prefix=RELOC %s -#Local-Dynamic to Local-Exec relax creates no +#Local-Dynamic to Initial-Exec relax creates no #RELOC: Relocations [ #RELOC-NEXT: ] @@ -17,12 +17,12 @@ _start: add x0, x0, :tprel_hi12:v2 add x0, x0, :tprel_lo12_nc:v2 -# TCB size = 64 and foo is first element from TLS register. +# TCB size = 0x16 and foo is first element from TLS register. #CHECK: Disassembly of section .text: #CHECK: _start: #CHECK: 210000: 40 d0 3b d5 mrs x0, TPIDR_EL0 #CHECK: 210004: 00 00 40 91 add x0, x0, #0, lsl #12 -#CHECK: 210008: 00 00 01 91 add x0, x0, #64 +#CHECK: 210008: 00 40 00 91 add x0, x0, #16 #CHECK: 21000c: 40 d0 3b d5 mrs x0, TPIDR_EL0 #CHECK: 210010: 00 fc 7f 91 add x0, x0, #4095, lsl #12 #CHECK: 210014: 00 e0 3f 91 add x0, x0, #4088 @@ -36,9 +36,9 @@ v1: .word 0 .size v1, 4 -# The current offset from the thread pointer is 68. Raise it to just below the +# The current offset from the thread pointer is 20. Raise it to just below the # 24-bit limit. -.space (0xfffff8 - 68) +.space (0xfffff8 - 20) .type v2,@object .globl v2 diff --git a/test/ELF/aarch64-tlsld-ldst.s b/test/ELF/aarch64-tlsld-ldst.s index 8ebdc2f15..3144ca5d9 100644 --- a/test/ELF/aarch64-tlsld-ldst.s +++ b/test/ELF/aarch64-tlsld-ldst.s @@ -26,27 +26,27 @@ _start: mrs x8, TPIDR_EL0 // CHECK: _start: // CHECK-NEXT: 210000: 48 d0 3b d5 mrs x8, TPIDR_EL0 -// 0x0 + c40 = 0xc40 = tcb (64-bytes) + var0 -// CHECK-NEXT: 210004: 08 01 40 91 add x8, x8, #0, lsl #12 -// CHECK-NEXT: 210008: 14 11 c3 3d ldr q20, [x8, #3136] -// 0x1000 + 0x850 = 0x1850 = tcb + var1 -// CHECK-NEXT: 21000c: 08 05 40 91 add x8, x8, #1, lsl #12 -// CHECK-NEXT: 210010: 00 29 44 f9 ldr x0, [x8, #2128] -// 0x2000 + 0x458 = 0x2458 = tcb + var2 -// CHECK-NEXT: 210014: 08 09 40 91 add x8, x8, #2, lsl #12 -// CHECK-NEXT: 210018: 00 59 44 b9 ldr w0, [x8, #1112] -// 0x3000 + 0x5c = 0x305c = tcb + var3 -// CHECK-NEXT: 21001c: 08 0d 40 91 add x8, x8, #3, lsl #12 -// CHECK-NEXT: 210020: 00 b9 40 79 ldrh w0, [x8, #92] -// 0x3000 + 0xc5e = 0x3c5e = tcb + var4 -// CHECK-NEXT: 210024: 08 0d 40 91 add x8, x8, #3, lsl #12 -// CHECK-NEXT: 210028: 00 79 71 39 ldrb w0, [x8, #3166] +// 0x0 + c10 = 0xc10 = tcb (16-bytes) + var0 +// CHECK-NEXT: 210004: 08 01 40 91 add x8, x8, #0, lsl #12 +// CHECK-NEXT: 210008: 14 05 c3 3d ldr q20, [x8, #3088] +// 0x1000 + 0x820 = 0x1820 = tcb + var1 +// CHECK-NEXT: 21000c: 08 05 40 91 add x8, x8, #1, lsl #12 +// CHECK-NEXT: 210010: 00 11 44 f9 ldr x0, [x8, #2080] +// 0x2000 + 0x428 = 0x2428 = tcb + var2 +// CHECK-NEXT: 210014: 08 09 40 91 add x8, x8, #2, lsl #12 +// CHECK-NEXT: 210018: 00 29 44 b9 ldr w0, [x8, #1064] +// 0x3000 + 0x2c = 0x302c = tcb + var3 +// CHECK-NEXT: 21001c: 08 0d 40 91 add x8, x8, #3, lsl #12 +// CHECK-NEXT: 210020: 00 59 40 79 ldrh w0, [x8, #44] +// 0x3000 + 0xc2e = 0x32ce = tcb + var4 +// CHECK-NEXT: 210024: 08 0d 40 91 add x8, x8, #3, lsl #12 +// CHECK-NEXT: 210028: 00 b9 70 39 ldrb w0, [x8, #3118] -// CHECK-SYMS: 0000000000000c00 16 TLS GLOBAL DEFAULT 2 var0 -// CHECK-SYMS-NEXT: 0000000000001810 8 TLS GLOBAL DEFAULT 2 var1 -// CHECK-SYMS-NEXT: 0000000000002418 4 TLS GLOBAL DEFAULT 2 var2 -// CHECK-SYMS-NEXT: 000000000000301c 2 TLS GLOBAL DEFAULT 2 var3 -// CHECK-SYMS-NEXT: 0000000000003c1e 1 TLS GLOBAL DEFAULT 2 var4 +// CHECK-SYMS: 0000000000000c00 0 TLS GLOBAL DEFAULT 2 var0 +// CHECK-SYMS-NEXT: 0000000000001810 4 TLS GLOBAL DEFAULT 2 var1 +// CHECK-SYMS-NEXT: 0000000000002418 2 TLS GLOBAL DEFAULT 2 var2 +// CHECK-SYMS-NEXT: 000000000000301c 1 TLS GLOBAL DEFAULT 2 var3 +// CHECK-SYMS-NEXT: 0000000000003c1e 0 TLS GLOBAL DEFAULT 2 var4 .globl var0 .globl var1 @@ -59,12 +59,12 @@ _start: mrs x8, TPIDR_EL0 .type var3,@object .section .tbss,"awT",@nobits - .balign 64 + .balign 16 .space 1024 * 3 var0: .quad 0 .quad 0 - .size var0, 16 + .size var1, 16 .space 1024 * 3 var1: .quad 0 @@ -72,14 +72,14 @@ var1: .space 1024 * 3 var2: .word 0 - .size var2, 4 + .size var1, 4 .space 1024 * 3 var3: .hword 0 - .size var3, 2 + .size var2, 2 .space 1024 * 3 var4: .byte 0 - .size var4, 1 + .size var3, 1 .space 1024 * 3 diff --git a/test/ELF/arm-gnu-ifunc.s b/test/ELF/arm-gnu-ifunc.s index 92f87b5d5..8a7cb0ae2 100644 --- a/test/ELF/arm-gnu-ifunc.s +++ b/test/ELF/arm-gnu-ifunc.s @@ -35,8 +35,6 @@ _start: // CHECK-NEXT: Address: 0x100F4 // CHECK-NEXT: Offset: 0xF4 // CHECK-NEXT: Size: 16 -// CHECK-NEXT: Link: -// CHECK-NEXT: Info: 4 // CHECK: Name: .plt // CHECK-NEXT: Type: SHT_PROGBITS // CHECK-NEXT: Flags [ @@ -46,8 +44,7 @@ _start: // CHECK-NEXT: Address: 0x11020 // CHECK-NEXT: Offset: 0x1020 // CHECK-NEXT: Size: 32 -// CHECK: Index: 4 -// CHECK-NEXT: Name: .got +// CHECK: Name: .got // CHECK-NEXT: Type: SHT_PROGBITS // CHECK-NEXT: Flags [ // CHECK-NEXT: SHF_ALLOC diff --git a/test/ELF/arm-tls-le32.s b/test/ELF/arm-tls-le32.s index f9a5fa9b2..7834dedf1 100644 --- a/test/ELF/arm-tls-le32.s +++ b/test/ELF/arm-tls-le32.s @@ -69,9 +69,9 @@ x: // CHECK: Disassembly of section .text: // CHECK-NEXT: _start: -// offset of x from Thread pointer = (TcbSize + 0x0 = 0x20) -// CHECK-NEXT: 11000: 20 00 00 00 -// offset of z from Thread pointer = (TcbSize + 0x8 = 0x28) -// CHECK-NEXT: 11004: 28 00 00 00 -// offset of y from Thread pointer = (TcbSize + 0x4 = 0x24) -// CHECK-NEXT: 11008: 24 00 00 00 +// offset of x from Thread pointer = (TcbSize + 0x0 = 0x8) +// CHECK-NEXT: 11000: 08 00 00 00 +// offset of z from Thread pointer = (TcbSize + 0x8 = 0x10) +// CHECK-NEXT: 11004: 10 00 00 00 +// offset of y from Thread pointer = (TcbSize + 0x4 = 0xc) +// CHECK-NEXT: 11008: 0c 00 00 00 diff --git a/test/ELF/arm-tls-norelax-ie-le.s b/test/ELF/arm-tls-norelax-ie-le.s index 11c3e4f5d..be8af9760 100644 --- a/test/ELF/arm-tls-norelax-ie-le.s +++ b/test/ELF/arm-tls-norelax-ie-le.s @@ -37,5 +37,5 @@ x2: .type x2, %object // CHECK: Contents of section .got: -// x1 at offset 0x20 from TP, x2 at offset 0x24 from TP. Offsets include TCB size of 0x20 -// CHECK-NEXT: 13064 20000000 24000000 +// x1 at offset 8 from TP, x2 at offset c from TP. Offsets include TCB size of 8 +// CHECK-NEXT: 13064 08000000 0c000000 diff --git a/test/ELF/comdat-linkonce.s b/test/ELF/comdat-linkonce.s index 8b1d4b362..8721f58bb 100644 --- a/test/ELF/comdat-linkonce.s +++ b/test/ELF/comdat-linkonce.s @@ -4,12 +4,7 @@ // RUN: ld.lld -shared %t.o %t2.o -o %t // RUN: ld.lld -shared %t2.o %t.o -o %t -.section .gnu.linkonce.t.__x86.get_pc_thunk.bx +.section .gnu.linkonce.t.zed .globl abc abc: nop - -.section .gnu.linkonce.t.__i686.get_pc_thunk.bx -.globl def -def: -nop diff --git a/test/ELF/gnu-ifunc-empty.s b/test/ELF/gnu-ifunc-empty.s deleted file mode 100644 index 90798532f..000000000 --- a/test/ELF/gnu-ifunc-empty.s +++ /dev/null @@ -1,16 +0,0 @@ -// REQUIRES: x86 - -// Verifies that .rela_iplt_{start,end} point to a dummy section -// if .rela.iplt does not exist. - -// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o -// RUN: ld.lld -static %t.o -o %t.exe -// RUN: llvm-objdump -syms %t.exe | FileCheck %s - -// CHECK: 0000000000200000 .text 00000000 .hidden __rela_iplt_end -// CHECK: 0000000000200000 .text 00000000 .hidden __rela_iplt_start - -.globl _start -_start: - movl $__rela_iplt_start, %edx - movl $__rela_iplt_end, %edx diff --git a/test/ELF/no-discard-this_module.s b/test/ELF/no-discard-this_module.s deleted file mode 100644 index 3ce56d165..000000000 --- a/test/ELF/no-discard-this_module.s +++ /dev/null @@ -1,41 +0,0 @@ -// REQUIRES: x86 -// RUN: llvm-mc -filetype=obj -triple=x86_64-linux-gnu -save-temp-labels %s -o %t -// RUN: ld.lld %t -o %t2 -// RUN: llvm-readobj -s -sd -t %t2 | FileCheck %s - -.global _start -_start: - -// This section and symbol is used by Linux kernel modules. Ensure it's not -// accidentally discarded. -.section .gnu.linkonce.this_module: -__this_module: -.byte 0x00 - -// CHECK: Section { -// CHECK: Index: -// CHECK: Name: .gnu.linkonce.this_module -// CHECK-NEXT: Type: SHT_PROGBITS -// CHECK-NEXT: Flags [ -// CHECK-NEXT: ] -// CHECK-NEXT: Address: -// CHECK-NEXT: Offset: -// CHECK-NEXT: Size: -// CHECK-NEXT: Link: -// CHECK-NEXT: Info: -// CHECK-NEXT: AddressAlignment: -// CHECK-NEXT: EntrySize: -// CHECK-NEXT: SectionData ( -// CHECK-NEXT: 0000: 00 |.| -// CHECK-NEXT: ) -// CHECK-NEXT: } - -// CHECK: Symbol { -// CHECK: Name: __this_module -// CHECK-NEXT: Value: -// CHECK-NEXT: Size: -// CHECK-NEXT: Binding: Local -// CHECK-NEXT: Type: None -// CHECK-NEXT: Other: -// CHECK-NEXT: Section: .gnu.linkonce.this_module: -// CHECK-NEXT: } diff --git a/test/ELF/shlib-undefined-archive.s b/test/ELF/shlib-undefined-archive.s new file mode 100644 index 000000000..940d8d7bc --- /dev/null +++ b/test/ELF/shlib-undefined-archive.s @@ -0,0 +1,19 @@ +# REQUIRES: x86 + +# Undefined symbols in a DSO should pull out object files from archives +# to resolve them. + +# RUN: echo '.globl foo' | llvm-mc -filetype=obj -triple=x86_64-linux-gnu -o %t1.o - +# RUN: ld.lld -shared -o %t.so %t1.o + +# RUN: llvm-mc -filetype=obj -triple=x86_64-linux-gnu -o %t2.o %s +# RUN: rm -f %t.a +# RUN: llvm-ar cru %t.a %t2.o +# RUN: ld.lld -o %t.exe %t.so %t.a +# RUN: llvm-nm -D %t.exe | FileCheck %s + +# CHECK: T foo + +.globl foo +foo: + ret diff --git a/test/ELF/trace-symbols.s b/test/ELF/trace-symbols.s index 58aeb5d3d..63004b7c1 100644 --- a/test/ELF/trace-symbols.s +++ b/test/ELF/trace-symbols.s @@ -72,7 +72,7 @@ # RUN: ld.lld -y foo -y bar %t %t1.so %t2.so -o %t3 | \ # RUN: FileCheck -check-prefix=SHLIBRBAR %s -# SHLIBRBAR-NOT: trace-symbols.s.tmp1.so: reference to bar +# SHLIBRBAR: trace-symbols.s.tmp1.so: reference to bar # RUN: ld.lld -y foo -y bar %t -u bar --start-lib %t1 %t2 --end-lib -o %t3 | \ # RUN: FileCheck -check-prefix=STARTLIB %s |