StringSwitch<std::pair<ELFKind, uint16_t>>(S)
.Case("aarch64linux", {ELF64LEKind, EM_AARCH64})
.Case("armelf_linux_eabi", {ELF32LEKind, EM_ARM})
+ .Case("elf32_x86_64", {ELF32LEKind, EM_X86_64})
.Case("elf32btsmip", {ELF32BEKind, EM_MIPS})
.Case("elf32ltsmip", {ELF32LEKind, EM_MIPS})
.Case("elf32ppc", {ELF32BEKind, EM_PPC})
LinkerScript<ELFT> LS;
Script<ELFT>::X = &LS;
- Config->Rela = ELFT::Is64Bits;
+ Config->Rela = ELFT::Is64Bits || Config->EMachine == EM_X86_64;
Config->Mips64EL =
(Config->EMachine == EM_MIPS && Config->EKind == ELF64LEKind);
# X86-64-NEXT: StringTableSectionIndex:
# X86-64-NEXT: }
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux-gnux32 %s -o %tx32
+# RUN: ld.lld -m elf32_x86_64 %tx32 -o %t2x32
+# RUN: llvm-readobj -file-headers %t2x32 | FileCheck --check-prefix=X32 %s
+# RUN: ld.lld %tx32 -o %t3x32
+# RUN: llvm-readobj -file-headers %t3x32 | FileCheck --check-prefix=X32 %s
+# X32: ElfHeader {
+# X32-NEXT: Ident {
+# X32-NEXT: Magic: (7F 45 4C 46)
+# X32-NEXT: Class: 32-bit (0x1)
+# X32-NEXT: DataEncoding: LittleEndian (0x1)
+# X32-NEXT: FileVersion: 1
+# X32-NEXT: OS/ABI: SystemV (0x0)
+# X32-NEXT: ABIVersion: 0
+# X32-NEXT: Unused: (00 00 00 00 00 00 00)
+# X32-NEXT: }
+# X32-NEXT: Type: Executable (0x2)
+# X32-NEXT: Machine: EM_X86_64 (0x3E)
+# X32-NEXT: Version: 1
+# X32-NEXT: Entry:
+# X32-NEXT: ProgramHeaderOffset: 0x34
+# X32-NEXT: SectionHeaderOffset:
+# X32-NEXT: Flags [ (0x0)
+# X32-NEXT: ]
+# X32-NEXT: HeaderSize: 52
+# X32-NEXT: ProgramHeaderEntrySize: 32
+# X32-NEXT: ProgramHeaderCount:
+# X32-NEXT: SectionHeaderEntrySize: 40
+# X32-NEXT: SectionHeaderCount:
+# X32-NEXT: StringTableSectionIndex:
+# X32-NEXT: }
+
# RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %tx86
# RUN: ld.lld -m elf_i386 %tx86 -o %t2x86
# RUN: llvm-readobj -file-headers %t2x86 | FileCheck --check-prefix=X86 %s
--- /dev/null
+// REQUIRES: x86
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+// RUN: ld.lld %t.o -o %t.so -shared
+// RUN: llvm-readobj -dynamic-table %t.so | FileCheck %s
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux-gnux32 %s -o %t.o
+// RUN: ld.lld %t.o -o %t.so -shared
+// RUN: llvm-readobj -dynamic-table %t.so | FileCheck %s
+
+ call foo@plt
+
+// CHECK: 0x{{0+}}14 PLTREL{{ +}}RELA