Index: lld/trunk/lld-2018June4 =================================================================== --- lld/trunk/lld-2018June4 +++ lld/trunk/lld-2018June4 @@ -0,0 +1,5797 @@ +Index: test/COFF/associative-comdat.s +=================================================================== +--- test/COFF/associative-comdat.s (revision 333896) ++++ test/COFF/associative-comdat.s (working copy) +@@ -1,47 +1,48 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple=x86_64-windows-msvc %s -filetype=obj -o %t1.obj + # RUN: llvm-mc -triple=x86_64-windows-msvc %S/Inputs/associative-comdat-2.s -filetype=obj -o %t2.obj + + # RUN: lld-link -entry:main %t1.obj %t2.obj -out:%t.gc.exe + # RUN: llvm-readobj -sections %t.gc.exe | FileCheck %s + + # RUN: lld-link -entry:main %t1.obj %t2.obj -opt:noref -out:%t.nogc.exe + # RUN: llvm-readobj -sections %t.nogc.exe | FileCheck %s + + # CHECK: Sections [ + # CHECK: Section { + # CHECK: Number: 2 + # CHECK-LABEL: Name: .rdata (2E 72 64 61 74 61 00 00) + # This is the critical check to show that only *one* definition of + # foo_assoc was retained. This *must* be 8, not 16. + # CHECK-NEXT: VirtualSize: 0x8 + # CHECK: Section { + # CHECK: Number: 3 + # CHECK-LABEL: Name: .data (2E 64 61 74 61 00 00 00) + # CHECK-NEXT: VirtualSize: 0x4 + + .text + .def main; + .scl 2; + .type 32; + .endef + .globl main # -- Begin function main + .p2align 4, 0x90 + main: # @main + # BB#0: + movl foo(%rip), %eax + retq + # -- End function + + # Defines foo and foo_assoc globals. foo is comdat, and foo_assoc is comdat + # associative with it. foo_assoc should be discarded iff foo is discarded, + # either by linker GC or normal comdat merging. + + .section .rdata,"dr",associative,foo + .p2align 3 + .quad foo + + .section .data,"dw",discard,foo + .globl foo # @foo + .p2align 2 + foo: + .long 42 +Index: test/COFF/dll.test +=================================================================== +--- test/COFF/dll.test (revision 333896) ++++ test/COFF/dll.test (working copy) +@@ -1,50 +1,51 @@ ++# REQUIRES: x86 + # RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj + # RUN: lld-link /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2 \ + # RUN: /export:mangled + # RUN: llvm-objdump -p %t.dll | FileCheck -check-prefix=EXPORT %s + + EXPORT: Export Table: + EXPORT: DLL name: dll.test.tmp.dll + EXPORT: Ordinal RVA Name + EXPORT-NEXT: 0 0 + EXPORT-NEXT: 1 0x1008 exportfn1 + EXPORT-NEXT: 2 0x1010 exportfn2 + EXPORT-NEXT: 3 0x1010 exportfn3 + EXPORT-NEXT: 4 0x1010 mangled + + # RUN: yaml2obj < %p/Inputs/export2.yaml > %t5.obj + # RUN: rm -f %t5.lib + # RUN: llvm-ar cru %t5.lib %t5.obj + # RUN: lld-link /out:%t5.dll /dll %t.obj %t5.lib /export:mangled2 + # RUN: llvm-objdump -p %t5.dll | FileCheck -check-prefix=EXPORT2 %s + + EXPORT2: Export Table: + EXPORT2: DLL name: dll.test.tmp5.dll + EXPORT2: Ordinal RVA Name + EXPORT2-NEXT: 0 0 + EXPORT2-NEXT: 1 0x1010 exportfn3 + EXPORT2-NEXT: 2 0x101c mangled2 + + # RUN: llvm-as -o %t.lto.obj %p/Inputs/export.ll + # RUN: lld-link -opt:noicf /out:%t.lto.dll /dll %t.lto.obj /export:exportfn1 /export:exportfn2 + # RUN: llvm-objdump -p %t.lto.dll | FileCheck -check-prefix=EXPORT-LTO %s + + EXPORT-LTO: Export Table: + EXPORT-LTO: DLL name: dll.test.tmp.lto.dll + EXPORT-LTO: Ordinal RVA Name + EXPORT-LTO-NEXT: 0 0 + EXPORT-LTO-NEXT: 1 0x1010 exportfn1 + EXPORT-LTO-NEXT: 2 0x1020 exportfn2 + EXPORT-LTO-NEXT: 3 0x1030 exportfn3 + + # RUN: lld-link /out:%t.dll /dll %t.obj /implib:%t2.lib \ + # RUN: /export:exportfn1 /export:exportfn2 + # RUN: yaml2obj < %p/Inputs/import.yaml > %t2.obj + # RUN: lld-link /out:%t2.exe /entry:main %t2.obj %t2.lib + # RUN: llvm-readobj -coff-imports %t2.exe | FileCheck -check-prefix=IMPORT %s + + # RUN: lld-link /out:%t2.lto.exe /entry:main %t2.obj %t.lto.lib + # RUN: llvm-readobj -coff-imports %t2.lto.exe | FileCheck -check-prefix=IMPORT %s + + IMPORT: Symbol: exportfn1 + IMPORT: Symbol: exportfn2 +Index: test/COFF/dllexport-mingw.s +=================================================================== +--- test/COFF/dllexport-mingw.s (revision 333896) ++++ test/COFF/dllexport-mingw.s (working copy) +@@ -1,24 +1,24 @@ +-# REQEUIRES: x86 ++# REQUIRES: x86 + + # RUN: llvm-mc -triple=i686-windows-gnu %s -filetype=obj -o %t.obj + + # RUN: lld-link -lldmingw -dll -out:%t.dll -entry:main %t.obj -implib:%t.lib + # RUN: llvm-readobj %t.lib | FileCheck %s + + # CHECK: Symbol: __imp___underscoredFunc + # CHECK: Symbol: __underscoredFunc + # CHECK: Symbol: __imp__func + # CHECK: Symbol: _func + + .global _main + .global _func + .global __underscoredFunc + .text + _main: + ret + _func: + ret + __underscoredFunc: + ret + .section .drectve + .ascii "-export:func -export:_underscoredFunc" +Index: test/COFF/duplicate.test +=================================================================== +--- test/COFF/duplicate.test (revision 333896) ++++ test/COFF/duplicate.test (working copy) +@@ -1,12 +1,13 @@ ++# REQUIRES: x86 + RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o alpha.obj %S/Inputs/alpha.ll + RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o beta.obj %S/Inputs/beta.ll + RUN: lld-link /out:alpha.dll /dll alpha.obj /implib:alpha.lib + RUN: not lld-link /out:beta.dll /dll alpha.obj beta.obj alpha.lib 2>&1 | FileCheck %s -check-prefix CHECK-ALPHA + + CHECK-ALPHA: error: duplicate symbol: f in {{.*}}alpha.obj and in alpha.dll + + RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o gamma.obj %S/Inputs/gamma.ll + RUN: not lld-link /out:gamma.exe /subsystem:console /entry:mainCRTStartup gamma.obj alpha.lib 2>&1 | FileCheck %s -check-prefix CHECK-GAMMA + + CHECK-GAMMA: error: duplicate symbol: __imp_f in {{.*}}gamma.obj and in alpha.dll + +Index: test/COFF/export-all.s +=================================================================== +--- test/COFF/export-all.s (revision 333896) ++++ test/COFF/export-all.s (working copy) +@@ -1,86 +1,86 @@ +-# REQEUIRES: x86 ++# REQUIRES: x86 + + # RUN: llvm-mc -triple=i686-windows-gnu %s -filetype=obj -o %t.obj + + # RUN: lld-link -lldmingw -dll -out:%t.dll -entry:DllMainCRTStartup@12 %t.obj -implib:%t.lib + # RUN: llvm-readobj -coff-exports %t.dll | FileCheck %s + # RUN: llvm-readobj %t.lib | FileCheck -check-prefix=IMPLIB %s + + # CHECK-NOT: Name: DllMainCRTStartup + # CHECK-NOT: Name: _imp__unexported + # CHECK: Name: dataSym + # CHECK: Name: foobar + # CHECK-NOT: Name: unexported + + # IMPLIB: Symbol: __imp__dataSym + # IMPLIB-NOT: Symbol: _dataSym + # IMPLIB: Symbol: __imp__foobar + # IMPLIB: Symbol: _foobar + + .global _foobar + .global _DllMainCRTStartup@12 + .global _dataSym + .global _unexported + .global __imp__unexported + .text + _DllMainCRTStartup@12: + ret + _foobar: + ret + _unexported: + ret + .data + _dataSym: + .int 4 + __imp__unexported: + .int _unexported + + # Test specifying -export-all-symbols, on an object file that contains + # dllexport directive for some of the symbols. + + # RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj + # + # RUN: lld-link -out:%t.dll -dll %t.obj -lldmingw -export-all-symbols -output-def:%t.def + # RUN: llvm-readobj -coff-exports %t.dll | FileCheck -check-prefix=CHECK2 %s + # RUN: cat %t.def | FileCheck -check-prefix=CHECK2-DEF %s + + # Note, this will actually export _DllMainCRTStartup as well, since + # it uses the standard spelling in this object file, not the MinGW one. + + # CHECK2: Name: exportfn1 + # CHECK2: Name: exportfn2 + # CHECK2: Name: exportfn3 + + # CHECK2-DEF: EXPORTS + # CHECK2-DEF: exportfn1 @3 + # CHECK2-DEF: exportfn2 @4 + # CHECK2-DEF: exportfn3 @5 + + # Test ignoring certain object files and libs. + + # RUN: echo -e ".global foobar\n.global DllMainCRTStartup\n.text\nDllMainCRTStartup:\nret\nfoobar:\ncall mingwfunc\ncall crtfunc\nret\n" > %t.main.s + # RUN: llvm-mc -triple=x86_64-windows-gnu %t.main.s -filetype=obj -o %t.main.obj + # RUN: mkdir -p %T/libs + # RUN: echo -e ".global mingwfunc\n.text\nmingwfunc:\nret\n" > %T/libs/mingwfunc.s + # RUN: llvm-mc -triple=x86_64-windows-gnu %T/libs/mingwfunc.s -filetype=obj -o %T/libs/mingwfunc.o + # RUN: llvm-ar rcs %T/libs/libmingwex.a %T/libs/mingwfunc.o + # RUN: echo -e ".global crtfunc\n.text\ncrtfunc:\nret\n" > %T/libs/crtfunc.s + # RUN: llvm-mc -triple=x86_64-windows-gnu %T/libs/crtfunc.s -filetype=obj -o %T/libs/crt2.o + # RUN: lld-link -out:%t.dll -dll -entry:DllMainCRTStartup %t.main.obj -lldmingw %T/libs/crt2.o %T/libs/libmingwex.a -output-def:%t.def + # RUN: echo "EOF" >> %t.def + # RUN: cat %t.def | FileCheck -check-prefix=CHECK-EXCLUDE %s + + # CHECK-EXCLUDE: EXPORTS + # CHECK-EXCLUDE-NEXT: foobar @1 + # CHECK-EXCLUDE-NEXT: EOF + + # Test that we handle import libraries together with -opt:noref. + + # RUN: yaml2obj < %p/Inputs/hello32.yaml > %t.obj + # RUN: lld-link -lldmingw -dll -out:%t.dll -entry:main@0 %t.obj -implib:%t.lib -opt:noref %p/Inputs/std32.lib -output-def:%t.def + # RUN: echo "EOF" >> %t.def + # RUN: cat %t.def | FileCheck -check-prefix=CHECK-IMPLIB %s + + # CHECK-IMPLIB: EXPORTS + # CHECK-IMPLIB-NEXT: main@0 @1 + # CHECK-IMPLIB-NEXT: EOF +Index: test/COFF/gfids-corrupt.s +=================================================================== +--- test/COFF/gfids-corrupt.s (revision 333896) ++++ test/COFF/gfids-corrupt.s (working copy) +@@ -1,83 +1,84 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj + # RUN: lld-link %t.obj -opt:noref -guard:nolongjmp -out:%t.exe -entry:main 2>&1 | FileCheck %s --check-prefix=ERRS + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s + + # ERRS: warning: ignoring .gfids$y symbol table index section in object {{.*}}gfids-corrupt{{.*}} + # ERRS: warning: ignoring invalid symbol table index in section .gfids$y in object {{.*}}gfids-corrupt{{.*}} + + # The table is arbitrary, really. + # CHECK: ImageBase: 0x140000000 + # CHECK: LoadConfig [ + # CHECK: SEHandlerTable: 0x0 + # CHECK: SEHandlerCount: 0 + # CHECK: GuardCFCheckFunction: 0x0 + # CHECK: GuardCFCheckDispatch: 0x0 + # CHECK: GuardCFFunctionTable: 0x14000{{.*}} + # CHECK: GuardCFFunctionCount: 2 + # CHECK: GuardFlags: 0x500 + # CHECK: GuardAddressTakenIatEntryTable: 0x0 + # CHECK: GuardAddressTakenIatEntryCount: 0 + # CHECK: GuardLongJumpTargetTable: 0x0 + # CHECK: GuardLongJumpTargetCount: 0 + # CHECK: ] + # CHECK: GuardFidTable [ + # CHECK-NEXT: 0x14000{{.*}} + # CHECK-NEXT: 0x14000{{.*}} + # CHECK-NEXT: ] + + + # Indicate that gfids are present. + .def @feat.00; .scl 3; .type 0; .endef + .globl @feat.00 + @feat.00 = 0x800 + + .def f1; .scl 2; .type 32; .endef + .section .text,"xr",one_only,f1 + .global f1 + f1: + movl $42, %eax + retq + + .def f2; .scl 2; .type 32; .endef + .section .text,"xr",one_only,f2 + .global f2 + f2: + movl $13, %eax + retq + + .section .data,"dw",one_only,fp1 + .globl fp1 + fp1: + .quad f1 + + .section .data,"dw",one_only,fp2 + .globl fp2 + fp2: + .quad f2 + + .section .gfids$y,"dr",associative,fp1 + .symidx f1 + .byte 0 + + .section .gfids$y,"dr",associative,fp2 + .symidx f2 + .long 0x400 + + .def main; .scl 2; .type 32; .endef + .section .text,"xr",one_only,main + .globl main + main: + callq *fp1(%rip) + callq *fp2(%rip) + xor %eax, %eax + retq + + .section .rdata,"dr" + .globl _load_config_used + _load_config_used: + .long 256 + .fill 124, 1, 0 + .quad __guard_fids_table + .quad __guard_fids_count + .long __guard_flags + .fill 128, 1, 0 +Index: test/COFF/gfids-fallback.s +=================================================================== +--- test/COFF/gfids-fallback.s (revision 333896) ++++ test/COFF/gfids-fallback.s (working copy) +@@ -1,96 +1,97 @@ ++# REQUIRES: x86 + # RUN: grep -B99999 [S]PLITMARKER %s | llvm-mc -triple x86_64-windows-msvc -filetype=obj -o %t1.obj + # RUN: grep -A99999 [S]PLITMARKER %s | llvm-mc -triple x86_64-windows-msvc -filetype=obj -o %t2.obj + # RUN: lld-link %t1.obj %t2.obj -guard:nolongjmp -out:%t.exe -entry:main -opt:noref + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s + + # CHECK: ImageBase: 0x140000000 + # CHECK: LoadConfig [ + # CHECK: SEHandlerTable: 0x0 + # CHECK: SEHandlerCount: 0 + # CHECK: GuardCFCheckFunction: 0x0 + # CHECK: GuardCFCheckDispatch: 0x0 + # CHECK: GuardCFFunctionTable: 0x14000{{.*}} + # CHECK: GuardCFFunctionCount: 3 + # CHECK: GuardFlags: 0x500 + # CHECK: GuardAddressTakenIatEntryTable: 0x0 + # CHECK: GuardAddressTakenIatEntryCount: 0 + # CHECK: GuardLongJumpTargetTable: 0x0 + # CHECK: GuardLongJumpTargetCount: 0 + # CHECK: ] + # CHECK: GuardFidTable [ + # CHECK-NEXT: 0x14000{{.*}} + # CHECK-NEXT: 0x14000{{.*}} + # CHECK-NEXT: 0x14000{{.*}} + # CHECK-NEXT: ] + + + # Indicate that no gfids are present. All symbols used by relocations in this + # file will be considered address-taken. + .def @feat.00; .scl 3; .type 0; .endef + .globl @feat.00 + @feat.00 = 0 + + .def main; .scl 2; .type 32; .endef + .section .text,"xr",one_only,main + .globl main + main: + subq $8, %rsp + leaq foo(%rip), %rdx + callq bar + movl $0, %eax + addq $8, %rsp + retq + + # Should not appear in gfids table. + .def baz; .scl 2; .type 32; .endef + .section .text,"xr",one_only,baz + .globl baz + baz: + mov $1, %eax + retq + + .def qux; .scl 2; .type 32; .endef + .section .text,"xr",one_only,qux + .globl qux + qux: + mov $2, %eax + retq + + .def quxx; .scl 2; .type 32; .endef + .section .text,"xr",one_only,quxx + .globl quxx + quxx: + mov $3, %eax + retq + + # Load config. + .section .rdata,"dr" + .globl _load_config_used + _load_config_used: + .long 256 + .fill 124, 1, 0 + .quad __guard_fids_table + .quad __guard_fids_count + .long __guard_flags + .fill 128, 1, 0 + + # SPLITMARKER + + # Indicate that gfids are present. This file does not take any addresses. + .def @feat.00; .scl 3; .type 0; .endef + .globl @feat.00 + @feat.00 = 0x800 + + .def foo; .scl 2; .type 32; .endef + .section .text,"xr",one_only,foo + .global foo + foo: + movl $42, %eax + retq + + .def bar; .scl 2; .type 32; .endef + .section .text,"xr",one_only,bar + .global bar + bar: + movl $13, %eax + retq +Index: test/COFF/gfids-gc.s +=================================================================== +--- test/COFF/gfids-gc.s (revision 333896) ++++ test/COFF/gfids-gc.s (working copy) +@@ -1,130 +1,131 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj + # RUN: lld-link %t.obj -guard:nolongjmp -out:%t.exe -opt:noref -entry:main + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s --check-prefix=CHECK-NOGC + # RUN: lld-link %t.obj -guard:nolongjmp -out:%t.exe -opt:noref -entry:main -debug:dwarf + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s --check-prefix=CHECK-NOGC + # RUN: lld-link %t.obj -guard:nolongjmp -out:%t.exe -opt:ref -entry:main + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s --check-prefix=CHECK-GC + + # This assembly is meant to mimic what CL emits for this kind of C code when + # /Gw (-fdata-sections) is enabled: + # int f() { return 42; } + # int g() { return 13; } + # int (*fp1)() = &f; + # int (*fp2)() = &g; + # int main() { + # return fp1(); + # } + # Compile with 'cl -c -guard:cf -Gw -O1' and note the two associative .gfids$y + # sections. + + # Expect 3 entries: main, f, and g. + + # CHECK-NOGC: ImageBase: 0x140000000 + # CHECK-NOGC: LoadConfig [ + # CHECK-NOGC: SEHandlerTable: 0x0 + # CHECK-NOGC: SEHandlerCount: 0 + # CHECK-NOGC: GuardCFCheckFunction: 0x0 + # CHECK-NOGC: GuardCFCheckDispatch: 0x0 + # CHECK-NOGC: GuardCFFunctionTable: 0x14000{{.*}} + # CHECK-NOGC: GuardCFFunctionCount: 3 + # CHECK-NOGC: GuardFlags: 0x500 + # CHECK-NOGC: GuardAddressTakenIatEntryTable: 0x0 + # CHECK-NOGC: GuardAddressTakenIatEntryCount: 0 + # CHECK-NOGC: GuardLongJumpTargetTable: 0x0 + # CHECK-NOGC: GuardLongJumpTargetCount: 0 + # CHECK-NOGC: ] + # CHECK-NOGC: GuardFidTable [ + # CHECK-NOGC-NEXT: 0x14000{{.*}} + # CHECK-NOGC-NEXT: 0x14000{{.*}} + # CHECK-NOGC-NEXT: 0x14000{{.*}} + # CHECK-NOGC-NEXT: ] + + # Expect 2 entries: main and f. fp2 was discarded, so g was only used as a + # direct call target. + + # CHECK-GC: ImageBase: 0x140000000 + # CHECK-GC: LoadConfig [ + # CHECK-GC: SEHandlerTable: 0x0 + # CHECK-GC: SEHandlerCount: 0 + # CHECK-GC: GuardCFCheckFunction: 0x0 + # CHECK-GC: GuardCFCheckDispatch: 0x0 + # CHECK-GC: GuardCFFunctionTable: 0x14000{{.*}} + # CHECK-GC: GuardCFFunctionCount: 2 + # CHECK-GC: GuardFlags: 0x500 + # CHECK-GC: GuardAddressTakenIatEntryTable: 0x0 + # CHECK-GC: GuardAddressTakenIatEntryCount: 0 + # CHECK-GC: GuardLongJumpTargetTable: 0x0 + # CHECK-GC: GuardLongJumpTargetCount: 0 + # CHECK-GC: ] + # CHECK-GC: GuardFidTable [ + # CHECK-GC-NEXT: 0x14000{{.*}} + # CHECK-GC-NEXT: 0x14000{{.*}} + # CHECK-GC-NEXT: ] + + + # We need @feat.00 to have 0x800 to indicate .gfids are present. + .def @feat.00; + .scl 3; + .type 0; + .endef + .globl @feat.00 + @feat.00 = 0x801 + + .def main; + .scl 2; + .type 32; + .endef + .section .text,"xr",one_only,main + .globl main + main: + # Call g directly so that it is not dead stripped. + callq g + rex64 jmpq *fp1(%rip) + + .def f; + .scl 3; + .type 32; + .endef + .section .text,"xr",one_only,f + f: + movl $42, %eax + retq + + .section .data,"dw",one_only,fp1 + .globl fp1 + fp1: + .quad f + + .section .gfids$y,"dr",associative,fp1 + .symidx f + + # Section GC will remove the following, so 'g' should not be present in the + # guard fid table. + + .def g; + .scl 3; + .type 32; + .endef + .section .text,"xr",one_only,g + g: + movl $13, %eax + retq + + .section .data,"dw",one_only,fp2 + .globl fp2 + fp2: + .quad g + + .section .gfids$y,"dr",associative,fp2 + .symidx g + + .section .rdata,"dr" + .globl _load_config_used + _load_config_used: + .long 256 + .fill 124, 1, 0 + .quad __guard_fids_table + .quad __guard_fids_count + .long __guard_flags + .fill 128, 1, 0 +Index: test/COFF/gfids-icf.s +=================================================================== +--- test/COFF/gfids-icf.s (revision 333896) ++++ test/COFF/gfids-icf.s (working copy) +@@ -1,87 +1,88 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj + # RUN: lld-link %t.obj -guard:nolongjmp -out:%t.exe -opt:icf -entry:main + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s --check-prefix=CHECK + + # This assembly is meant to mimic what CL emits for this kind of C code: + # int icf1() { return 42; } + # int icf2() { return 42; } + # int (*fp1)() = &icf1; + # int (*fp2)() = &icf2; + # int main() { + # return fp1(); + # return fp2(); + # } + + # 'icf1' and 'icf2' are address taken, but should be merged into one entry. + # There are two entries in the table because 'main' is included. + + # CHECK: ImageBase: 0x140000000 + # CHECK: LoadConfig [ + # CHECK: SEHandlerTable: 0x0 + # CHECK: SEHandlerCount: 0 + # CHECK: GuardCFCheckFunction: 0x0 + # CHECK: GuardCFCheckDispatch: 0x0 + # CHECK: GuardCFFunctionTable: 0x14000{{.*}} + # CHECK: GuardCFFunctionCount: 2 + # CHECK: GuardFlags: 0x500 + # CHECK: GuardAddressTakenIatEntryTable: 0x0 + # CHECK: GuardAddressTakenIatEntryCount: 0 + # CHECK: GuardLongJumpTargetTable: 0x0 + # CHECK: GuardLongJumpTargetCount: 0 + # CHECK: ] + # CHECK: GuardFidTable [ + # CHECK-NEXT: 0x14000{{.*}} + # CHECK-NEXT: 0x14000{{.*}} + # CHECK-NEXT: ] + + + # Indicate that gfids are present. + .def @feat.00; .scl 3; .type 0; .endef + .globl @feat.00 + @feat.00 = 0x800 + + .def icf1; .scl 2; .type 32; .endef + .section .text,"xr",one_only,icf1 + .global icf1 + icf1: + movl $42, %eax + retq + + .def icf2; .scl 2; .type 32; .endef + .section .text,"xr",one_only,icf2 + .global icf2 + icf2: + movl $42, %eax + retq + + # Take their two addresses. + .data + .globl fp1 + fp1: + .quad icf1 + .globl fp2 + fp2: + .quad icf2 + + .section .gfids$y,"dr" + .symidx icf1 + .symidx icf2 + + .def main; .scl 2; .type 32; .endef + .section .text,"xr",one_only,main + .globl main + main: + callq *fp1(%rip) + callq *fp2(%rip) + xor %eax, %eax + retq + + .section .rdata,"dr" + .globl _load_config_used + _load_config_used: + .long 256 + .fill 124, 1, 0 + .quad __guard_fids_table + .quad __guard_fids_count + .long __guard_flags + .fill 128, 1, 0 +Index: test/COFF/guard-longjmp.s +=================================================================== +--- test/COFF/guard-longjmp.s (revision 333896) ++++ test/COFF/guard-longjmp.s (working copy) +@@ -1,103 +1,104 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj + # RUN: lld-link %t.obj -guard:cf -out:%t.exe -entry:main + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s + + # CHECK: ImageBase: 0x140000000 + # CHECK: LoadConfig [ + # CHECK: SEHandlerTable: 0x0 + # CHECK: SEHandlerCount: 0 + # CHECK: GuardCFCheckFunction: 0x0 + # CHECK: GuardCFCheckDispatch: 0x0 + # CHECK: GuardCFFunctionTable: 0x14000{{.*}} + # CHECK: GuardCFFunctionCount: 1 + # CHECK: GuardFlags: 0x10500 + # CHECK: GuardAddressTakenIatEntryTable: 0x0 + # CHECK: GuardAddressTakenIatEntryCount: 0 + # CHECK: GuardLongJumpTargetTable: 0x14000{{.*}} + # CHECK: GuardLongJumpTargetCount: 1 + # CHECK: ] + # CHECK: GuardLJmpTable [ + # CHECK-NEXT: 0x14000{{.*}} + # CHECK-NEXT: ] + + + # This assembly is reduced from C code like: + # #include + # jmp_buf buf; + # void g() { longjmp(buf, 1); } + # void f() { + # if (setjmp(buf)) + # return; + # g(); + # } + # int main() { f(); } + + # We need @feat.00 to have 0x800 to indicate /guard:cf. + .def @feat.00; + .scl 3; + .type 0; + .endef + .globl @feat.00 + @feat.00 = 0x801 + .def f; .scl 2; .type 32; .endef + .globl f + f: + pushq %rbp + subq $32, %rsp + leaq 32(%rsp), %rbp + leaq buf(%rip), %rcx + leaq -32(%rbp), %rdx + callq _setjmp + .Lljmp1: + testl %eax, %eax + je .LBB1_1 + addq $32, %rsp + popq %rbp + retq + .LBB1_1: # %if.end + leaq buf(%rip), %rcx + movl $1, %edx + callq longjmp + ud2 + + # Record the longjmp target. + .section .gljmp$y,"dr" + .symidx .Lljmp1 + .text + + # Provide setjmp/longjmp stubs. + .def _setjmp; .scl 2; .type 32; .endef + .globl _setjmp + _setjmp: + retq + + .def longjmp; .scl 2; .type 32; .endef + .globl longjmp + longjmp: + retq + + .def main; .scl 2; .type 32; .endef + .globl main # -- Begin function main + main: # @main + subq $40, %rsp + callq f + xorl %eax, %eax + addq $40, %rsp + retq + + .comm buf,256,4 # @buf + + .section .rdata,"dr" + .globl _load_config_used + _load_config_used: + .long 256 + .fill 124, 1, 0 + .quad __guard_fids_table + .quad __guard_fids_count + .long __guard_flags + .fill 12, 1, 0 + .quad __guard_iat_table + .quad __guard_iat_count + .quad __guard_longjmp_table + .quad __guard_fids_count + .fill 84, 1, 0 +Index: test/COFF/guardcf-lto.ll +=================================================================== +--- test/COFF/guardcf-lto.ll (revision 333896) ++++ test/COFF/guardcf-lto.ll (working copy) +@@ -1,39 +1,40 @@ ++; REQUIRES: x86 + ; Set up an import library for a DLL that will do the indirect call. + ; RUN: echo -e 'LIBRARY library\nEXPORTS\n do_indirect_call\n' > %t.def + ; RUN: lld-link -lib -def:%t.def -out:%t.lib -machine:x64 + + ; Generate an object that will have the load configuration normally provided by + ; the CRT. + ; RUN: llvm-mc -triple x86_64-windows-msvc -filetype=obj %S/Inputs/loadconfig-cfg-x64.s -o %t.ldcfg.obj + + ; RUN: llvm-as %s -o %t.bc + ; RUN: lld-link -entry:main -guard:cf -dll %t.bc %t.lib %t.ldcfg.obj -out:%t.dll + ; RUN: llvm-readobj -coff-load-config %t.dll | FileCheck %s + + ; There must be *two* entries in the table: DLL entry point, and my_handler. + + ; CHECK: LoadConfig [ + ; CHECK: GuardCFFunctionTable: 0x{{[^0].*}} + ; CHECK-NEXT: GuardCFFunctionCount: 2 + ; CHECK-NEXT: GuardFlags: 0x10500 + ; CHECK: ] + ; CHECK: GuardFidTable [ + ; CHECK-NEXT: 0x180{{.*}} + ; CHECK-NEXT: 0x180{{.*}} + ; CHECK-NEXT: ] + + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-pc-windows-msvc19.12.25835" + + declare dllimport void @do_indirect_call(void ()*) + + define dso_local i32 @main() local_unnamed_addr { + entry: + tail call void @do_indirect_call(void ()* nonnull @my_handler) + ret i32 0 + } + + define dso_local void @my_handler() { + entry: + ret void + } +Index: test/COFF/icf-executable.s +=================================================================== +--- test/COFF/icf-executable.s (revision 333896) ++++ test/COFF/icf-executable.s (working copy) +@@ -1,18 +1,19 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple=x86_64-windows-msvc %s -filetype=obj -o %t.obj + # RUN: lld-link -entry:main %t.obj -out:%t.exe -verbose 2>&1 | FileCheck %s + + # CHECK: Selected internal + # CHECK: Removed f2 + + .section .text,"xr",one_only,internal + internal: + .globl main + main: + call f2 + ret + + .section .text,"xr",one_only,f2 + .globl f2 + f2: + call main + ret +Index: test/COFF/icf-pdata.s +=================================================================== +--- test/COFF/icf-pdata.s (revision 333896) ++++ test/COFF/icf-pdata.s (working copy) +@@ -1,97 +1,98 @@ ++# REQUIRES: x86 + # RUN: llvm-mc %s -triple x86_64-windows-msvc -filetype=obj -o %t.obj + # RUN: lld-link %t.obj -dll -noentry -out:%t.dll -merge:.xdata=.xdata + # RUN: llvm-readobj -sections -coff-exports %t.dll | FileCheck %s + + # CHECK: Name: .pdata + # CHECK-NEXT: VirtualSize: 0x18 + # CHECK: Name: .xdata + # CHECK-NEXT: VirtualSize: 0x10 + + # CHECK: Name: xdata1 + # CHECK-NEXT: RVA: 0x1010 + # CHECK: Name: xdata1a + # CHECK-NEXT: RVA: 0x1010 + # CHECK: Name: xdata1b + # CHECK-NEXT: RVA: 0x1030 + + .text + callee: + ret + + .def xdata1; + .scl 2; + .type 32; + .endef + .section .text,"xr",one_only,xdata1 + .globl xdata1 # -- Begin function xdata1 + .p2align 4, 0x90 + xdata1: # @xdata1 + .seh_proc xdata1 + # BB#0: # %entry + subq $40, %rsp + .seh_stackalloc 40 + .seh_endprologue + callq callee + nop + addq $40, %rsp + jmp callee # TAILCALL + .seh_handlerdata + .section .text,"xr",one_only,xdata1 + .seh_endproc + # -- End function + + # xdata1a is identical to xdata1, so it should be ICFd, and so should its pdata. + # It also has associative debug and CFG sections which should be ignored by ICF. + .def xdata1a; + .scl 2; + .type 32; + .endef + .section .text,"xr",one_only,xdata1a + .globl xdata1a # -- Begin function xdata1a + .p2align 4, 0x90 + xdata1a: # @xdata1a + .seh_proc xdata1a + # BB#0: # %entry + subq $40, %rsp + .seh_stackalloc 40 + .seh_endprologue + callq callee + nop + addq $40, %rsp + jmp callee # TAILCALL + .seh_handlerdata + .section .text,"xr",one_only,xdata1a + .seh_endproc + + .section .debug$S,"r",associative,xdata1a + .section .gfids$y,"r",associative,xdata1a + .section .gljmp$y,"r",associative,xdata1a + + # xdata1b's text is identical to xdata1, but its xdata specifies a different + # stack size, so it cannot be ICFd with xdata1. + .def xdata1b; + .scl 2; + .type 32; + .endef + .section .text,"xr",one_only,xdata1b + .globl xdata1b # -- Begin function xdata1b + .p2align 4, 0x90 + xdata1b: # @xdata1b + .seh_proc xdata1b + # BB#0: # %entry + subq $40, %rsp + .seh_stackalloc 48 + .seh_endprologue + callq callee + nop + addq $40, %rsp + jmp callee # TAILCALL + .seh_handlerdata + .section .text,"xr",one_only,xdata1b + .seh_endproc + # -- End function + + .section .drectve,"yn" + .ascii " -export:xdata1" + .ascii " -export:xdata1a" + .ascii " -export:xdata1b" +Index: test/COFF/icf-xdata.s +=================================================================== +--- test/COFF/icf-xdata.s (revision 333896) ++++ test/COFF/icf-xdata.s (working copy) +@@ -1,98 +1,99 @@ ++# REQUIRES: x86 + # RUN: llvm-mc %s -triple x86_64-windows-msvc -filetype=obj -o %t.obj + # RUN: lld-link %t.obj -dll -noentry -out:%t.dll -merge:.xdata=.xdata 2>&1 \ + # RUN: | FileCheck %s --check-prefix=WARN + # RUN: llvm-readobj -sections %t.dll | FileCheck %s --check-prefix=XDATA + # RUN: lld-link %t.obj -dll -noentry -out:%t.dll + # RUN: llvm-readobj -sections %t.dll | FileCheck %s --check-prefix=RDATA + + # There shouldn't be much xdata, because all three .pdata entries (12 bytes + # each) should use the same .xdata unwind info. + # XDATA: Name: .rdata + # XDATA-NEXT: VirtualSize: 0x73 + # XDATA: Name: .pdata + # XDATA-NEXT: VirtualSize: 0x24 + # XDATA: Name: .xdata + # XDATA-NEXT: VirtualSize: 0x8 + # + # WARN: warning: .xdata=.rdata: already merged into .xdata + # + # RDATA: Name: .rdata + # RDATA-NEXT: VirtualSize: 0x7C + # RDATA: Name: .pdata + # RDATA-NEXT: VirtualSize: 0x24 + + .text + callee: + ret + + .def xdata1; + .scl 2; + .type 32; + .endef + .section .text,"xr",one_only,xdata1 + .globl xdata1 # -- Begin function xdata1 + .p2align 4, 0x90 + xdata1: # @xdata1 + .seh_proc xdata1 + # BB#0: # %entry + subq $40, %rsp + .seh_stackalloc 40 + .seh_endprologue + callq callee + nop + addq $40, %rsp + jmp callee # TAILCALL + .seh_handlerdata + .section .text,"xr",one_only,xdata1 + .seh_endproc + # -- End function + .def xdata2; + .scl 2; + .type 32; + .endef + .section .text,"xr",one_only,xdata2 + .globl xdata2 # -- Begin function xdata2 + .p2align 4, 0x90 + xdata2: # @xdata2 + .seh_proc xdata2 + # BB#0: # %entry + subq $40, %rsp + .seh_stackalloc 40 + .seh_endprologue + callq callee + callq callee + nop + addq $40, %rsp + jmp callee # TAILCALL + .seh_handlerdata + .section .text,"xr",one_only,xdata2 + .seh_endproc + # -- End function + .def xdata3; + .scl 2; + .type 32; + .endef + .section .text,"xr",one_only,xdata3 + .globl xdata3 # -- Begin function xdata3 + .p2align 4, 0x90 + xdata3: # @xdata3 + .seh_proc xdata3 + # BB#0: # %entry + subq $40, %rsp + .seh_stackalloc 40 + .seh_endprologue + callq callee + callq callee + callq callee + nop + addq $40, %rsp + jmp callee # TAILCALL + .seh_handlerdata + .section .text,"xr",one_only,xdata3 + .seh_endproc + # -- End function + .section .drectve,"yn" + .ascii " -export:xdata1" + .ascii " -export:xdata2" + .ascii " -export:xdata3" + +Index: test/COFF/implib-name.test +=================================================================== +--- test/COFF/implib-name.test (revision 333896) ++++ test/COFF/implib-name.test (working copy) +@@ -1,71 +1,72 @@ ++# REQUIRES: x86 + # RUN: mkdir -p %T + # RUN: llvm-mc -triple x86_64-unknown-windows-msvc -filetype obj -o %T/object.obj %S/Inputs/object.s + + # RUN: lld-link /dll /machine:x64 /def:%S/Inputs/named.def /out:%T/library.dll %T/object.obj /entry:f /subsystem:CONSOLE + # RUN: llvm-ar t %T/library.lib | FileCheck %s -check-prefix CHECK-DEFAULT-DLL-EXT + + # RUN: lld-link /machine:x64 /def:%S/Inputs/named.def /out:%T/library.lib + # RUN: llvm-ar t %T/library.lib | FileCheck %s -check-prefix CHECK-DEFAULT-DLL-EXT + + CHECK-DEFAULT-DLL-EXT: library.dll + CHECK-DEFAULT-DLL-EXT: library.dll + CHECK-DEFAULT-DLL-EXT: library.dll + CHECK-DEFAULT-DLL-EXT: library.dll + + # RUN: lld-link /machine:x64 /def:%S/Inputs/named.def /out:%T/library.exe %T/object.obj /entry:f /subsystem:CONSOLE + # RUN: llvm-ar t %T/library.lib | FileCheck %s -check-prefix CHECK-DEFAULT-EXE-EXT + + CHECK-DEFAULT-EXE-EXT: library.exe + CHECK-DEFAULT-EXE-EXT: library.exe + CHECK-DEFAULT-EXE-EXT: library.exe + CHECK-DEFAULT-EXE-EXT: library.exe + + # RUN: lld-link /dll /machine:x64 /def:%S/Inputs/extension.def /out:%T/extension.dll /entry:f /subsystem:CONSOLE + # RUN: llvm-ar t %T/extension.lib | FileCheck %s -check-prefix CHECK-EXTENSION + + # RUN: lld-link /machine:x64 /def:%S/Inputs/extension.def /out:%T/extension.exe /entry:f /subsystem:CONSOLE + # RUN: llvm-ar t %T/extension.lib | FileCheck %s -check-prefix CHECK-EXTENSION + + # RUN: lld-link /machine:x64 /def:%S/Inputs/extension.def /out:%T/extension.lib + # RUN: llvm-ar t %T/extension.lib | FileCheck %s -check-prefix CHECK-EXTENSION + + CHECK-EXTENSION: library.ext + CHECK-EXTENSION: library.ext + CHECK-EXTENSION: library.ext + CHECK-EXTENSION: library.ext + + # RUN: lld-link /dll /machine:x64 /def:%S/Inputs/default.def /out:%T/default.dll /entry:f /subsystem:CONSOLE + # RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix CHECK-OUTPUT-NAME-DLL + + # RUN: lld-link /machine:x64 /def:%S/Inputs/default.def /out:%T/default.lib + # RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix CHECK-OUTPUT-NAME-DLL + + CHECK-OUTPUT-NAME-DLL: default.dll + CHECK-OUTPUT-NAME-DLL: default.dll + CHECK-OUTPUT-NAME-DLL: default.dll + CHECK-OUTPUT-NAME-DLL: default.dll + + # RUN: lld-link /machine:x64 /def:%S/Inputs/default.def /out:%T/default.exe %T/object.obj /entry:f /subsystem:CONSOLE + # RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix CHECK-OUTPUT-NAME-EXE + + CHECK-OUTPUT-NAME-EXE: default.exe + CHECK-OUTPUT-NAME-EXE: default.exe + CHECK-OUTPUT-NAME-EXE: default.exe + CHECK-OUTPUT-NAME-EXE: default.exe + + # RUN: lld-link /machine:x64 /out:%T/default.exe %T/object.obj /entry:f /subsystem:CONSOLE + # RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix CHECK-NODEF-EXE + + CHECK-NODEF-EXE: default.exe + CHECK-NODEF-EXE: default.exe + CHECK-NODEF-EXE: default.exe + CHECK-NODEF-EXE: default.exe + + # RUN: lld-link /machine:x64 /dll /out:%T/default.dll %T/object.obj /entry:f /subsystem:CONSOLE + # RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix CHECK-NODEF-DLL + + CHECK-NODEF-DLL: default.dll + CHECK-NODEF-DLL: default.dll + CHECK-NODEF-DLL: default.dll + CHECK-NODEF-DLL: default.dll + +Index: test/COFF/loadcfg.ll +=================================================================== +--- test/COFF/loadcfg.ll (revision 333896) ++++ test/COFF/loadcfg.ll (working copy) +@@ -1,15 +1,16 @@ ++; REQUIRES: x86 + ; RUN: llvm-as -o %t.obj %s + ; RUN: lld-link /out:%t.exe %t.obj /entry:main /subsystem:console + ; RUN: llvm-readobj -file-headers %t.exe | FileCheck %s + + ; CHECK: LoadConfigTableRVA: 0x2000 + ; CHECK: LoadConfigTableSize: 0x70 + + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-pc-windows-msvc" + + @_load_config_used = constant [28 x i32] [i32 112, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0] + + define void @main() { + ret void + } +Index: test/COFF/lto-chkstk.ll +=================================================================== +--- test/COFF/lto-chkstk.ll (revision 333896) ++++ test/COFF/lto-chkstk.ll (working copy) +@@ -1,17 +1,18 @@ ++; REQUIRES: x86 + ; RUN: llvm-as -o %t.obj %s + ; RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %T/lto-chkstk-foo.obj %S/Inputs/lto-chkstk-foo.s + ; RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %T/lto-chkstk-chkstk.obj %S/Inputs/lto-chkstk-chkstk.s + ; RUN: llvm-ar cru %t.lib %T/lto-chkstk-chkstk.obj + ; RUN: lld-link /out:%t.exe /entry:main /subsystem:console %t.obj %T/lto-chkstk-foo.obj %t.lib + + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-pc-windows-msvc" + + define void @main() { + entry: + %array4096 = alloca [4096 x i8] + call void @foo([4096 x i8]* %array4096) + ret void + } + + declare void @foo([4096 x i8]*) +Index: test/COFF/lto-comdat.ll +=================================================================== +--- test/COFF/lto-comdat.ll (revision 333896) ++++ test/COFF/lto-comdat.ll (working copy) +@@ -1,107 +1,108 @@ ++; REQUIRES: x86 + ; RUN: llvm-as -o %T/comdat-main.lto.obj %s + ; RUN: llvm-as -o %T/comdat1.lto.obj %S/Inputs/lto-comdat1.ll + ; RUN: llvm-as -o %T/comdat2.lto.obj %S/Inputs/lto-comdat2.ll + ; RUN: rm -f %T/comdat.lto.lib + ; RUN: llvm-ar cru %T/comdat.lto.lib %T/comdat1.lto.obj %T/comdat2.lto.obj + + ; RUN: llc -filetype=obj -o %T/comdat-main.obj %s + ; RUN: llc -filetype=obj -o %T/comdat1.obj %S/Inputs/lto-comdat1.ll + ; RUN: llc -filetype=obj -o %T/comdat2.obj %S/Inputs/lto-comdat2.ll + ; RUN: rm -f %T/comdat.lib + ; RUN: llvm-ar cru %T/comdat.lib %T/comdat1.obj %T/comdat2.obj + + ; Check that, when we use an LTO main with LTO objects, we optimize away all + ; of f1, f2, and comdat. + ; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console %T/comdat-main.lto.obj %T/comdat1.lto.obj %T/comdat2.lto.obj + ; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck -check-prefix=HEADERS-11 %s + ; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck -check-prefix=TEXT-11 %s + ; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console %T/comdat-main.lto.obj %T/comdat.lto.lib + ; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck -check-prefix=HEADERS-11 %s + ; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck -check-prefix=TEXT-11 %s + + ; Check that, when we use a non-LTO main with LTO objects, we pick the comdat + ; implementation in LTO, elide calls to it from inside LTO, and retain the + ; call to comdat from main. + ; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console %T/comdat-main.obj %T/comdat1.lto.obj %T/comdat2.lto.obj + ; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck -check-prefix=HEADERS-01 %s + ; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck -check-prefix=TEXT-01 %s + ; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console %T/comdat-main.obj %T/comdat.lto.lib + ; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck -check-prefix=HEADERS-01 %s + ; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck -check-prefix=TEXT-01 %s + + ; Check that, when we use an LTO main with non-LTO objects, we pick the comdat + ; implementation in LTO, elide the call to it from inside LTO, and keep the + ; calls to comdat from the non-LTO objects. + ; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console %T/comdat-main.lto.obj %T/comdat1.obj %T/comdat2.obj + ; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck -check-prefix=HEADERS-10 %s + ; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck -check-prefix=TEXT-10 %s + ; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console %T/comdat-main.lto.obj %T/comdat.lib + ; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck -check-prefix=HEADERS-10 %s + ; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck -check-prefix=TEXT-10 %s + + ; HEADERS-11: AddressOfEntryPoint: 0x1000 + ; TEXT-11: Disassembly of section .text: + ; TEXT-11-NEXT: .text: + ; TEXT-11-NEXT: xorl %eax, %eax + ; TEXT-11-NEXT: retq + + ; HEADERS-01: AddressOfEntryPoint: 0x1000 + ; TEXT-01: Disassembly of section .text: + ; TEXT-01-NEXT: .text: + ; TEXT-01-NEXT: subq $40, %rsp + ; TEXT-01-NEXT: callq 23 + ; TEXT-01-NEXT: callq 18 + ; TEXT-01-NEXT: callq 13 + ; TEXT-01-NEXT: xorl %eax, %eax + ; TEXT-01-NEXT: addq $40, %rsp + ; TEXT-01: retq + ; TEXT-01-NOT: callq + ; TEXT-01: retq + ; TEXT-01: int3 + ; TEXT-01: int3 + ; TEXT-01: int3 + ; TEXT-01-NOT: {{.}} + + ; HEADERS-10: AddressOfEntryPoint: 0x1020 + ; TEXT-10: Disassembly of section .text: + ; TEXT-10-NEXT: .text: + ; TEXT-10-NEXT: subq $40, %rsp + ; TEXT-10-NEXT: callq 55 + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: addq $40, %rsp + ; TEXT-10-NEXT: retq + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: subq $40, %rsp + ; TEXT-10-NEXT: callq 39 + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: addq $40, %rsp + ; TEXT-10-NEXT: retq + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: subq $40, %rsp + ; TEXT-10-NEXT: callq -41 + ; TEXT-10-NEXT: callq -30 + ; TEXT-10-NEXT: xorl %eax, %eax + ; TEXT-10-NEXT: addq $40, %rsp + ; TEXT-10-NEXT: retq + ; TEXT-10-NOT: callq + ; TEXT-10: retq + ; TEXT-10-NOT: {{.}} + + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-pc-windows-msvc" + + $comdat = comdat any + + define i32 @main() { + call void @f1() + call void @f2() + call void @comdat() + ret i32 0 + } + + define linkonce_odr void @comdat() comdat { + ret void + } + + declare void @f1() + declare void @f2() +Index: test/COFF/lto-icf.ll +=================================================================== +--- test/COFF/lto-icf.ll (revision 333896) ++++ test/COFF/lto-icf.ll (working copy) +@@ -1,26 +1,27 @@ ++; REQUIRES: x86 + ; Test that ICF works after LTO, i.e. both functions have the same address. + ; Previously, when we didn't enable function sections, ICF didn't work. + + ; RUN: llvm-as %s -o %t.bc + ; RUN: lld-link -opt:icf -dll -noentry %t.bc -out:%t.dll + ; RUN: llvm-readobj -coff-exports %t.dll | FileCheck %s + + ; CHECK: Export { + ; CHECK: Export { + ; CHECK: RVA: 0x[[RVA:.*]] + ; CHECK: Export { + ; CHECK: RVA: 0x[[RVA]] + ; CHECK-NOT: Export + + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-pc-windows-msvc19.12.25835" + + define dllexport i8* @icf_ptr() { + entry: + ret i8* null + } + + define dllexport i64 @icf_int() { + entry: + ret i64 0 + } +Index: test/COFF/lto-lazy-reference.ll +=================================================================== +--- test/COFF/lto-lazy-reference.ll (revision 333896) ++++ test/COFF/lto-lazy-reference.ll (working copy) +@@ -1,21 +1,22 @@ ++; REQUIRES: x86 + ; RUN: llc -mtriple=i686-pc-windows-msvc -filetype=obj -o %T/lto-lazy-reference-quadruple.obj %S/Inputs/lto-lazy-reference-quadruple.ll + ; RUN: llvm-as -o %T/lto-lazy-reference-dummy.bc %S/Inputs/lto-lazy-reference-dummy.ll + ; RUN: rm -f %t.lib + ; RUN: llvm-ar cru %t.lib %T/lto-lazy-reference-quadruple.obj %T/lto-lazy-reference-dummy.bc + ; RUN: llvm-as -o %t.obj %s + ; RUN: lld-link /out:%t.exe /entry:main /subsystem:console %t.obj %t.lib + + target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" + target triple = "i686-pc-windows-msvc18.0.0" + + define double @main(double %x) { + entry: + ; When compiled, this defines the __real@40800000 symbol, which already has a + ; lazy definition in the lib file from lto-lazy-reference-quadruple.obj. This + ; test makes sure we *don't* try to take the definition from the lazy + ; reference, because that can bring in new references to bitcode files after + ; LTO, such as lto-lazy-reference-dummy.bc in this case. + %mul = fmul double %x, 4.0 + + ret double %mul + } +Index: test/COFF/lto-linker-opts.ll +=================================================================== +--- test/COFF/lto-linker-opts.ll (revision 333896) ++++ test/COFF/lto-linker-opts.ll (working copy) +@@ -1,8 +1,9 @@ ++; REQUIRES: x86 + ; RUN: llvm-as -o %T/lto-linker-opts.obj %s + ; RUN: env LIB=%S/Inputs lld-link /out:%T/lto-linker-opts.exe /entry:main /subsystem:console %T/lto-linker-opts.obj + + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-pc-windows-msvc" + + !llvm.linker.options = !{!0} + !0 = !{!"/DEFAULTLIB:ret42.lib"} +Index: test/COFF/lto-new-symbol.ll +=================================================================== +--- test/COFF/lto-new-symbol.ll (revision 333896) ++++ test/COFF/lto-new-symbol.ll (working copy) +@@ -1,16 +1,17 @@ ++; REQUIRES: x86 + ; RUN: llvm-as -o %t.obj %s + ; RUN: lld-link /out:%t.exe /entry:foo /subsystem:console %t.obj + + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-pc-windows-msvc" + + define void @foo(<4 x i32>* %p, <4 x float>* %q, i1 %t) nounwind { + entry: + br label %loop + loop: + store <4 x i32>, <4 x i32>* %p + store <4 x float>, <4 x float>* %q + br i1 %t, label %loop, label %ret + ret: + ret void + } +Index: test/COFF/lto-opt-level.ll +=================================================================== +--- test/COFF/lto-opt-level.ll (revision 333896) ++++ test/COFF/lto-opt-level.ll (working copy) +@@ -1,21 +1,22 @@ ++; REQUIRES: x86 + ; RUN: llvm-as -o %t.obj %s + ; RUN: lld-link /out:%t0.exe /entry:main /subsystem:console /opt:lldlto=0 /lldmap:%t0.map %t.obj + ; RUN: FileCheck --check-prefix=CHECK-O0 %s < %t0.map + ; RUN: lld-link /out:%t2.exe /entry:main /subsystem:console /opt:lldlto=2 /lldmap:%t2.map %t.obj + ; RUN: FileCheck --check-prefix=CHECK-O2 %s < %t2.map + ; RUN: lld-link /out:%t2a.exe /entry:main /subsystem:console /lldmap:%t2a.map %t.obj + ; RUN: FileCheck --check-prefix=CHECK-O2 %s < %t2a.map + + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-pc-windows-msvc" + + ; CHECK-O0: foo + ; CHECK-O2-NOT: foo + define internal void @foo() { + ret void + } + + define void @main() { + call void @foo() + ret void + } +Index: test/COFF/lto-parallel.ll +=================================================================== +--- test/COFF/lto-parallel.ll (revision 333896) ++++ test/COFF/lto-parallel.ll (working copy) +@@ -1,22 +1,23 @@ ++; REQUIRES: x86 + ; RUN: llvm-as -o %t.obj %s + ; RUN: lld-link -opt:noicf /out:%t.exe /entry:foo /include:bar /opt:lldltopartitions=2 /subsystem:console /lldmap:%t.map %t.obj + ; RUN: FileCheck %s < %t.map + + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-pc-windows-msvc" + + ; CHECK: lto.tmp + ; CHECK: lto.tmp + ; CHECK-NEXT: foo + define void @foo() { + call void @bar() + ret void + } + + ; CHECK: lto.tmp + ; CHECK: lto.tmp + ; CHECK: bar + define void @bar() { + call void @foo() + ret void + } +Index: test/COFF/lto-reloc-model.ll +=================================================================== +--- test/COFF/lto-reloc-model.ll (revision 333896) ++++ test/COFF/lto-reloc-model.ll (working copy) +@@ -1,19 +1,20 @@ ++; REQUIRES: x86 + ; RUN: llvm-as -o %t %s + ; RUN: lld-link /entry:main /subsystem:console /out:%t.exe %t + ; RUN: llvm-objdump -d %t.exe | FileCheck %s + + target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" + target triple = "i686-pc-windows-msvc" + + @foo = thread_local global i8 0 + + module asm "__tls_index = 1" + module asm "__tls_array = 2" + + define i8* @main() { + ; CHECK: movl 1, %eax + ; CHECK: movl %fs:2, %ecx + ; CHECK: movl (%ecx,%eax,4), %eax + ; CHECK: leal (%eax), %eax + ret i8* @foo + } +Index: test/COFF/lto.ll +=================================================================== +--- test/COFF/lto.ll (revision 333896) ++++ test/COFF/lto.ll (working copy) +@@ -1,144 +1,145 @@ ++; REQUIRES: x86 + ; RUN: llvm-as -o %T/main.lto.obj %s + ; RUN: llvm-as -o %T/foo.lto.obj %S/Inputs/lto-dep.ll + ; RUN: rm -f %T/foo.lto.lib + ; RUN: llvm-ar cru %T/foo.lto.lib %T/foo.lto.obj + + ; RUN: llc -filetype=obj -o %T/main.obj %s + ; RUN: llc -filetype=obj -o %T/foo.obj %S/Inputs/lto-dep.ll + ; RUN: rm -f %T/foo.lib + ; RUN: llvm-ar cru %T/foo.lib %T/foo.obj + + ; RUN: lld-link /out:%T/main.exe /entry:main /include:f2 /subsystem:console %T/main.lto.obj %T/foo.lto.obj + ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-11 %s + ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-11 %s + ; RUN: lld-link /out:%T/main.exe /entry:main /include:f2 /subsystem:console %T/main.lto.obj %T/foo.lto.lib /verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s + ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-11 %s + ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-11 %s + + ; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console %T/main.obj %T/foo.lto.obj + ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-01 %s + ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-01 %s + ; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console %T/main.obj %T/foo.lto.lib + ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-01 %s + ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-01 %s + + ; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console %T/main.lto.obj %T/foo.obj + ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-10 %s + ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-10 %s + ; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console %T/main.lto.obj %T/foo.lib + ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck -check-prefix=HEADERS-10 %s + ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-10 %s + + ; VERBOSE: foo.lto.lib({{.*}}foo.lto.obj) + + ; HEADERS-11: AddressOfEntryPoint: 0x1000 + ; TEXT-11: Disassembly of section .text: + ; TEXT-11-NEXT: .text: + ; TEXT-11-NEXT: xorl %eax, %eax + ; TEXT-11-NEXT: retq + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: int3 + ; TEXT-11-NEXT: movl $2, %eax + ; TEXT-11-NEXT: retq + + ; HEADERS-01: AddressOfEntryPoint: 0x1000 + ; TEXT-01: Disassembly of section .text: + ; TEXT-01-NEXT: .text: + ; TEXT-01-NEXT: subq $40, %rsp + ; TEXT-01-NEXT: callq 23 + ; TEXT-01-NEXT: xorl %eax, %eax + ; TEXT-01-NEXT: addq $40, %rsp + ; TEXT-01-NEXT: retq + ; TEXT-01-NEXT: retq + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: int3 + ; TEXT-01-NEXT: retq + + ; HEADERS-10: AddressOfEntryPoint: 0x1020 + ; TEXT-10: Disassembly of section .text: + ; TEXT-10-NEXT: .text: + ; TEXT-10-NEXT: retq + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: nop + ; TEXT-10-NEXT: retq + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: int3 + ; TEXT-10-NEXT: subq $40, %rsp + ; TEXT-10-NEXT: callq -41 + ; TEXT-10-NEXT: xorl %eax, %eax + ; TEXT-10-NEXT: addq $40, %rsp + ; TEXT-10-NEXT: retq + + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-pc-windows-msvc" + + define i32 @main() { + call void @foo() + ret i32 0 + } + + declare void @foo() + + $f1 = comdat any + define i32 @f1() comdat($f1) { + ret i32 1 + } + + $f2 = comdat any + define i32 @f2() comdat($f2) { + ret i32 2 + } + + define internal void @internal() { + ret void + } +Index: test/COFF/pdb-global-gc.yaml +=================================================================== +--- test/COFF/pdb-global-gc.yaml (revision 333896) ++++ test/COFF/pdb-global-gc.yaml (working copy) +@@ -1,120 +1,121 @@ ++# REQUIRES: x86 + # RUN: yaml2obj %s -o %t.obj + # RUN: llvm-mc %S/Inputs/pdb-global-gc.s -triple x86_64-windows-msvc -filetype=obj -o %t2.obj + # RUN: lld-link %t.obj %t2.obj -debug -entry:main \ + # RUN: -nodefaultlib -opt:ref -out:%t.exe -pdb:%t.pdb -verbose + # RUN: llvm-pdbutil dump -symbols -globals %t.pdb | FileCheck %s + + # This tests the case where an __imp_ chunk is discarded by linker GC. The debug + # info may refer to the __imp_ symbol still. + + # Compile this code with MSVC to regenerate the test case: + # extern char __declspec(dllimport) __wc_mb_cur; + # int discarded() { return __wc_mb_cur; } + # int main() { return g2; } + + # CHECK: Global Symbols + # CHECK-NEXT: ============================================================ + # CHECK-NEXT: Records + # CHECK-NEXT: 20 | S_GDATA32 [size = 28] `__wc_mb_cur` + # CHECK-NEXT: type = 0x0070 (char), addr = 0000:0000 + + # CHECK: Symbols + # CHECK: ============================================================ + # CHECK-NEXT: Mod 0000 | `{{.*}}pdb-global-gc.yaml.tmp.obj`: + # CHECK-NEXT: Mod 0001 | `{{.*}}pdb-global-gc.yaml.tmp2.obj`: + # CHECK-NEXT: Mod 0002 | `* Linker *`: + + --- !COFF + header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [ ] + sections: + - Name: '.debug$S' + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] + Alignment: 1 + Subsections: + - !Symbols + Records: + - Kind: S_GDATA32 + DataSym: + Type: 112 + DisplayName: __wc_mb_cur + - !StringTable + Strings: + Relocations: + - VirtualAddress: 20 + SymbolName: __wc_mb_cur + Type: IMAGE_REL_AMD64_SECREL + - VirtualAddress: 24 + SymbolName: __wc_mb_cur + Type: IMAGE_REL_AMD64_SECTION + - Name: '.text$mn' + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: 0FBE0500000000C3 + Relocations: + - VirtualAddress: 3 + SymbolName: __wc_mb_cur + Type: IMAGE_REL_AMD64_REL32 + - Name: '.text$mn' + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: B82A000000C3 + symbols: + - Name: '.debug$S' + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 240 + NumberOfRelocations: 2 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.text$mn' + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 11 + NumberOfRelocations: 1 + NumberOfLinenumbers: 0 + CheckSum: 2906070869 + Number: 0 + Selection: IMAGE_COMDAT_SELECT_NODUPLICATES + - Name: '.text$mn' + Value: 0 + SectionNumber: 3 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 6 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 2139436471 + Number: 0 + Selection: IMAGE_COMDAT_SELECT_NODUPLICATES + - Name: discarded + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: main + Value: 0 + SectionNumber: 3 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: __wc_mb_cur + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + ... +Index: test/COFF/reloc-discarded-dwarf.s +=================================================================== +--- test/COFF/reloc-discarded-dwarf.s (revision 333896) ++++ test/COFF/reloc-discarded-dwarf.s (working copy) +@@ -1,17 +1,18 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t1.obj %s + # RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t2.obj %s + + # LLD should not error on relocations in DWARF debug sections against symbols in + # discarded sections. + # RUN: lld-link -entry:main -debug %t1.obj %t2.obj + + .section .text,"xr",discard,main + .globl main + main: + f: + retq + + .section .debug_info,"dr" + .quad f + .section .eh_frame,"dr" + .quad f +Index: test/COFF/reloc-discarded-early.s +=================================================================== +--- test/COFF/reloc-discarded-early.s (revision 333896) ++++ test/COFF/reloc-discarded-early.s (working copy) +@@ -1,8 +1,9 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s + # RUN: lld-link -entry:__ImageBase -subsystem:console -debug %t.obj + + .section .debug_info,"dr" + .quad .Ldrectve + + .section .drectve + .Ldrectve: +Index: test/COFF/reloc-discarded-early2.s +=================================================================== +--- test/COFF/reloc-discarded-early2.s (revision 333896) ++++ test/COFF/reloc-discarded-early2.s (working copy) +@@ -1,9 +1,10 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s + # RUN: not lld-link -entry:__ImageBase -subsystem:console %t.obj 2>&1 | FileCheck %s + + .text + # CHECK: error: relocation against symbol in discarded section: .drectve + .quad .Ldrectve + + .section .drectve + .Ldrectve: +Index: test/COFF/reloc-discarded.s +=================================================================== +--- test/COFF/reloc-discarded.s (revision 333896) ++++ test/COFF/reloc-discarded.s (working copy) +@@ -1,29 +1,30 @@ ++# REQUIRES: x86 + # RUN: echo -e '.section .bss,"bw",discard,main_global\n.global main_global\n main_global:\n .long 0' | \ + # RUN: llvm-mc - -filetype=obj -o %t1.obj -triple x86_64-windows-msvc + # RUN: llvm-mc %s -filetype=obj -o %t2.obj -triple x86_64-windows-msvc + + # LLD should report an error and not assert regardless of whether we are doing + # GC. + + # RUN: not lld-link -entry:main -nodefaultlib %t1.obj %t2.obj -out:%t.exe -opt:ref 2>&1 | FileCheck %s + # RUN: not lld-link -entry:main -nodefaultlib %t1.obj %t2.obj -out:%t.exe -opt:noref 2>&1 | FileCheck %s + + # CHECK: error: relocation against symbol in discarded section: assoc_global + + .section .bss,"bw",discard,main_global + .globl main_global + .p2align 2 + main_global: + .long 0 + + .section .CRT$XCU,"dr",associative,main_global + .p2align 3 + assoc_global: + .quad main_global + + .text + .globl main + main: + movq assoc_global(%rip), %rax + movl (%rax), %eax + retq +Index: test/COFF/reloc-x64.test +=================================================================== +--- test/COFF/reloc-x64.test (revision 333896) ++++ test/COFF/reloc-x64.test (working copy) +@@ -1,102 +1,103 @@ ++# REQUIRES: x86 + # RUN: yaml2obj < %s > %t.obj + # RUN: lld-link /out:%t.exe /entry:main %t.obj + # RUN: llvm-objdump -d %t.exe | FileCheck %s + + # CHECK: .text: + # CHECK: 1000: a1 03 20 00 40 00 00 00 00 + # CHECK: 1009: a1 03 20 00 40 01 00 00 00 + # CHECK: 1012: a1 03 20 00 00 00 00 00 00 + # CHECK: 101b: a1 e3 0f 00 00 00 00 00 00 + # CHECK: 1024: a1 d9 0f 00 00 00 00 00 00 + # CHECK: 102d: a1 cf 0f 00 00 00 00 00 00 + # CHECK: 1036: a1 c5 0f 00 00 00 00 00 00 + # CHECK: 103f: a1 bb 0f 00 00 00 00 00 00 + # CHECK: 1048: a1 b1 0f 00 00 00 00 00 00 + # CHECK: 1051: a1 02 00 00 00 00 00 00 00 + # CHECK: 105a: a1 03 00 00 00 00 00 00 00 + + --- !COFF + header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [] + sections: + - Name: .text + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 4096 + SectionData: A10000000000000000A10000000000000000A10000000000000000A10000000000000000A10000000000000000A10000000000000000A10000000000000000A10000000000000000A10000000000000000A10000000000000000A10000000000000000 + Relocations: + - VirtualAddress: 1 + SymbolName: foo + Type: IMAGE_REL_AMD64_ADDR32 + - VirtualAddress: 10 + SymbolName: foo + Type: IMAGE_REL_AMD64_ADDR64 + - VirtualAddress: 19 + SymbolName: foo + Type: IMAGE_REL_AMD64_ADDR32NB + - VirtualAddress: 28 + SymbolName: foo + Type: IMAGE_REL_AMD64_REL32 + - VirtualAddress: 37 + SymbolName: foo + Type: IMAGE_REL_AMD64_REL32_1 + - VirtualAddress: 46 + SymbolName: foo + Type: IMAGE_REL_AMD64_REL32_2 + - VirtualAddress: 55 + SymbolName: foo + Type: IMAGE_REL_AMD64_REL32_3 + - VirtualAddress: 64 + SymbolName: foo + Type: IMAGE_REL_AMD64_REL32_4 + - VirtualAddress: 73 + SymbolName: foo + Type: IMAGE_REL_AMD64_REL32_5 + - VirtualAddress: 82 + SymbolName: foo + Type: IMAGE_REL_AMD64_SECTION + - VirtualAddress: 91 + SymbolName: foo + Type: IMAGE_REL_AMD64_SECREL + - Name: .zzz + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] + Alignment: 4096 + SectionData: 0000000000000000 + symbols: + - Name: .text + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 6 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: .zzz + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 8 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: main + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: foo + Value: 3 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + ... +Index: test/COFF/reloc-x86.test +=================================================================== +--- test/COFF/reloc-x86.test (revision 333896) ++++ test/COFF/reloc-x86.test (working copy) +@@ -1,82 +1,83 @@ ++# REQUIRES: x86 + # RUN: yaml2obj < %s > %t.obj + # RUN: lld-link /out:%t.exe /entry:main /base:0x400000 %t.obj + # RUN: llvm-objdump -d %t.exe | FileCheck %s + + # CHECK: .text: + # CHECK: 1000: a1 00 00 00 00 + # CHECK: 1005: a1 03 20 40 00 + # CHECK: 100a: a1 03 20 00 00 + # CHECK: 100f: a1 ef 0f 00 00 + # CHECK: 1014: a1 00 00 02 00 + # CHECK: 1019: a1 03 00 00 00 + + --- !COFF + header: + Machine: IMAGE_FILE_MACHINE_I386 + Characteristics: [] + sections: + - Name: .text + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 4096 + SectionData: A100000000A100000000A100000000A100000000A100000000A100000000 + Relocations: + - VirtualAddress: 1 + SymbolName: _foo + Type: IMAGE_REL_I386_ABSOLUTE + - VirtualAddress: 6 + SymbolName: _foo + Type: IMAGE_REL_I386_DIR32 + - VirtualAddress: 11 + SymbolName: _foo + Type: IMAGE_REL_I386_DIR32NB + - VirtualAddress: 16 + SymbolName: _foo + Type: IMAGE_REL_I386_REL32 + - VirtualAddress: 23 + SymbolName: _foo + Type: IMAGE_REL_I386_SECTION + - VirtualAddress: 26 + SymbolName: _foo + Type: IMAGE_REL_I386_SECREL + - Name: .zzz + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] + Alignment: 4096 + SectionData: 0000000000000000 + symbols: + - Name: .text + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 6 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: .zzz + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 8 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: _main + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: _foo + Value: 3 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + ... +Index: test/COFF/safeseh-md.s +=================================================================== +--- test/COFF/safeseh-md.s (revision 333896) ++++ test/COFF/safeseh-md.s (working copy) +@@ -1,34 +1,35 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple i686-windows-msvc %s -filetype=obj -o %t.obj + # RUN: lld-link %t.obj %S/Inputs/except_handler3.lib -safeseh -out:%t.exe -opt:noref -entry:main + # RUN: llvm-readobj -coff-load-config %t.exe | FileCheck %s + + # CHECK: SEHTable [ + # CHECK-NEXT: 0x + # CHECK-NEXT: ] + + .def @feat.00; + .scl 3; + .type 0; + .endef + .globl @feat.00 + @feat.00 = 1 + + .def _main; + .scl 2; + .type 32; + .endef + .section .text,"xr",one_only,_main + .globl _main + _main: + movl $42, %eax + ret + + .safeseh __except_handler3 + + .section .rdata,"dr" + .globl __load_config_used + __load_config_used: + .long 72 + .fill 60, 1, 0 + .long ___safe_se_handler_table + .long ___safe_se_handler_count +Index: test/COFF/safeseh-notable.s +=================================================================== +--- test/COFF/safeseh-notable.s (revision 333896) ++++ test/COFF/safeseh-notable.s (working copy) +@@ -1,43 +1,44 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple i686-windows-msvc %s -filetype=obj -o %t.obj + # RUN: lld-link %t.obj -safeseh -out:%t.exe -entry:main + # RUN: llvm-readobj -file-headers %t.exe | FileCheck %s + + # This object lacks a _load_config_used global, so we set + # IMAGE_DLL_CHARACTERISTICS_NO_SEH even though there is an exception handler. + # This is a more secure default. If someone wants to use a CRT without a load + # config and they want to use 32-bit SEH, they will need to provide a + # safeseh-compatible load config. + + # CHECK-LABEL: Characteristics [ + # CHECK: IMAGE_DLL_CHARACTERISTICS_NO_SEH + # CHECK: ] + + # CHECK-LABEL: DataDirectory { + # CHECK: LoadConfigTableRVA: 0x0 + # CHECK: LoadConfigTableSize: 0x0 + # CHECK: } + + # CHECK-NOT: LoadConfig + # CHECK-NOT: SEHTable + + .def @feat.00; + .scl 3; + .type 0; + .endef + .globl @feat.00 + @feat.00 = 1 + + .text + .def _main; .scl 2; .type 32; .endef + .globl _main + _main: + pushl $_my_handler + movl $42, %eax + popl %ecx + ret + + .def _my_handler; .scl 3; .type 32; .endef + _my_handler: + ret + + .safeseh _my_handler +Index: test/COFF/safeseh.s +=================================================================== +--- test/COFF/safeseh.s (revision 333896) ++++ test/COFF/safeseh.s (working copy) +@@ -1,79 +1,80 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple i686-windows-msvc %s -filetype=obj -o %t.obj + # RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:noref -entry:main + # RUN: llvm-readobj -coff-basereloc -coff-load-config -file-headers %t.exe | FileCheck %s --check-prefix=CHECK-NOGC + # RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:noref -entry:main -debug:dwarf + # RUN: llvm-readobj -coff-basereloc -coff-load-config -file-headers %t.exe | FileCheck %s --check-prefix=CHECK-NOGC + # RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:ref -entry:main + # RUN: llvm-readobj -coff-basereloc -coff-load-config -file-headers %t.exe | FileCheck %s --check-prefix=CHECK-GC + + # __safe_se_handler_table needs to be relocated against ImageBase. + # check that the relocation is present. + # + # CHECK-NOGC-NOT: IMAGE_DLL_CHARACTERISTICS_NO_SEH + # CHECK-NOGC: BaseReloc [ + # CHECK-NOGC: Entry { + # CHECK-NOGC: Type: HIGHLOW + # CHECK-NOGC: LoadConfig [ + # CHECK-NOGC: Size: 0x48 + # CHECK-NOGC: SEHandlerTable: 0x + # CHECK-NOGC: SEHandlerCount: 1 + # CHECK-NOGC: ] + # CHECK-NOGC: SEHTable [ + # CHECK-NOGC-NEXT: 0x401006 + # CHECK-NOGC-NEXT: ] + + # If we enable GC, the exception handler should be removed, and we should add + # the DLL characteristic flag that indicates that there are no exception + # handlers in this DLL. The exception handler table in the load config should + # be empty and there should be no relocations for it. + # + # CHECK-GC: Characteristics [ + # CHECK-GC: IMAGE_DLL_CHARACTERISTICS_NO_SEH + # CHECK-GC: ] + # CHECK-GC: BaseReloc [ + # CHECK-GC-NEXT: ] + # CHECK-GC: LoadConfig [ + # CHECK-GC: Size: 0x48 + # CHECK-GC: SEHandlerTable: 0x0 + # CHECK-GC: SEHandlerCount: 0 + # CHECK-GC: ] + # CHECK-GC-NOT: SEHTable + + + .def @feat.00; + .scl 3; + .type 0; + .endef + .globl @feat.00 + @feat.00 = 1 + + .def _main; + .scl 2; + .type 32; + .endef + .section .text,"xr",one_only,_main + .globl _main + _main: + movl $42, %eax + ret + + # This handler can be GCd, which will make the safeseh table empty, so it should + # appear null. + .def _my_handler; + .scl 3; + .type 32; + .endef + .section .text,"xr",one_only,_my_handler + _my_handler: + ret + + .safeseh _my_handler + + + .section .rdata,"dr" + .globl __load_config_used + __load_config_used: + .long 72 + .fill 60, 1, 0 + .long ___safe_se_handler_table + .long ___safe_se_handler_count +Index: test/COFF/secidx-absolute.s +=================================================================== +--- test/COFF/secidx-absolute.s (revision 333896) ++++ test/COFF/secidx-absolute.s (working copy) +@@ -1,33 +1,34 @@ ++# REQUIRES: x86 + # RUN: llvm-mc %s -filetype=obj -triple=x86_64-windows-msvc -o %t.obj + # RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe + # RUN: llvm-readobj %t.exe -sections -section-data | FileCheck %s + + # Section relocations against absolute symbols resolve to the last real ouput + # section index plus one. + + .text + .global main + main: + ret + + .section .rdata,"dr" + .secidx __guard_fids_table + + # CHECK: Sections [ + # CHECK: Section { + # CHECK: Number: 1 + # CHECK: Name: .text (2E 74 65 78 74 00 00 00) + # CHECK: VirtualSize: 0x1 + # CHECK: SectionData ( + # CHECK: 0000: C3 |.| + # CHECK: ) + # CHECK: } + # CHECK: Section { + # CHECK: Number: 2 + # CHECK: Name: .rdata (2E 72 64 61 74 61 00 00) + # CHECK: SectionData ( + # CHECK: 0000: 0300 |..| + # CHECK: ) + # CHECK: } + # CHECK-NOT: Section + # CHECK: ] +Index: test/COFF/secrel-absolute.s +=================================================================== +--- test/COFF/secrel-absolute.s (revision 333896) ++++ test/COFF/secrel-absolute.s (working copy) +@@ -1,14 +1,15 @@ ++# REQUIRES: x86 + # RUN: llvm-mc %s -filetype=obj -triple=x86_64-windows-msvc -o %t.obj + # RUN: not lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe 2>&1 | FileCheck %s + + # secrel relocations against absolute symbols are errors. + + # CHECK: SECREL relocation cannot be applied to absolute symbols + + .text + .global main + main: + ret + + .section .rdata,"dr" + .secrel32 __guard_fids_table +Index: test/COFF/secrel-common.s +=================================================================== +--- test/COFF/secrel-common.s (revision 333896) ++++ test/COFF/secrel-common.s (working copy) +@@ -1,45 +1,46 @@ ++# REQUIRES: x86 + # RUN: llvm-mc %s -filetype=obj -triple=x86_64-windows-msvc -o %t.obj + # RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe + # RUN: llvm-readobj %t.exe -sections -section-data | FileCheck %s + + # Section relocations against common symbols resolve to .bss (merged into .data). + + # CHECK: Sections [ + # CHECK: Section { + # CHECK: Number: 1 + # CHECK: Name: .text (2E 74 65 78 74 00 00 00) + # CHECK: VirtualSize: 0x1 + # CHECK: SectionData ( + # CHECK: 0000: C3 |.| + # CHECK: ) + # CHECK: } + # CHECK: Section { + # CHECK: Number: 2 + # CHECK: Name: .rdata (2E 72 64 61 74 61 00 00) + # CHECK: SectionData ( + # CHECK: 0000: 00020000 03000000 |........| + # CHECK: ) + # CHECK: } + # CHECK: Section { + # CHECK: Number: 3 + # CHECK: Name: .data (2E 64 61 74 61 00 00 00) + # CHECK: VirtualSize: 0x204 + # CHECK: RawDataSize: 512 + # CHECK: } + # CHECK-NOT: Section + # CHECK: ] + + .text + .global main + main: + ret + + .comm common_global,4,2 + + .section .rdata,"dr" + .secrel32 common_global + .secidx common_global + .short 0 + + .section .data,"drw" + .zero 512 +Index: test/COFF/undefined-symbol-cv.s +=================================================================== +--- test/COFF/undefined-symbol-cv.s (revision 333896) ++++ test/COFF/undefined-symbol-cv.s (working copy) +@@ -1,61 +1,62 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s + # RUN: not lld-link /out:%t.exe %t.obj 2>&1 | FileCheck %s + + # CHECK: error: undefined symbol: ?foo@@YAHXZ + # CHECK-NEXT: >>> referenced by file1.cpp:1 + # CHECK-NEXT: >>> {{.*}}.obj:(main) + # CHECK-NEXT: >>> referenced by file1.cpp:2 + # CHECK-NEXT: >>> {{.*}}.obj:(main) + + # CHECK: error: undefined symbol: ?bar@@YAHXZ + # CHECK-NEXT: >>> referenced by file2.cpp:3 + # CHECK-NEXT: >>> {{.*}}.obj:(main) + # CHECK-NEXT: >>> referenced by file1.cpp:4 + # CHECK-NEXT: >>> {{.*}}.obj:(f1) + + # CHECK: error: undefined symbol: ?baz@@YAHXZ + # CHECK-NEXT: >>> referenced by file1.cpp:5 + # CHECK-NEXT: >>> {{.*}}.obj:(f2) + + .cv_file 1 "file1.cpp" "EDA15C78BB573E49E685D8549286F33C" 1 + .cv_file 2 "file2.cpp" "EDA15C78BB573E49E685D8549286F33D" 1 + + .section .text,"xr",one_only,main + .globl main + main: + .cv_func_id 0 + .cv_loc 0 1 1 0 is_stmt 0 + call "?foo@@YAHXZ" + .cv_loc 0 1 2 0 + call "?foo@@YAHXZ" + .cv_loc 0 2 3 0 + call "?bar@@YAHXZ" + .Lfunc_end0: + + f1: + .cv_func_id 1 + .cv_loc 1 1 4 0 is_stmt 0 + call "?bar@@YAHXZ" + .Lfunc_end1: + + .section .text,"xr",one_only,f2 + .globl f2 + f2: + .cv_func_id 2 + .cv_loc 2 1 5 0 is_stmt 0 + call "?baz@@YAHXZ" + .Lfunc_end2: + + .section .debug$S,"dr",associative,main + .long 4 + .cv_linetable 0, main, .Lfunc_end0 + .cv_linetable 1, f1, .Lfunc_end1 + + .section .debug$S,"dr",associative,f2 + .long 4 + .cv_linetable 2, f2, .Lfunc_end2 + + .section .debug$S,"dr" + .long 4 + .cv_filechecksums + .cv_stringtable +Index: test/COFF/undefined-symbol.s +=================================================================== +--- test/COFF/undefined-symbol.s (revision 333896) ++++ test/COFF/undefined-symbol.s (working copy) +@@ -1,29 +1,30 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s + # RUN: not lld-link /out:%t.exe %t.obj 2>&1 | FileCheck %s + + # CHECK: error: undefined symbol: ?foo@@YAHXZ + # CHECK-NEXT: >>> referenced by {{.*}}.obj:(main) + # CHECK-NEXT: >>> referenced by {{.*}}.obj:(main) + + # CHECK: error: undefined symbol: ?bar@@YAHXZ + # CHECK-NEXT: >>> referenced by {{.*}}.obj:(main) + # CHECK-NEXT: >>> referenced by {{.*}}.obj:(f1) + + # CHECK: error: undefined symbol: ?baz@@YAHXZ + # CHECK-NEXT: >>> referenced by {{.*}}.obj:(f2) + + .section .text,"xr",one_only,main + .globl main + main: + call "?foo@@YAHXZ" + call "?foo@@YAHXZ" + call "?bar@@YAHXZ" + + f1: + call "?bar@@YAHXZ" + .Lfunc_end1: + + .section .text,"xr",one_only,f2 + .globl f2 + f2: + call "?baz@@YAHXZ" +Index: test/COFF/weak-external.test +=================================================================== +--- test/COFF/weak-external.test (revision 333896) ++++ test/COFF/weak-external.test (working copy) +@@ -1,36 +1,37 @@ ++# REQUIRES: x86 + # RUN: yaml2obj %s > %t.obj + # RUN: llvm-as -o %t.lto.obj %S/Inputs/weak-external.ll + # RUN: lld-link /out:%t1.exe /entry:g /subsystem:console %t.obj + # RUN: lld-link /out:%t2.exe /entry:g /subsystem:console /lldmap:%t2.map %t.obj %t.lto.obj + # RUN: FileCheck %s < %t2.map + + # CHECK: lto.tmp + # CHECK-NEXT: lto.tmp + # CHECK-NEXT: 0 g + + --- !COFF + header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [ ] + sections: + - Name: '.text' + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: 00 + symbols: + - Name: 'g' + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_WEAK_EXTERNAL + WeakExternal: + TagIndex: 2 + Characteristics: IMAGE_WEAK_EXTERN_SEARCH_LIBRARY + - Name: 'f' + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + ... +Index: test/COFF/weak-external2.test +=================================================================== +--- test/COFF/weak-external2.test (revision 333896) ++++ test/COFF/weak-external2.test (working copy) +@@ -1,30 +1,31 @@ ++# REQUIRES: x86 + # RUN: yaml2obj %s > %t.obj + # RUN: llvm-as -o %t.lto.obj %S/Inputs/weak-external2.ll + # RUN: lld-link /out:%t.exe /entry:g /subsystem:console %t.obj %t.lto.obj + + --- !COFF + header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [ ] + sections: + - Name: '.text' + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: 00 + symbols: + - Name: 'f' + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: 'g' + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_WEAK_EXTERNAL + WeakExternal: + TagIndex: 0 + Characteristics: IMAGE_WEAK_EXTERN_SEARCH_LIBRARY + ... +Index: test/COFF/weak-external3.test +=================================================================== +--- test/COFF/weak-external3.test (revision 333896) ++++ test/COFF/weak-external3.test (working copy) +@@ -1,31 +1,32 @@ ++# REQUIRES: x86 + # RUN: yaml2obj %s > %t.obj + # RUN: llvm-as -o %t.lto.obj %S/Inputs/weak-external3.ll + # RUN: lld-link /out:%t1.exe /entry:f /subsystem:console /lldmap:%t1.map %t.lto.obj + # RUN: FileCheck --check-prefix=CHECK1 %s < %t1.map + # RUN: lld-link /out:%t2.exe /entry:f /subsystem:console /lldmap:%t2.map %t.obj %t.lto.obj + # RUN: FileCheck --check-prefix=CHECK2 %s < %t2.map + + # CHECK1: lto.tmp + # CHECK1: lto.tmp + # CHECK1-NEXT: 0 g + + # CHECK2: weak-external3.test.tmp.obj + # CHECK2-NEXT: 0 f + + --- !COFF + header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [ ] + sections: + - Name: '.text' + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: 00 + symbols: + - Name: 'f' + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + ... +Index: test/COFF/wholearchive.s +=================================================================== +--- test/COFF/wholearchive.s (revision 333896) ++++ test/COFF/wholearchive.s (working copy) +@@ -1,19 +1,19 @@ +-# REQEUIRES: x86 ++# REQUIRES: x86 + + # RUN: yaml2obj < %p/Inputs/export.yaml > %t.archive.obj + # RUN: llvm-ar rcs %t.archive.lib %t.archive.obj + # RUN: llvm-mc -triple=x86_64-windows-msvc %s -filetype=obj -o %t.main.obj + + # RUN: lld-link -dll -out:%t.dll -entry:main %t.main.obj -wholearchive:%t.archive.lib -implib:%t.lib + # RUN: llvm-readobj %t.lib | FileCheck %s -check-prefix CHECK-IMPLIB + + # RUN: lld-link -dll -out:%t.dll -entry:main %t.main.obj -wholearchive %t.archive.lib -implib:%t.lib + # RUN: llvm-readobj %t.lib | FileCheck %s -check-prefix CHECK-IMPLIB + + # CHECK-IMPLIB: Symbol: __imp_exportfn3 + # CHECK-IMPLIB: Symbol: exportfn3 + + .global main + .text + main: + ret +Index: test/ELF/bsymbolic-undef.s +=================================================================== +--- test/ELF/bsymbolic-undef.s (revision 333896) ++++ test/ELF/bsymbolic-undef.s (working copy) +@@ -1,26 +1,27 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + # RUN: ld.lld -shared -Bsymbolic %t.o -o %t.so + # RUN: llvm-readobj -dyn-symbols %t.so | FileCheck %s + + # CHECK: DynamicSymbols [ + # CHECK-NEXT: Symbol { + # CHECK-NEXT: Name: @ + # CHECK-NEXT: Value: 0x0 + # CHECK-NEXT: Size: 0 + # CHECK-NEXT: Binding: Local (0x0) + # CHECK-NEXT: Type: None (0x0) + # CHECK-NEXT: Other: 0 + # CHECK-NEXT: Section: Undefined (0x0) + # CHECK-NEXT: } + # CHECK-NEXT: Symbol { + # CHECK-NEXT: Name: undef@ + # CHECK-NEXT: Value: 0x0 + # CHECK-NEXT: Size: 0 + # CHECK-NEXT: Binding: Global (0x1) + # CHECK-NEXT: Type: None (0x0) + # CHECK-NEXT: Other: 0 + # CHECK-NEXT: Section: Undefined (0x0) + # CHECK-NEXT: } + # CHECK-NEXT: ] + + call undef@PLT +Index: test/ELF/bsymbolic.s +=================================================================== +--- test/ELF/bsymbolic.s (revision 333896) ++++ test/ELF/bsymbolic.s (working copy) +@@ -1,34 +1,35 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + // RUN: ld.lld -shared %t.o -o %t0.so + // RUN: ld.lld -shared -Bsymbolic %t.o -o %t1.so + // RUN: ld.lld -shared -Bsymbolic-functions %t.o -o %t2.so + // RUN: llvm-readobj -s %t0.so | FileCheck -check-prefix=NOOPTION %s + // RUN: llvm-readobj -s %t1.so | FileCheck -check-prefix=SYMBOLIC %s + // RUN: llvm-readobj -s %t2.so | FileCheck -check-prefix=SYMBOLIC %s + + // NOOPTION: Section { + // NOOPTION: Name: .plt + + // SYMBOLIC: Section { + // SYMBOLIC-NOT: Name: .plt + + .text + .globl foo + .type foo,@function + foo: + nop + + .globl bar + .type bar,@function + bar: + nop + + .globl do + .type do,@function + do: + callq foo@PLT + callq bar@PLT + + .weak zed + .protected zed + .quad zed +Index: test/ELF/comdat-linkonce.s +=================================================================== +--- test/ELF/comdat-linkonce.s (revision 333896) ++++ test/ELF/comdat-linkonce.s (working copy) +@@ -1,9 +1,10 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/comdat.s -o %t2.o + // RUN: ld.lld -shared %t.o %t2.o -o %t + // RUN: ld.lld -shared %t2.o %t.o -o %t + + .section .gnu.linkonce.t.zed + .globl abc + abc: + nop +Index: test/ELF/compatible-section-types.s +=================================================================== +--- test/ELF/compatible-section-types.s (revision 333896) ++++ test/ELF/compatible-section-types.s (working copy) +@@ -1,20 +1,21 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + // RUN: ld.lld -shared %t.o -o %t + // RUN: llvm-objdump -section-headers %t | FileCheck %s + + // CHECK: .foo {{0*}}28 + + .section .foo, "aw", @progbits, unique, 1 + .quad 0 + + .section .foo, "aw", @init_array, unique, 2 + .quad 0 + + .section .foo, "aw", @preinit_array, unique, 3 + .quad 0 + + .section .foo, "aw", @fini_array, unique, 4 + .quad 0 + + .section .foo, "aw", @note, unique, 5 + .quad 0 +Index: test/ELF/conflict-debug-variable.s +=================================================================== +--- test/ELF/conflict-debug-variable.s (revision 333896) ++++ test/ELF/conflict-debug-variable.s (working copy) +@@ -1,144 +1,145 @@ ++// REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + # RUN: llvm-dwarfdump %t.o | FileCheck -check-prefix=INPUT %s + # RUN: not ld.lld %t.o %t.o -o %t 2>&1 | FileCheck %s + + # INPUT: .debug_info contents: + # INPUT: DW_TAG_variable + # INPUT-NEXT: DW_AT_name ("foo") + # INPUT-NEXT: DW_AT_decl_file ("1.c") + # INPUT-NEXT: DW_AT_decl_line (1) + # INPUT-NEXT: DW_AT_type (0x00000032 "int") + # INPUT-NEXT: DW_AT_external (true) + # INPUT-NEXT: DW_AT_location (DW_OP_addr 0x0) + # INPUT: DW_TAG_variable + # INPUT-NEXT: DW_AT_name ("bar") + # INPUT-NEXT: DW_AT_decl_file ("1.c") + # INPUT-NEXT: DW_AT_decl_line (2) + # INPUT-NEXT: DW_AT_type (0x00000032 "int") + # INPUT-NEXT: DW_AT_external (true) + # INPUT-NEXT: DW_AT_location (DW_OP_addr 0x0) + + ## Check we use information from .debug_info in messages. + # CHECK: duplicate symbol: bar + # CHECK-NEXT: >>> defined at 1.c:2 + # CHECK-NEXT: >>> {{.*}}:(bar) + # CHECK-NEXT: >>> defined at 1.c:2 + # CHECK-NEXT: >>> {{.*}}:(.data+0x0) + # CHECK: duplicate symbol: foo + # CHECK-NEXT: >>> defined at 1.c:1 + # CHECK-NEXT: >>> {{.*}}:(foo) + # CHECK-NEXT: >>> defined at 1.c:1 + # CHECK-NEXT: >>> {{.*}}:(.bss+0x0) + + ## Check that stripping debug sections does not break error reporting. + # RUN: not ld.lld --strip-debug %t.o %t.o -o %t 2>&1 | FileCheck %s + + # Used reduced output from following code and gcc 7.1.0 + # to produce this input file: + # Source (1.c): + # int foo = 0; + # int bar = 1; + # Invocation: g++ -g -S 1.c + + .bss + .globl foo + .type foo, @object + .size foo, 4 + foo: + + .data + .globl bar + .type bar, @object + .size bar, 4 + bar: + + .text + .file 1 "1.c" + + .section .debug_info,"",@progbits + .long 0x4b # Compile Unit: length = 0x0000004b) + .value 0x4 # version = 0x0004 + .long 0 # abbr_offset = 0x0 + .byte 0x8 # addr_size = 0x08 + + .uleb128 0x1 # DW_TAG_compile_unit [1] * + .long 0 # DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = ) + .byte 0x4 # DW_AT_language [DW_FORM_data1] (DW_LANG_C_plus_plus) + .string "1.c" # DW_AT_name [DW_FORM_string] ("1.c") + .long 0 # DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000000] = ) + .long 0 # DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000) + + .uleb128 0x2 # DW_TAG_variable [2] + .string "foo" # DW_AT_name [DW_FORM_string] ("foo") + .byte 0x1 # DW_AT_decl_file [DW_FORM_data1] ("1.c") + .byte 0x1 # DW_AT_decl_line [DW_FORM_data1] (1) + .long 0x32 # DW_AT_type [DW_FORM_ref4] (cu + 0x0032 => {0x00000032}) + .uleb128 0x9 # DW_AT_external [DW_FORM_flag_present] (true) + .byte 0x3 + .quad foo # DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x0) + + .uleb128 0x3 # DW_TAG_base_type [3] + .byte 0x4 # DW_AT_byte_size [DW_FORM_data1] (0x04) + .byte 0x5 # DW_AT_encoding [DW_FORM_data1] (DW_ATE_signed) + .string "int" # DW_AT_name [DW_FORM_string] ("int") + + .uleb128 0x2 # DW_TAG_variable [2] + .string "bar" # DW_AT_name [DW_FORM_string] ("bar") + .byte 0x1 # DW_AT_decl_file [DW_FORM_data1] ("1.c") + .byte 0x2 # DW_AT_decl_line [DW_FORM_data1] (2) + .long 0x32 # DW_AT_type [DW_FORM_ref4] (cu + 0x0032 => {0x00000032}) + .uleb128 0x9 # DW_AT_external [DW_FORM_flag_present] (true) + .byte 0x3 + .quad bar # DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x0) + .byte 0 # END + + + .section .debug_abbrev,"",@progbits + .uleb128 0x1 # Abbreviation code. + .uleb128 0x11 # DW_TAG_compile_unit + + .byte 0x1 # ID + .uleb128 0x25 # DW_AT_producer, DW_FORM_strp + .uleb128 0xe + .uleb128 0x13 # DW_AT_language, DW_FORM_data1 + .uleb128 0xb + .uleb128 0x3 # DW_AT_name, DW_FORM_string + .uleb128 0x8 + .uleb128 0x1b # DW_AT_comp_dir, DW_FORM_strp + .uleb128 0xe + .uleb128 0x10 # DW_AT_stmt_list, DW_FORM_sec_offset + .uleb128 0x17 + .byte 0 + .byte 0 + + .uleb128 0x2 # ID + .uleb128 0x34 # DW_TAG_variable, DW_CHILDREN_no + .byte 0 + .uleb128 0x3 # DW_AT_name, DW_FORM_string + .uleb128 0x8 + .uleb128 0x3a # DW_AT_decl_file, DW_FORM_data1 + .uleb128 0xb + .uleb128 0x3b # DW_AT_decl_line, DW_FORM_data1 + .uleb128 0xb + .uleb128 0x49 # DW_AT_type, DW_FORM_ref4 + .uleb128 0x13 + .uleb128 0x3f # DW_AT_external, DW_FORM_flag_present + .uleb128 0x19 + .uleb128 0x2 # DW_AT_location, DW_FORM_exprloc + .uleb128 0x18 + .byte 0 + .byte 0 + + .uleb128 0x3 # ID + .uleb128 0x24 # DW_TAG_base_type, DW_CHILDREN_no + .byte 0 + .uleb128 0xb # DW_AT_byte_size, DW_FORM_data1 + .uleb128 0xb + .uleb128 0x3e # DW_AT_encoding, DW_FORM_data1 + .uleb128 0xb + .uleb128 0x3 # DW_AT_name, DW_FORM_string + .uleb128 0x8 + .byte 0 + .byte 0 + .byte 0 + +Index: test/ELF/conflict-debug-variable2.s +=================================================================== +--- test/ELF/conflict-debug-variable2.s (revision 333896) ++++ test/ELF/conflict-debug-variable2.s (working copy) +@@ -1,160 +1,161 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + + # RUN: llvm-dwarfdump -v %t.o | FileCheck -check-prefix=INPUT %s + # INPUT: .debug_info contents: + # INPUT: DW_TAG_variable + # INPUT-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000027] = "foo") + # INPUT-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0033 => {0x00000033} "int") + # INPUT-NEXT: DW_AT_external [DW_FORM_flag_present] (true) + # INPUT-NEXT: DW_AT_decl_file [DW_FORM_data1] ("/home/path/test.c") + # INPUT-NEXT: DW_AT_decl_line [DW_FORM_data1] (1) + # INPUT-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x0) + # INPUT: DW_TAG_variable + # INPUT-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000002f] = "bar") + # INPUT-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0033 => {0x00000033} "int") + # INPUT-NEXT: DW_AT_external [DW_FORM_flag_present] (true) + # INPUT-NEXT: DW_AT_decl_file [DW_FORM_data1] ("/home/path/test.c") + # INPUT-NEXT: DW_AT_decl_line [DW_FORM_data1] (2) + # INPUT-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x0) + + ## Check we use information from .debug_info in messages. + # RUN: not ld.lld %t.o %t.o -o %t 2>&1 | FileCheck %s + # CHECK: duplicate symbol: bar + # CHECK-NEXT: >>> defined at test.c:2 + # CHECK-NEXT: >>> {{.*}}:(bar) + # CHECK-NEXT: >>> defined at test.c:2 + # CHECK-NEXT: >>> {{.*}}:(.data+0x0) + # CHECK: duplicate symbol: foo + # CHECK-NEXT: >>> defined at test.c:1 + # CHECK-NEXT: >>> {{.*}}:(foo) + # CHECK-NEXT: >>> defined at test.c:1 + # CHECK-NEXT: >>> {{.*}}:(.bss+0x0) + + # Used reduced output from following code and clang + # version 6.0.0 (trunk 316661) to produce this input file: + # Source (test.c): + # int foo = 0; + # int bar = 1; + # Invocation: clang -g -S test.c + + .text + .file "test.c" + .file 1 "test.c" + + .type foo,@object + .bss + .globl foo + .p2align 2 + foo: + .long 0 + .size foo, 4 + + .type bar,@object + .data + .globl bar + .p2align 2 + bar: + .long 1 + .size bar, 4 + + .section .debug_str,"MS",@progbits,1 + .Linfo_string0: + .asciz "clang version 6.0.0" + .Linfo_string1: + .asciz "test.c" + .Linfo_string2: + .asciz "/home/path/" + .Linfo_string3: + .asciz "foo" + .Linfo_string4: + .asciz "int" + .Linfo_string5: + .asciz "bar" + + .section .debug_abbrev,"",@progbits + .byte 1 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 1 # DW_CHILDREN_yes + .byte 37 # DW_AT_producer + .byte 14 # DW_FORM_strp + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 16 # DW_AT_stmt_list + .byte 23 # DW_FORM_sec_offset + .byte 27 # DW_AT_comp_dir + .byte 14 # DW_FORM_strp + .ascii "\264B" # DW_AT_GNU_pubnames + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + + .byte 2 # Abbreviation Code + .byte 52 # DW_TAG_variable + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 63 # DW_AT_external + .byte 25 # DW_FORM_flag_present + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 2 # DW_AT_location + .byte 24 # DW_FORM_exprloc + .byte 0 # EOM(1) + .byte 0 # EOM(2) + + .byte 3 # Abbreviation Code + .byte 36 # DW_TAG_base_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 62 # DW_AT_encoding + .byte 11 # DW_FORM_data1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 0 # EOM(3) + + .section .debug_info,"",@progbits + .Lcu_begin0: + .long 76 # Length of Unit + .short 4 # DWARF version number + .long .debug_abbrev # Offset Into Abbrev. Section + .byte 8 # Address Size (in bytes) + + .byte 1 # Abbrev [1] 0xb:0x45 DW_TAG_compile_unit + .long .Linfo_string0 # DW_AT_producer + .short 12 # DW_AT_language + .long .Linfo_string1 # DW_AT_name + .long 0 # DW_AT_stmt_list + .long .Linfo_string2 # DW_AT_comp_dir + + .byte 2 # Abbrev [2] 0x1e:0x15 DW_TAG_variable + .long .Linfo_string3 # DW_AT_name + .long 51 # DW_AT_type + .byte 1 # DW_AT_decl_file + .byte 1 # DW_AT_decl_line + .byte 9 # DW_AT_location + .byte 3 + .quad foo + + .byte 3 # Abbrev [3] 0x33:0x7 DW_TAG_base_type + .long .Linfo_string4 # DW_AT_name + .byte 5 # DW_AT_encoding + .byte 4 # DW_AT_byte_size + + .byte 2 # Abbrev [2] 0x3a:0x15 DW_TAG_variable + .long .Linfo_string5 # DW_AT_name + .long 51 # DW_AT_type + .byte 1 # DW_AT_decl_file + .byte 2 # DW_AT_decl_line + .byte 9 # DW_AT_location + .byte 3 + .quad bar + .byte 0 # End Of Children Mark +Index: test/ELF/conflict-variable-linkage-name.s +=================================================================== +--- test/ELF/conflict-variable-linkage-name.s (revision 333896) ++++ test/ELF/conflict-variable-linkage-name.s (working copy) +@@ -1,193 +1,194 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + # RUN: llvm-dwarfdump %t.o | FileCheck -check-prefix=INPUT %s + # RUN: not ld.lld %t.o %t.o -o %t 2>&1 | FileCheck %s + + # INPUT: DW_TAG_variable + # INPUT-NEXT: DW_AT_name ("bar") + # INPUT-NEXT: DW_AT_type (0x0000003d "int") + # INPUT-NEXT: DW_AT_external (true) + # INPUT-NEXT: DW_AT_decl_file ("/path{{/|\\}}1.cpp") + # INPUT-NEXT: DW_AT_decl_line (2) + # INPUT-NEXT: DW_AT_location (DW_OP_addr 0x0) + # INPUT-NEXT: DW_AT_linkage_name ("_ZN1A3barE") + # INPUT: DW_TAG_variable + # INPUT-NEXT: DW_AT_name ("bar") + # INPUT-NEXT: DW_AT_type (0x0000003d "int") + # INPUT-NEXT: DW_AT_external (true) + # INPUT-NEXT: DW_AT_decl_file ("/path{{/|\\}}1.cpp") + # INPUT-NEXT: DW_AT_decl_line (6) + # INPUT-NEXT: DW_AT_location (DW_OP_addr 0x0) + # INPUT-NEXT: DW_AT_linkage_name ("_ZN1Z3barE") + + ## Check we can report the locations of 2 different "bar" variables. + # CHECK: duplicate symbol: A::bar + # CHECK-NEXT: >>> defined at 1.cpp:2 + # CHECK-NEXT: >>> {{.*}}:(A::bar) + # CHECK-NEXT: >>> defined at 1.cpp:2 + # CHECK-NEXT: >>> {{.*}}:(.bss+0x0) + # CHECK: duplicate symbol: Z::bar + # CHECK-NEXT: >>> defined at 1.cpp:6 + # CHECK-NEXT: >>> {{.*}}:(Z::bar) + # CHECK-NEXT: >>> defined at 1.cpp:6 + # CHECK-NEXT: >>> {{.*}}:(.data+0x0) + + # Used reduced output from following code and clang version 7.0.0 (trunk 332701) + # to produce this input file: + # Source (1.cpp): + # namespace A { + # int bar; + # } + # + # namespace Z { + # int bar; + # } + # Invocation: clang-7 -g -S 1.cpp + + .text + .file "1.cpp" + .file 1 "/path" "1.cpp" + + .type _ZN1A3barE,@object + .bss + .globl _ZN1A3barE + _ZN1A3barE: + .long 0 + .size _ZN1A3barE, 4 + + .type _ZN1Z3barE,@object + .data + .globl _ZN1Z3barE + _ZN1Z3barE: + .long 1 + .size _ZN1Z3barE, 4 + + .section .debug_str,"MS",@progbits,1 + .Linfo_string0: + .asciz "clang version 7.0.0 (trunk 332701)" # string offset=0 + .Linfo_string1: + .asciz "1.cpp" # string offset=35 + .Linfo_string2: + .asciz "/path" # string offset=41 + .Linfo_string3: + .asciz "A" # string offset=87 + .Linfo_string4: + .asciz "bar" # string offset=89 + .Linfo_string5: + .asciz "int" # string offset=93 + .Linfo_string6: + .asciz "_ZN1A3barE" # string offset=97 + .Linfo_string7: + .asciz "Z" # string offset=108 + .Linfo_string8: + .asciz "_ZN1Z3barE" # string offset=110 + + .section .debug_abbrev,"",@progbits + .byte 1 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 1 # DW_CHILDREN_yes + .byte 37 # DW_AT_producer + .byte 14 # DW_FORM_strp + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 16 # DW_AT_stmt_list + .byte 23 # DW_FORM_sec_offset + .byte 27 # DW_AT_comp_dir + .byte 14 # DW_FORM_strp + .ascii "\264B" # DW_AT_GNU_pubnames + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + + .byte 2 # Abbreviation Code + .byte 57 # DW_TAG_namespace + .byte 1 # DW_CHILDREN_yes + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 0 # EOM(1) + .byte 0 # EOM(2) + + .byte 3 # Abbreviation Code + .byte 52 # DW_TAG_variable + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 63 # DW_AT_external + .byte 25 # DW_FORM_flag_present + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 2 # DW_AT_location + .byte 24 # DW_FORM_exprloc + .byte 110 # DW_AT_linkage_name + .byte 14 # DW_FORM_strp + .byte 0 # EOM(1) + .byte 0 # EOM(2) + + .byte 4 # Abbreviation Code + .byte 36 # DW_TAG_base_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 62 # DW_AT_encoding + .byte 11 # DW_FORM_data1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 0 # EOM(3) + + .section .debug_info,"",@progbits + .long 96 # Length of Unit + .short 4 # DWARF version number + .long .debug_abbrev # Offset Into Abbrev. Section + .byte 8 # Address Size (in bytes) + + .byte 1 # Abbrev [1] 0xb:0x59 DW_TAG_compile_unit + .long .Linfo_string0 # DW_AT_producer + .short 4 # DW_AT_language + .long .Linfo_string1 # DW_AT_name + .long 0 # DW_AT_stmt_list + .long .Linfo_string2 # DW_AT_comp_dir + # DW_AT_GNU_pubnames + + .byte 2 # Abbrev [2] 0x1e:0x1f DW_TAG_namespace + .long .Linfo_string3 # DW_AT_name + + .byte 3 # Abbrev [3] 0x23:0x19 DW_TAG_variable + .long .Linfo_string4 # DW_AT_name + .long 61 # DW_AT_type + # DW_AT_external + .byte 1 # DW_AT_decl_file + .byte 2 # DW_AT_decl_line + .byte 9 # DW_AT_location + .byte 3 + .quad _ZN1A3barE + .long .Linfo_string6 # DW_AT_linkage_name + .byte 0 # End Of Children Mark + + .byte 4 # Abbrev [4] 0x3d:0x7 DW_TAG_base_type + .long .Linfo_string5 # DW_AT_name + .byte 5 # DW_AT_encoding + .byte 4 # DW_AT_byte_size + + .byte 2 # Abbrev [2] 0x44:0x1f DW_TAG_namespace + .long .Linfo_string7 # DW_AT_name + + .byte 3 # Abbrev [3] 0x49:0x19 DW_TAG_variable + .long .Linfo_string4 # DW_AT_name + .long 61 # DW_AT_type + # DW_AT_external + .byte 1 # DW_AT_decl_file + .byte 6 # DW_AT_decl_line + .byte 9 # DW_AT_location + .byte 3 + .quad _ZN1Z3barE + .long .Linfo_string8 # DW_AT_linkage_name + + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark +Index: test/ELF/copy-rel-corrupted.s +=================================================================== +--- test/ELF/copy-rel-corrupted.s (revision 333896) ++++ test/ELF/copy-rel-corrupted.s (working copy) +@@ -1,10 +1,11 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux + // RUN: llvm-mc %p/Inputs/copy-rel-corrupted.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux + // RUN: ld.lld %t2.o -o %t2.so -shared + // RUN: not ld.lld %t.o %t2.so -o %t.exe 2>&1 | FileCheck %s + + // CHECK: error: cannot create a copy relocation for symbol x + + .global _start + _start: + .long x - . +Index: test/ELF/copy-rel-pie-error.s +=================================================================== +--- test/ELF/copy-rel-pie-error.s (revision 333896) ++++ test/ELF/copy-rel-pie-error.s (working copy) +@@ -1,17 +1,18 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux + // RUN: llvm-mc %p/Inputs/copy-rel-pie.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux + // RUN: ld.lld %t2.o -o %t2.so -shared + // RUN: not ld.lld %t.o %t2.so -o %t.exe -pie 2>&1 | FileCheck %s + + // CHECK: can't create dynamic relocation R_X86_64_64 against symbol: bar in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output + // CHECK: >>> defined in {{.*}}.so + // CHECK: >>> referenced by {{.*}}.o:(.text+0x0) + + // CHECK: can't create dynamic relocation R_X86_64_64 against symbol: foo in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output + // CHECK: >>> defined in {{.*}}.so + // CHECK: >>> referenced by {{.*}}.o:(.text+0x8) + + .global _start + _start: + .quad bar + .quad foo +Index: test/ELF/copy-rel-pie.s +=================================================================== +--- test/ELF/copy-rel-pie.s (revision 333896) ++++ test/ELF/copy-rel-pie.s (working copy) +@@ -1,46 +1,47 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux + // RUN: llvm-mc %p/Inputs/copy-rel-pie.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux + // RUN: ld.lld %t2.o -o %t2.so -shared + // RUN: ld.lld --hash-style=sysv %t.o %t2.so -o %t.exe -pie + // RUN: llvm-readobj -s -r %t.exe | FileCheck %s + // RUN: llvm-objdump -d %t.exe | FileCheck --check-prefix=DISASM %s + + .global _start + _start: + .byte 0xe8 + .long bar - . -4 + .byte 0xe8 + .long foo - . -4 + + // CHECK: Name: .plt + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_EXECINSTR + // CHECK-NEXT: ] + // CHECK-NEXT: Address: 0x1010 + + // CHECK: Name: .bss + // CHECK-NEXT: Type: SHT_NOBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_WRITE + // CHECK-NEXT: ] + // CHECK-NEXT: Address: 0x4000 + + // CHECK: Relocations [ + // CHECK-NEXT: Section (4) .rela.dyn { + // CHECK-NEXT: 0x4000 R_X86_64_COPY foo 0x0 + // CHECK-NEXT: } + // CHECK-NEXT: Section (5) .rela.plt { + // CHECK-NEXT: 0x2018 R_X86_64_JUMP_SLOT bar 0x0 + // CHECK-NEXT: } + // CHECK-NEXT: ] + + // (0x1010 + 0x10) - 0x1005 = 27 + // 0x4000 - 0x100a = 12278 + + // DISASM: Disassembly of section .text: + // DISASM-NEXT: _start: + // DISASM-NEXT: 1000: e8 1b 00 00 00 callq 27 + // DISASM-NEXT: 1005: e8 f6 2f 00 00 callq 12278 +Index: test/ELF/defined-tls_get_addr.s +=================================================================== +--- test/ELF/defined-tls_get_addr.s (revision 333896) ++++ test/ELF/defined-tls_get_addr.s (working copy) +@@ -1,10 +1,11 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -triple x86_64-pc-linux -filetype=obj + // RUN: ld.lld %t.o -o %t + + // Don't error if __tls_get_addr is defined. + + .global _start + .global __tls_get_addr + _start: + __tls_get_addr: + nop +Index: test/ELF/dont-export-hidden.s +=================================================================== +--- test/ELF/dont-export-hidden.s (revision 333896) ++++ test/ELF/dont-export-hidden.s (working copy) +@@ -1,39 +1,40 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %p/Inputs/shared.s -o %t.o -filetype=obj -triple=x86_64-pc-linux + // RUN: llvm-mc %s -o %t2.o -filetype=obj -triple=x86_64-pc-linux + // RUN: ld.lld %t.o -o %t.so -shared + // RUN: ld.lld %t2.o %t.so -o %t.exe + // RUN: llvm-readobj --dyn-symbols %t.exe | FileCheck %s + + .global _start + _start: + .global bar + .hidden bar + bar: + + .global bar2 + bar2: + + .global foo + foo: + + // CHECK: DynamicSymbols [ + // CHECK-NEXT: Symbol { + // CHECK-NEXT: Name: @ + // CHECK-NEXT: Value: 0x0 + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Local + // CHECK-NEXT: Type: None + // CHECK-NEXT: Other: 0 + // CHECK-NEXT: Section: Undefined + // CHECK-NEXT: } + // CHECK-NEXT: Symbol { + // CHECK-NEXT: Name: bar2 + // CHECK-NEXT: Value: + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Global + // CHECK-NEXT: Type: None + // CHECK-NEXT: Other: 0 + // CHECK-NEXT: Section: .text + // CHECK-NEXT: } + // CHECK-NEXT: ] + +Index: test/ELF/duplicated-synthetic-sym.s +=================================================================== +--- test/ELF/duplicated-synthetic-sym.s (revision 333896) ++++ test/ELF/duplicated-synthetic-sym.s (working copy) +@@ -1,16 +1,17 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + // RUN: rm -rf %t.dir + // RUN: mkdir %t.dir + // RUN: cd %t.dir + // RUN: echo > file.bin + + // RUN: not ld.lld %t.o --format=binary file.bin -o %t.elf 2>&1 | FileCheck %s + // RUN: not ld.lld %t.o --format binary file.bin -o %t.elf 2>&1 | FileCheck %s + + // CHECK: duplicate symbol: _binary_file_bin_start + // CHECK-NEXT: defined at {{.*}}.o:(.text+0x0) + // CHECK-NEXT: defined at file.bin:(.data+0x0) + + .globl _binary_file_bin_start + _binary_file_bin_start: + .long 0 +Index: test/ELF/dynamic-reloc-index.s +=================================================================== +--- test/ELF/dynamic-reloc-index.s (revision 333896) ++++ test/ELF/dynamic-reloc-index.s (working copy) +@@ -1,21 +1,22 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o + // RUN: ld.lld -shared %t2.o -o %t2.so + // RUN: ld.lld %t.o %t2.so -o %t + // RUN: llvm-readobj -r %t | FileCheck %s + + // We used to record the wrong symbol index for this test + + // CHECK: Relocations [ + // CHECK-NEXT: Section ({{.*}}) .rela.plt { + // CHECK-NEXT: 0x202018 R_X86_64_JUMP_SLOT bar 0x0 + // CHECK-NEXT: } + // CHECK-NEXT: ] + + .global foobar + foobar: + .global zedx + zedx: + .global _start + _start: + .quad bar +Index: test/ELF/eh-frame-marker.s +=================================================================== +--- test/ELF/eh-frame-marker.s (revision 333896) ++++ test/ELF/eh-frame-marker.s (working copy) +@@ -1,19 +1,20 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux + // RUN: ld.lld --eh-frame-hdr %t.o -o %t.so -shared + // RUN: llvm-readobj -t -s %t.so | FileCheck %s + // We used to crash on this. + + // CHECK: Name: .eh_frame_hdr + // CHECK: Name: .eh_frame + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: ] + // CHECK-NEXT: Address: [[ADDR:.*]] + + // CHECK: Name: foo + // CHECK-NEXT: Value: [[ADDR]] + + .section .eh_frame + foo: + .long 0 +Index: test/ELF/eh-frame-multilpe-cie.s +=================================================================== +--- test/ELF/eh-frame-multilpe-cie.s (revision 333896) ++++ test/ELF/eh-frame-multilpe-cie.s (working copy) +@@ -1,12 +1,13 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux + // RUN: ld.lld --eh-frame-hdr %t.o -o %t.so -shared + // We would fail to parse multiple cies in the same file. + + .cfi_startproc + .cfi_personality 0x9b, foo + .cfi_endproc + + .cfi_startproc + .cfi_endproc + + foo: +Index: test/ELF/empty-archive.s +=================================================================== +--- test/ELF/empty-archive.s (revision 333896) ++++ test/ELF/empty-archive.s (working copy) +@@ -1,3 +1,4 @@ ++// REQUIRES: x86 + // RUN: llvm-ar rc %t.a + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + // RUN: ld.lld -shared %t.o %t.a -o %t +Index: test/ELF/entry.s +=================================================================== +--- test/ELF/entry.s (revision 333896) ++++ test/ELF/entry.s (working copy) +@@ -1,53 +1,54 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 + + # RUN: ld.lld -e foobar %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN1 %s + # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=TEXT %s + + # WARN1: warning: cannot find entry symbol foobar; defaulting to 0x201000 + # TEXT: Entry: 0x201000 + + # RUN: ld.lld %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN2 %s + # WARN2: warning: cannot find entry symbol _start; defaulting to 0x201000 + + # RUN: ld.lld -shared -e foobar %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN3 %s + # WARN3: warning: cannot find entry symbol foobar; defaulting to 0x1000 + + # RUN: ld.lld -shared --fatal-warnings -e entry %t1 -o %t2 + # RUN: ld.lld -shared --fatal-warnings %t1 -o %t2 + + # RUN: echo .data > %t.s + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux -n %t.s -o %t3 + # RUN: ld.lld %t3 -o %t4 2>&1 | FileCheck -check-prefix=WARN4 %s + # RUN: llvm-readobj -file-headers %t4 | FileCheck -check-prefix=NOENTRY %s + + # WARN4: cannot find entry symbol _start; not setting start address + # NOENTRY: Entry: 0x0 + + # RUN: ld.lld -v -r %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN5 %s + # WARN5-NOT: warning: cannot find entry symbol + + # RUN: ld.lld %t1 -o %t2 -e entry + # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=SYM %s + # SYM: Entry: 0x201008 + + # RUN: ld.lld %t1 --fatal-warnings -shared -o %t2 -e entry + # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=DSO %s + # DSO: Entry: 0x1008 + + # RUN: ld.lld %t1 -o %t2 --entry=4096 + # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=DEC %s + # DEC: Entry: 0x1000 + + # RUN: ld.lld %t1 -o %t2 --entry 0xcafe + # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=HEX %s + # HEX: Entry: 0xCAFE + + # RUN: ld.lld %t1 -o %t2 -e 0777 + # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=OCT %s + # OCT: Entry: 0x1FF + + .globl entry + .text + .quad 0 + entry: + ret +Index: test/ELF/filter.s +=================================================================== +--- test/ELF/filter.s (revision 333896) ++++ test/ELF/filter.s (working copy) +@@ -1,19 +1,20 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + # RUN: ld.lld %t.o -shared -F foo.so -F boo.so -o %t1 + # RUN: llvm-readobj --dynamic-table %t1 | FileCheck %s + + # Test alias #1. + # RUN: ld.lld %t.o -shared --filter=foo.so --filter=boo.so -o %t2 + # RUN: llvm-readobj --dynamic-table %t2 | FileCheck %s + + # Test alias #2. + # RUN: ld.lld %t.o -shared --filter foo.so --filter boo.so -o %t3 + # RUN: llvm-readobj --dynamic-table %t3 | FileCheck %s + + # CHECK: DynamicSection [ + # CHECK-NEXT: Tag Type Name/Value + # CHECK-NEXT: 0x000000007FFFFFFF FILTER Filter library: [foo.so] + # CHECK-NEXT: 0x000000007FFFFFFF FILTER Filter library: [boo.so] + + # RUN: not ld.lld %t.o -F x -o %t 2>&1 | FileCheck -check-prefix=ERR %s + # ERR: -F may not be used without -shared +Index: test/ELF/gc-debuginfo-tls.s +=================================================================== +--- test/ELF/gc-debuginfo-tls.s (revision 333896) ++++ test/ELF/gc-debuginfo-tls.s (working copy) +@@ -1,23 +1,24 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + # RUN: ld.lld %t.o --gc-sections -shared -o %t1 + # RUN: ld.lld %t.o -shared -o %t2 + # RUN: llvm-readobj -symbols %t1 | FileCheck %s --check-prefix=GC + # RUN: llvm-readobj -symbols %t2 | FileCheck %s --check-prefix=NOGC + + # NOGC: Symbol { + # NOGC: Name: patatino + # NOGC-NEXT: Value: 0x0 + # NOGC-NEXT: Size: 0 + # NOGC-NEXT: Binding: Local + # NOGC-NEXT: Type: TLS + # NOGC-NEXT: Other: 0 + # NOGC-NEXT: Section: .tbss + # NOGC-NEXT: } + + # GC-NOT: tbss + + .section .tbss,"awT",@nobits + patatino: + .long 0 + .section .noalloc,"" + .quad patatino +Index: test/ELF/gc-merge-local-sym.s +=================================================================== +--- test/ELF/gc-merge-local-sym.s (revision 333896) ++++ test/ELF/gc-merge-local-sym.s (working copy) +@@ -1,34 +1,35 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux + // RUN: ld.lld %t.o -o %t.so -shared -O3 --gc-sections + // RUN: llvm-readobj -s -section-data -t %t.so | FileCheck %s + + // CHECK: Name: .rodata + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_MERGE + // CHECK-NEXT: SHF_STRINGS + // CHECK-NEXT: ] + // CHECK-NEXT: Address: 0x1FD + // CHECK-NEXT: Offset: + // CHECK-NEXT: Size: 4 + // CHECK-NEXT: Link: 0 + // CHECK-NEXT: Info: 0 + // CHECK-NEXT: AddressAlignment: 1 + // CHECK-NEXT: EntrySize: 1 + // CHECK-NEXT: SectionData ( + // CHECK-NEXT: 0000: 61626300 |abc.| + // CHECK-NEXT: ) + + // CHECK: Symbols [ + // CHECK: Symbol { + // CHECK-NOT: Name: bar + + .global foo + foo: + leaq .L.str(%rip), %rsi + .section .rodata.str1.1,"aMS",@progbits,1 + .L.str: + .asciz "abc" + bar: + .asciz "def" +Index: test/ELF/gc-sections-merge-addend.s +=================================================================== +--- test/ELF/gc-sections-merge-addend.s (revision 333896) ++++ test/ELF/gc-sections-merge-addend.s (working copy) +@@ -1,39 +1,40 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux + // RUN: ld.lld %t.o -o %t.so -shared --gc-sections + // RUN: llvm-readobj -s -section-data %t.so | FileCheck %s + + + // CHECK: Name: .rodata + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_MERGE + // CHECK-NEXT: SHF_STRINGS + // CHECK-NEXT: ] + // CHECK-NEXT: Address: + // CHECK-NEXT: Offset: + // CHECK-NEXT: Size: 4 + // CHECK-NEXT: Link: 0 + // CHECK-NEXT: Info: 0 + // CHECK-NEXT: AddressAlignment: 1 + // CHECK-NEXT: EntrySize: 1 + // CHECK-NEXT: SectionData ( + // CHECK-NEXT: 0000: 62617200 |bar.| + // CHECK-NEXT: ) + + .section .data.f,"aw",@progbits + .globl f + f: + .quad .rodata.str1.1 + 4 + + .section .data.g,"aw",@progbits + .hidden g + .globl g + g: + .quad .rodata.str1.1 + + .section .rodata.str1.1,"aMS",@progbits,1 + .L.str: + .asciz "foo" + .L.str.1: + .asciz "bar" +Index: test/ELF/gc-sections-merge-implicit-addend.s +=================================================================== +--- test/ELF/gc-sections-merge-implicit-addend.s (revision 333896) ++++ test/ELF/gc-sections-merge-implicit-addend.s (working copy) +@@ -1,39 +1,40 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=i386-pc-linux + // RUN: ld.lld %t.o -o %t.so -shared --gc-sections + // RUN: llvm-readobj -s -section-data %t.so | FileCheck %s + + + // CHECK: Name: .rodata + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_MERGE + // CHECK-NEXT: SHF_STRINGS + // CHECK-NEXT: ] + // CHECK-NEXT: Address: + // CHECK-NEXT: Offset: + // CHECK-NEXT: Size: 4 + // CHECK-NEXT: Link: 0 + // CHECK-NEXT: Info: 0 + // CHECK-NEXT: AddressAlignment: 1 + // CHECK-NEXT: EntrySize: 1 + // CHECK-NEXT: SectionData ( + // CHECK-NEXT: 0000: 62617200 |bar.| + // CHECK-NEXT: ) + + .section .data.f,"aw",@progbits + .globl f + f: + .long .rodata.str1.1 + 4 + + .section .data.g,"aw",@progbits + .hidden g + .globl g + g: + .long .rodata.str1.1 + + .section .rodata.str1.1,"aMS",@progbits,1 + .L.str: + .asciz "foo" + .L.str.1: + .asciz "bar" +Index: test/ELF/gc-sections-merge.s +=================================================================== +--- test/ELF/gc-sections-merge.s (revision 333896) ++++ test/ELF/gc-sections-merge.s (working copy) +@@ -1,61 +1,62 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux + // RUN: ld.lld %t.o -o %t.so -shared + // RUN: ld.lld %t.o -o %t.gc.so -shared --gc-sections + // RUN: llvm-readobj -s -section-data %t.so | FileCheck %s + // RUN: llvm-readobj -s -section-data %t.gc.so | FileCheck --check-prefix=GC %s + + + // CHECK: Name: .rodata + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_MERGE + // CHECK-NEXT: SHF_STRINGS + // CHECK-NEXT: ] + // CHECK-NEXT: Address: + // CHECK-NEXT: Offset: + // CHECK-NEXT: Size: 8 + // CHECK-NEXT: Link: 0 + // CHECK-NEXT: Info: 0 + // CHECK-NEXT: AddressAlignment: 1 + // CHECK-NEXT: EntrySize: 1 + // CHECK-NEXT: SectionData ( + // CHECK-NEXT: 0000: 666F6F00 62617200 |foo.bar.| + // CHECK-NEXT: ) + + // GC: Name: .rodata + // GC-NEXT: Type: SHT_PROGBITS + // GC-NEXT: Flags [ + // GC-NEXT: SHF_ALLOC + // GC-NEXT: SHF_MERGE + // GC-NEXT: SHF_STRINGS + // GC-NEXT: ] + // GC-NEXT: Address: + // GC-NEXT: Offset: + // GC-NEXT: Size: 4 + // GC-NEXT: Link: 0 + // GC-NEXT: Info: 0 + // GC-NEXT: AddressAlignment: 1 + // GC-NEXT: EntrySize: 1 + // GC-NEXT: SectionData ( + // GC-NEXT: 0000: 666F6F00 |foo.| + // GC-NEXT: ) + + .section .text.f,"ax",@progbits + .globl f + f: + leaq .L.str(%rip), %rax + retq + + .section .text.g,"ax",@progbits + .hidden g + .globl g + g: + leaq .L.str.1(%rip), %rax + retq + + .section .rodata.str1.1,"aMS",@progbits,1 + .L.str: + .asciz "foo" + .L.str.1: + .asciz "bar" +Index: test/ELF/gc-sections-protected.s +=================================================================== +--- test/ELF/gc-sections-protected.s (revision 333896) ++++ test/ELF/gc-sections-protected.s (working copy) +@@ -1,18 +1,19 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux + // RUN: ld.lld %t.o -o %t.so -shared --gc-sections + // RUN: llvm-readobj -s %t.so | FileCheck %s + + // CHECK: Name: .text + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_EXECINSTR + // CHECK-NEXT: ] + // CHECK-NEXT: Address: + // CHECK-NEXT: Offset: + // CHECK-NEXT: Size: 1 + + .protected g + .globl g + g: + retq +Index: test/ELF/global_offset_table.s +=================================================================== +--- test/ELF/global_offset_table.s (revision 333896) ++++ test/ELF/global_offset_table.s (working copy) +@@ -1,5 +1,6 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t + // RUN: ld.lld %t -o %t2 + .global _start + _start: + .long _GLOBAL_OFFSET_TABLE_ +Index: test/ELF/global_offset_table_shared.s +=================================================================== +--- test/ELF/global_offset_table_shared.s (revision 333896) ++++ test/ELF/global_offset_table_shared.s (working copy) +@@ -1,14 +1,15 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t + // RUN: ld.lld --hash-style=sysv -shared %t -o %t2 + // RUN: llvm-readobj -t %t2 | FileCheck %s + .long _GLOBAL_OFFSET_TABLE_ - . + + // CHECK: Name: _GLOBAL_OFFSET_TABLE_ + // CHECK-NEXT: Value: 0x2000 + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Local + // CHECK-NEXT: Type: None + // CHECK-NEXT: Other [ (0x2) + // CHECK-NEXT: STV_HIDDEN (0x2) + // CHECK-NEXT: ] + // CHECK-NEXT: Section: .got.plt +Index: test/ELF/got-plt-header.s +=================================================================== +--- test/ELF/got-plt-header.s (revision 333896) ++++ test/ELF/got-plt-header.s (working copy) +@@ -1,30 +1,31 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux + // RUN: ld.lld %t.o -o %t.so -shared + // RUN: llvm-readobj -s -section-data %t.so | FileCheck %s + + call foo@plt + + // Check that the first .got.plt entry has the address of the dynamic table. + + // CHECK: Name: .got.plt + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_WRITE + // CHECK-NEXT: ] + // CHECK-NEXT: Address: 0x2000 + // CHECK-NEXT: Offset: 0x2000 + // CHECK-NEXT: Size: 32 + // CHECK-NEXT: Link: 0 + // CHECK-NEXT: Info: 0 + // CHECK-NEXT: AddressAlignment: 8 + // CHECK-NEXT: EntrySize: 0 + // CHECK-NEXT: SectionData ( + // CHECK-NEXT: 0000: 00300000 00000000 00000000 00000000 + + // CHECK: Type: SHT_DYNAMIC + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_WRITE + // CHECK-NEXT: ] + // CHECK-NEXT: Address: 0x3000 +Index: test/ELF/gotpcrelx.s +=================================================================== +--- test/ELF/gotpcrelx.s (revision 333896) ++++ test/ELF/gotpcrelx.s (working copy) +@@ -1,30 +1,31 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -relax-relocations -triple x86_64-pc-linux-gnu \ + // RUN: %s -o %t.o + // RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=RELS %s + // RUN: ld.lld --hash-style=sysv %t.o -o %t.so -shared + // RUN: llvm-readobj -s -r %t.so | FileCheck %s + + movq foo@GOTPCREL(%rip), %rax + movq bar@GOTPCREL(%rip), %rax + + // RELS: Relocations [ + // RELS-NEXT: Section ({{.*}}) .rela.text { + // RELS-NEXT: R_X86_64_REX_GOTPCRELX foo 0xFFFFFFFFFFFFFFFC + // RELS-NEXT: R_X86_64_REX_GOTPCRELX bar 0xFFFFFFFFFFFFFFFC + // RELS-NEXT: } + // RELS-NEXT: ] + + // CHECK: Name: .got + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_WRITE + // CHECK-NEXT: ] + // CHECK-NEXT: Address: 0x2090 + + // CHECK: Relocations [ + // CHECK-NEXT: Section ({{.*}}) .rela.dyn { + // CHECK-NEXT: 0x2098 R_X86_64_GLOB_DAT bar 0x0 + // CHECK-NEXT: 0x2090 R_X86_64_GLOB_DAT foo 0x0 + // CHECK-NEXT: } + // CHECK-NEXT: ] +Index: test/ELF/i386-got-value.s +=================================================================== +--- test/ELF/i386-got-value.s (revision 333896) ++++ test/ELF/i386-got-value.s (working copy) +@@ -1,33 +1,34 @@ ++# REQUIRES: x86 + # RUN: llvm-mc %s -o %t.o -filetype=obj -triple=i386-pc-linux + # RUN: ld.lld %t.o -o %t.so -shared + # RUN: llvm-readobj --relocations --sections --section-data %t.so | FileCheck %s + + # Check that the value of a preemptible symbol is not written to the + # got entry when using Elf_Rel. It is not needed since the dynamic + # linker will write the final value. + + # CHECK: Name: .got + # CHECK-NEXT: Type: SHT_PROGBITS + # CHECK-NEXT: Flags [ + # CHECK-NEXT: SHF_ALLOC + # CHECK-NEXT: SHF_WRITE + # CHECK-NEXT: ] + # CHECK-NEXT: Address: + # CHECK-NEXT: Offset: + # CHECK-NEXT: Size: 4 + # CHECK-NEXT: Link: + # CHECK-NEXT: Info: + # CHECK-NEXT: AddressAlignment: + # CHECK-NEXT: EntrySize: + # CHECK-NEXT: SectionData ( + # CHECK-NEXT: 0000: 00000000 + # CHECK-NEXT: ) + + # CHECK: R_386_GLOB_DAT bar 0x0 + + movl bar@GOT(%eax), %eax + + .data + .globl bar + bar: + .long 42 +Index: test/ELF/i386-tls-ie-shared.s +=================================================================== +--- test/ELF/i386-tls-ie-shared.s (revision 333896) ++++ test/ELF/i386-tls-ie-shared.s (working copy) +@@ -1,111 +1,112 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o + // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %p/Inputs/tls-opt-iele-i686-nopic.s -o %tso.o + // RUN: ld.lld -shared %tso.o -o %tso + // RUN: ld.lld --hash-style=sysv -shared %t.o %tso -o %t1 + // RUN: llvm-readobj -s -r -d %t1 | FileCheck --check-prefix=GOTRELSHARED %s + // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASMSHARED %s + + // GOTRELSHARED: Section { + // GOTRELSHARED: Index: 8 + // GOTRELSHARED: Name: .got + // GOTRELSHARED-NEXT: Type: SHT_PROGBITS + // GOTRELSHARED-NEXT: Flags [ + // GOTRELSHARED-NEXT: SHF_ALLOC + // GOTRELSHARED-NEXT: SHF_WRITE + // GOTRELSHARED-NEXT: ] + // GOTRELSHARED-NEXT: Address: 0x2058 + // GOTRELSHARED-NEXT: Offset: 0x2058 + // GOTRELSHARED-NEXT: Size: 16 + // GOTRELSHARED-NEXT: Link: 0 + // GOTRELSHARED-NEXT: Info: 0 + // GOTRELSHARED-NEXT: AddressAlignment: 4 + // GOTRELSHARED-NEXT: EntrySize: 0 + // GOTRELSHARED-NEXT: } + // GOTRELSHARED: Relocations [ + // GOTRELSHARED-NEXT: Section ({{.*}}) .rel.dyn { + // GOTRELSHARED-NEXT: 0x1002 R_386_RELATIVE - 0x0 + // GOTRELSHARED-NEXT: 0x100A R_386_RELATIVE - 0x0 + // GOTRELSHARED-NEXT: 0x1013 R_386_RELATIVE - 0x0 + // GOTRELSHARED-NEXT: 0x101C R_386_RELATIVE - 0x0 + // GOTRELSHARED-NEXT: 0x1024 R_386_RELATIVE - 0x0 + // GOTRELSHARED-NEXT: 0x102D R_386_RELATIVE - 0x0 + // GOTRELSHARED-NEXT: 0x1036 R_386_RELATIVE - 0x0 + // GOTRELSHARED-NEXT: 0x103F R_386_RELATIVE - 0x0 + // GOTRELSHARED-NEXT: 0x2058 R_386_TLS_TPOFF tlslocal0 0x0 + // GOTRELSHARED-NEXT: 0x205C R_386_TLS_TPOFF tlslocal1 0x0 + // GOTRELSHARED-NEXT: 0x2060 R_386_TLS_TPOFF tlsshared0 0x0 + // GOTRELSHARED-NEXT: 0x2064 R_386_TLS_TPOFF tlsshared1 0x0 + // GOTRELSHARED-NEXT: } + // GOTRELSHARED-NEXT: ] + // GOTRELSHARED: 0x6FFFFFFA RELCOUNT 8 + + // DISASMSHARED: Disassembly of section test: + // DISASMSHARED-NEXT: _start: + // (.got)[0] = 0x2058 = 8280 + // (.got)[1] = 0x205C = 8284 + // (.got)[2] = 0x2060 = 8288 + // (.got)[3] = 0x2064 = 8292 + // DISASMSHARED-NEXT: 1000: 8b 0d 58 20 00 00 movl 8280, %ecx + // DISASMSHARED-NEXT: 1006: 65 8b 01 movl %gs:(%ecx), %eax + // DISASMSHARED-NEXT: 1009: a1 58 20 00 00 movl 8280, %eax + // DISASMSHARED-NEXT: 100e: 65 8b 00 movl %gs:(%eax), %eax + // DISASMSHARED-NEXT: 1011: 03 0d 58 20 00 00 addl 8280, %ecx + // DISASMSHARED-NEXT: 1017: 65 8b 01 movl %gs:(%ecx), %eax + // DISASMSHARED-NEXT: 101a: 8b 0d 5c 20 00 00 movl 8284, %ecx + // DISASMSHARED-NEXT: 1020: 65 8b 01 movl %gs:(%ecx), %eax + // DISASMSHARED-NEXT: 1023: a1 5c 20 00 00 movl 8284, %eax + // DISASMSHARED-NEXT: 1028: 65 8b 00 movl %gs:(%eax), %eax + // DISASMSHARED-NEXT: 102b: 03 0d 5c 20 00 00 addl 8284, %ecx + // DISASMSHARED-NEXT: 1031: 65 8b 01 movl %gs:(%ecx), %eax + // DISASMSHARED-NEXT: 1034: 8b 0d 60 20 00 00 movl 8288, %ecx + // DISASMSHARED-NEXT: 103a: 65 8b 01 movl %gs:(%ecx), %eax + // DISASMSHARED-NEXT: 103d: 03 0d 64 20 00 00 addl 8292, %ecx + // DISASMSHARED-NEXT: 1043: 65 8b 01 movl %gs:(%ecx), %eax + + .type tlslocal0,@object + .section .tbss,"awT",@nobits + .globl tlslocal0 + .align 4 + tlslocal0: + .long 0 + .size tlslocal0, 4 + + .type tlslocal1,@object + .section .tbss,"awT",@nobits + .globl tlslocal1 + .align 4 + tlslocal1: + .long 0 + .size tlslocal1, 4 + + .section .text + .globl ___tls_get_addr + .type ___tls_get_addr,@function + ___tls_get_addr: + + .section test, "axw" + .globl _start + _start: + movl tlslocal0@indntpoff,%ecx + movl %gs:(%ecx),%eax + + movl tlslocal0@indntpoff,%eax + movl %gs:(%eax),%eax + + addl tlslocal0@indntpoff,%ecx + movl %gs:(%ecx),%eax + + movl tlslocal1@indntpoff,%ecx + movl %gs:(%ecx),%eax + + movl tlslocal1@indntpoff,%eax + movl %gs:(%eax),%eax + + addl tlslocal1@indntpoff,%ecx + movl %gs:(%ecx),%eax + + movl tlsshared0@indntpoff,%ecx + movl %gs:(%ecx),%eax + + addl tlsshared1@indntpoff,%ecx + movl %gs:(%ecx),%eax +Index: test/ELF/incompatible-section-flags.s +=================================================================== +--- test/ELF/incompatible-section-flags.s (revision 333896) ++++ test/ELF/incompatible-section-flags.s (working copy) +@@ -1,23 +1,24 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + // RUN: not ld.lld -shared %t.o -o %t 2>&1 | FileCheck %s + + // CHECK: error: incompatible section flags for .foo + // CHECK-NEXT: >>> {{.*}}incompatible-section-flags.s.tmp.o:(.foo): 0x3 + // CHECK-NEXT: >>> output section .foo: 0x403 + + // CHECK: error: incompatible section flags for .bar + // CHECK-NEXT: >>> {{.*}}incompatible-section-flags.s.tmp.o:(.bar): 0x403 + // CHECK-NEXT: >>> output section .bar: 0x3 + + .section .foo, "awT", @progbits, unique, 1 + .quad 0 + + .section .foo, "aw", @progbits, unique, 2 + .quad 0 + + + .section .bar, "aw", @progbits, unique, 3 + .quad 0 + + .section .bar, "awT", @progbits, unique, 4 + .quad 0 +Index: test/ELF/incompatible-section-types2.s +=================================================================== +--- test/ELF/incompatible-section-types2.s (revision 333896) ++++ test/ELF/incompatible-section-types2.s (working copy) +@@ -1,9 +1,10 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + // RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s + + // CHECK: error: section type mismatch for .shstrtab + // CHECK-NEXT: >>> :(.shstrtab): SHT_STRTAB + // CHECK-NEXT: >>> output section .shstrtab: Unknown + + .section .shstrtab,"",@12345 + .short 20 +Index: test/ELF/invalid/invalid-elf.test +=================================================================== +--- test/ELF/invalid/invalid-elf.test (revision 333896) ++++ test/ELF/invalid/invalid-elf.test (working copy) +@@ -1,27 +1,28 @@ ++# REQUIRES: x86 + # RUN: llvm-mc %s -o %t -filetype=obj -triple x86_64-pc-linux + + # RUN: not ld.lld %t %p/Inputs/data-encoding.a -o %t2 2>&1 | \ + # RUN: FileCheck --check-prefix=INVALID-DATA-ENC %s + # INVALID-DATA-ENC: test.o: invalid data encoding + + # RUN: not ld.lld %t %p/Inputs/file-class.a -o %t2 2>&1 | \ + # RUN: FileCheck --check-prefix=INVALID-FILE-CLASS %s + # INVALID-FILE-CLASS: test.o: invalid file class + + # RUN: not ld.lld %p/Inputs/symtab-sh_info.elf -o %t2 2>&1 | \ + # RUN: FileCheck --check-prefix=INVALID-SYMTAB-SHINFO %s + # INVALID-SYMTAB-SHINFO: invalid sh_info in symbol table + + # RUN: not ld.lld %p/Inputs/binding.elf -o %t2 2>&1 | \ + # RUN: FileCheck --check-prefix=INVALID-BINDING %s + # INVALID-BINDING: unexpected binding + + # RUN: not ld.lld %p/Inputs/section-index.elf -o %t2 2>&1 | \ + # RUN: FileCheck --check-prefix=INVALID-SECTION-INDEX-LLD %s + # INVALID-SECTION-INDEX-LLD: invalid section index + + # RUN: not ld.lld %p/Inputs/multiple-eh-relocs.elf -o %t2 2>&1 | \ + # RUN: FileCheck --check-prefix=INVALID-EH-RELOCS %s + # INVALID-EH-RELOCS: multiple relocation sections to one section are not supported + + .long foo +Index: test/ELF/linkerscript/discard-interp.test +=================================================================== +--- test/ELF/linkerscript/discard-interp.test (revision 333896) ++++ test/ELF/linkerscript/discard-interp.test (working copy) +@@ -1,13 +1,14 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux /dev/null -o %t.o + # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/../Inputs/shared.s -o %t2.o + # RUN: ld.lld -shared %t2.o -o %t2.so + # RUN: ld.lld -dynamic-linker foo -rpath bar -rpath baz --script %s --export-dynamic %t.o %t2.so -o %t + # RUN: llvm-readobj -s %t | FileCheck %s + + # CHECK-NOT: Name: .interp + + PHDRS { text PT_LOAD FILEHDR PHDRS; } + SECTIONS { + . = SIZEOF_HEADERS; + .text : { *(.text) } : text + } +Index: test/ELF/linkerscript/openbsd-bootdata.test +=================================================================== +--- test/ELF/linkerscript/openbsd-bootdata.test (revision 333896) ++++ test/ELF/linkerscript/openbsd-bootdata.test (working copy) +@@ -1,8 +1,9 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux /dev/null -o %t.o + # RUN: ld.lld --script %s %t.o -o %t + # RUN: llvm-readobj --program-headers -s %t | FileCheck %s + + PHDRS { boot PT_OPENBSD_BOOTDATA; } + + # CHECK: ProgramHeader { + # CHECK: Type: PT_OPENBSD_BOOTDATA (0x65A41BE6) +Index: test/ELF/linkerscript/openbsd-randomize.s +=================================================================== +--- test/ELF/linkerscript/openbsd-randomize.s (revision 333896) ++++ test/ELF/linkerscript/openbsd-randomize.s (working copy) +@@ -1,23 +1,24 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t.o + # RUN: echo "PHDRS { text PT_LOAD FILEHDR PHDRS; rand PT_OPENBSD_RANDOMIZE; } \ + # RUN: SECTIONS { . = SIZEOF_HEADERS; \ + # RUN: .text : { *(.text) } \ + # RUN: .openbsd.randomdata : { *(.openbsd.randomdata) } : rand }" > %t.script + # RUN: ld.lld --script %t.script %t.o -o %t + # RUN: llvm-readobj --program-headers -s %t | FileCheck %s + + # CHECK: ProgramHeader { + # CHECK: Type: PT_OPENBSD_RANDOMIZE (0x65A3DBE6) + # CHECK-NEXT: Offset: 0x74 + # CHECK-NEXT: VirtualAddress: 0x74 + # CHECK-NEXT: PhysicalAddress: 0x74 + # CHECK-NEXT: FileSize: 8 + # CHECK-NEXT: MemSize: 8 + # CHECK-NEXT: Flags [ (0x4) + # CHECK-NEXT: PF_R (0x4) + # CHECK-NEXT: ] + # CHECK-NEXT: Alignment: 1 + # CHECK-NEXT: } + + .section .openbsd.randomdata, "a" + .quad 0 +Index: test/ELF/linkerscript/openbsd-wxneeded.test +=================================================================== +--- test/ELF/linkerscript/openbsd-wxneeded.test (revision 333896) ++++ test/ELF/linkerscript/openbsd-wxneeded.test (working copy) +@@ -1,18 +1,19 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux /dev/null -o %t.o + # RUN: ld.lld -z wxneeded --script %s %t.o -o %t + # RUN: llvm-readobj --program-headers %t | FileCheck %s + + PHDRS { text PT_LOAD FILEHDR PHDRS; wxneeded PT_OPENBSD_WXNEEDED; } + + # CHECK: ProgramHeader { + # CHECK: Type: PT_OPENBSD_WXNEEDED (0x65A3DBE7) + # CHECK-NEXT: Offset: 0x0 + # CHECK-NEXT: VirtualAddress: 0x0 + # CHECK-NEXT: PhysicalAddress: 0x0 + # CHECK-NEXT: FileSize: 0 + # CHECK-NEXT: MemSize: 0 + # CHECK-NEXT: Flags [ + # CHECK-NEXT: PF_R + # CHECK-NEXT: ] + # CHECK-NEXT: Alignment: 0 + # CHECK-NEXT: } +Index: test/ELF/local-got-pie.s +=================================================================== +--- test/ELF/local-got-pie.s (revision 333896) ++++ test/ELF/local-got-pie.s (working copy) +@@ -1,37 +1,38 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + // RUN: ld.lld --hash-style=sysv %t.o -o %t -pie + // RUN: llvm-readobj -s -r -d %t | FileCheck %s + // RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s + + .globl _start + _start: + call foo@gotpcrel + + .hidden foo + .global foo + foo: + nop + + // 0x20B0 - 1001 - 5 = 4266 + // DISASM: Disassembly of section .text: + // DISASM-NEXT: _start: + // DISASM-NEXT: 1000: {{.*}} callq 4267 + // DISASM: foo: + // DISASM-NEXT: 1005: {{.*}} nop + + // CHECK: Name: .got + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_WRITE + // CHECK-NEXT: ] + // CHECK-NEXT: Address: 0x20B0 + // CHECK-NEXT: Offset: + // CHECK-NEXT: Size: 8 + + // CHECK: Relocations [ + // CHECK-NEXT: Section ({{.*}}) .rela.dyn { + // CHECK-NEXT: 0x20B0 R_X86_64_RELATIVE - 0x1005 + // CHECK-NEXT: } + // CHECK-NEXT: ] + // CHECK: 0x000000006FFFFFF9 RELACOUNT 1 +Index: test/ELF/local-got-shared.s +=================================================================== +--- test/ELF/local-got-shared.s (revision 333896) ++++ test/ELF/local-got-shared.s (working copy) +@@ -1,36 +1,37 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + // RUN: ld.lld --hash-style=sysv %t.o -o %t -shared + // RUN: llvm-readobj -s -r -d %t | FileCheck %s + // RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s + + bar: + call foo@gotpcrel + + .hidden foo + .global foo + foo: + nop + + // 0x20A0 - 0x1000 - 5 = 4251 + // DISASM: bar: + // DISASM-NEXT: 1000: {{.*}} callq 4251 + + // DISASM: foo: + // DISASM-NEXT: 1005: {{.*}} nop + + // CHECK: Name: .got + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_WRITE + // CHECK-NEXT: ] + // CHECK-NEXT: Address: 0x20A0 + // CHECK-NEXT: Offset: + // CHECK-NEXT: Size: 8 + + // CHECK: Relocations [ + // CHECK-NEXT: Section ({{.*}}) .rela.dyn { + // CHECK-NEXT: 0x20A0 R_X86_64_RELATIVE - 0x1005 + // CHECK-NEXT: } + // CHECK-NEXT: ] + // CHECK: 0x000000006FFFFFF9 RELACOUNT 1 +Index: test/ELF/local-got.s +=================================================================== +--- test/ELF/local-got.s (revision 333896) ++++ test/ELF/local-got.s (working copy) +@@ -1,48 +1,49 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o + // RUN: ld.lld -shared %t2.o -o %t2.so + // RUN: ld.lld --hash-style=sysv %t.o %t2.so -o %t + // RUN: llvm-readobj -s -r -section-data %t | FileCheck %s + // RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s + + .globl _start + _start: + call bar@gotpcrel + call foo@gotpcrel + + .global foo + foo: + nop + + // 0x2020B0 - 0x201000 - 5 = 4251 + // 0x2020B8 - 0x201005 - 5 = 4254 + // DISASM: _start: + // DISASM-NEXT: 201000: {{.*}} callq 4267 + // DISASM-NEXT: 201005: {{.*}} callq 4270 + + // DISASM: foo: + // DISASM-NEXT: 20100a: {{.*}} nop + + // CHECK: Name: .got + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_WRITE + // CHECK-NEXT: ] + // CHECK-NEXT: Address: 0x2020B0 + // CHECK-NEXT: Offset: + // CHECK-NEXT: Size: 16 + // CHECK-NEXT: Link: 0 + // CHECK-NEXT: Info: 0 + // CHECK-NEXT: AddressAlignment: 8 + // CHECK-NEXT: EntrySize: 0 + // CHECK-NEXT: SectionData ( + // 0x20200a in little endian + // CHECK-NEXT: 0000: 00000000 00000000 0A102000 00000000 + // CHECK-NEXT: ) + + // CHECK: Relocations [ + // CHECK-NEXT: Section ({{.*}}) .rela.dyn { + // CHECK-NEXT: 0x2020B0 R_X86_64_GLOB_DAT bar 0x0 + // CHECK-NEXT: } + // CHECK-NEXT: ] +Index: test/ELF/map-gc-sections.s +=================================================================== +--- test/ELF/map-gc-sections.s (revision 333896) ++++ test/ELF/map-gc-sections.s (working copy) +@@ -1,9 +1,10 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + // RUN: ld.lld %t.o -o %t -Map=- --gc-sections | FileCheck %s + + .section .tbss,"awT",@nobits + // CHECK-NOT: foo + .globl foo + foo: + .align 8 + .long 0 +Index: test/ELF/pr34872.s +=================================================================== +--- test/ELF/pr34872.s (revision 333896) ++++ test/ELF/pr34872.s (working copy) +@@ -1,14 +1,15 @@ ++# REQUIRES: x86 + # RUN: llvm-mc %s -filetype=obj -triple=x86_64-pc-linux -o %t.o + # RUN: llvm-mc %p/Inputs/undefined-error.s -filetype=obj \ + # RUN: -triple=x86_64-pc-linux -o %t2.o + # RUN: ld.lld -shared %t2.o -o %t2.so + # RUN: not ld.lld %t2.so %t.o -o %t.out 2>&1 | FileCheck %s + + # CHECK: undefined symbol: fmod + # Check we're not emitting other diagnostics for this symbol. + # CHECK-NOT: fmod + + .global main + + main: + callq fmod +Index: test/ELF/pr36475.s +=================================================================== +--- test/ELF/pr36475.s (revision 333896) ++++ test/ELF/pr36475.s (working copy) +@@ -1,29 +1,30 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + # RUN: echo "PHDRS {" > %t.script + # RUN: echo " ph_text PT_LOAD FLAGS (0x1 | 0x4);" >> %t.script + # RUN: echo " ph_data PT_LOAD FLAGS (0x2 | 0x4);" >> %t.script + # RUN: echo "}" >> %t.script + # RUN: echo "SECTIONS {" >> %t.script + # RUN: echo " .text : { *(.text*) } : ph_text" >> %t.script + # RUN: echo " . = ALIGN(0x4000);" >> %t.script + # RUN: echo " .got.plt : { BYTE(42); *(.got); } : ph_data" >> %t.script + # RUN: echo "}" >> %t.script + # RUN: ld.lld -T %t.script %t.o -o %t.elf + # RUN: llvm-readobj -l -elf-output-style=GNU %t.elf | FileCheck %s + + # CHECK: Section to Segment mapping: + # CHECK-NEXT: Segment Sections... + # CHECK-NEXT: 00 .text executable + # CHECK-NEXT: 01 .got.plt + + .text + .globl _start + .type _start,@function + _start: + callq custom_func + ret + + .section executable,"ax",@progbits + .type custom_func,@function + custom_func: + ret +Index: test/ELF/relocation-size-shared.s +=================================================================== +--- test/ELF/relocation-size-shared.s (revision 333896) ++++ test/ELF/relocation-size-shared.s (working copy) +@@ -1,78 +1,79 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/relocation-size-shared.s -o %tso.o + // RUN: ld.lld -shared %tso.o -o %tso + // RUN: ld.lld %t.o %tso -o %t1 + // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=RELOCSHARED %s + // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s + + // RELOCSHARED: Relocations [ + // RELOCSHARED-NEXT: Section ({{.*}}) .rela.dyn { + // RELOCSHARED-NEXT: 0x201018 R_X86_64_SIZE64 fooshared 0xFFFFFFFFFFFFFFFF + // RELOCSHARED-NEXT: 0x201020 R_X86_64_SIZE64 fooshared 0x0 + // RELOCSHARED-NEXT: 0x201028 R_X86_64_SIZE64 fooshared 0x1 + // RELOCSHARED-NEXT: 0x201048 R_X86_64_SIZE32 fooshared 0xFFFFFFFFFFFFFFFF + // RELOCSHARED-NEXT: 0x20104F R_X86_64_SIZE32 fooshared 0x0 + // RELOCSHARED-NEXT: 0x201056 R_X86_64_SIZE32 fooshared 0x1 + // RELOCSHARED-NEXT: } + // RELOCSHARED-NEXT:] + + // DISASM: Disassembly of section test + // DISASM: _data: + // DISASM-NEXT: 201000: 19 00 + // DISASM-NEXT: 201002: 00 00 + // DISASM-NEXT: 201004: 00 00 + // DISASM-NEXT: 201006: 00 00 + // DISASM-NEXT: 201008: 1a 00 + // DISASM-NEXT: 20100a: 00 00 + // DISASM-NEXT: 20100c: 00 00 + // DISASM-NEXT: 20100e: 00 00 + // DISASM-NEXT: 201010: 1b 00 + // DISASM-NEXT: 201012: 00 00 + // DISASM-NEXT: 201014: 00 00 + // DISASM-NEXT: 201016: 00 00 + // DISASM-NEXT: 201018: 00 00 + // DISASM-NEXT: 20101a: 00 00 + // DISASM-NEXT: 20101c: 00 00 + // DISASM-NEXT: 20101e: 00 00 + // DISASM-NEXT: 201020: 00 00 + // DISASM-NEXT: 201022: 00 00 + // DISASM-NEXT: 201024: 00 00 + // DISASM-NEXT: 201026: 00 00 + // DISASM-NEXT: 201028: 00 00 + // DISASM-NEXT: 20102a: 00 00 + // DISASM-NEXT: 20102c: 00 00 + // DISASM-NEXT: 20102e: 00 00 + // DISASM: _start: + // DISASM-NEXT: 201030: 8b 04 25 19 00 00 00 movl 25, %eax + // DISASM-NEXT: 201037: 8b 04 25 1a 00 00 00 movl 26, %eax + // DISASM-NEXT: 20103e: 8b 04 25 1b 00 00 00 movl 27, %eax + // DISASM-NEXT: 201045: 8b 04 25 00 00 00 00 movl 0, %eax + // DISASM-NEXT: 20104c: 8b 04 25 00 00 00 00 movl 0, %eax + // DISASM-NEXT: 201053: 8b 04 25 00 00 00 00 movl 0, %eax + + .data + .global foo + .type foo,%object + .size foo,26 + foo: + .zero 26 + + .section test, "awx" + _data: + // R_X86_64_SIZE64: + .quad foo@SIZE-1 + .quad foo@SIZE + .quad foo@SIZE+1 + .quad fooshared@SIZE-1 + .quad fooshared@SIZE + .quad fooshared@SIZE+1 + + .globl _start + _start: + // R_X86_64_SIZE32: + movl foo@SIZE-1,%eax + movl foo@SIZE,%eax + movl foo@SIZE+1,%eax + movl fooshared@SIZE-1,%eax + movl fooshared@SIZE,%eax + movl fooshared@SIZE+1,%eax +Index: test/ELF/relocation-size.s +=================================================================== +--- test/ELF/relocation-size.s (revision 333896) ++++ test/ELF/relocation-size.s (working copy) +@@ -1,123 +1,124 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + // RUN: ld.lld %t.o -o %t1 + // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s + // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s + // RUN: ld.lld -shared %t.o -o %t1 + // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=RELOCSHARED %s + // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASMSHARED %s + + // NORELOC: Relocations [ + // NORELOC-NEXT: ] + + // DISASM: Disassembly of section test: + // DISASM-NEXT: _data: + // DISASM-NEXT: 201000: 19 00 + // DISASM-NEXT: 201002: 00 00 + // DISASM-NEXT: 201004: 00 00 + // DISASM-NEXT: 201006: 00 00 + // DISASM-NEXT: 201008: 1a 00 + // DISASM-NEXT: 20100a: 00 00 + // DISASM-NEXT: 20100c: 00 00 + // DISASM-NEXT: 20100e: 00 00 + // DISASM-NEXT: 201010: 1b 00 + // DISASM-NEXT: 201012: 00 00 + // DISASM-NEXT: 201014: 00 00 + // DISASM-NEXT: 201016: 00 00 + // DISASM-NEXT: 201018: 19 00 + // DISASM-NEXT: 20101a: 00 00 + // DISASM-NEXT: 20101c: 00 00 + // DISASM-NEXT: 20101e: 00 00 + // DISASM-NEXT: 201020: 1a 00 + // DISASM-NEXT: 201022: 00 00 + // DISASM-NEXT: 201024: 00 00 + // DISASM-NEXT: 201026: 00 00 + // DISASM-NEXT: 201028: 1b 00 + // DISASM-NEXT: 20102a: 00 00 + // DISASM-NEXT: 20102c: 00 00 + // DISASM-NEXT: 20102e: 00 00 + // DISASM: _start: + // DISASM-NEXT: 201030: 8b 04 25 19 00 00 00 movl 25, %eax + // DISASM-NEXT: 201037: 8b 04 25 1a 00 00 00 movl 26, %eax + // DISASM-NEXT: 20103e: 8b 04 25 1b 00 00 00 movl 27, %eax + // DISASM-NEXT: 201045: 8b 04 25 19 00 00 00 movl 25, %eax + // DISASM-NEXT: 20104c: 8b 04 25 1a 00 00 00 movl 26, %eax + // DISASM-NEXT: 201053: 8b 04 25 1b 00 00 00 movl 27, %eax + + // RELOCSHARED: Relocations [ + // RELOCSHARED-NEXT: Section ({{.*}}) .rela.dyn { + // RELOCSHARED-NEXT: 0x1000 R_X86_64_SIZE64 foo 0xFFFFFFFFFFFFFFFF + // RELOCSHARED-NEXT: 0x1008 R_X86_64_SIZE64 foo 0x0 + // RELOCSHARED-NEXT: 0x1010 R_X86_64_SIZE64 foo 0x1 + // RELOCSHARED-NEXT: 0x1033 R_X86_64_SIZE32 foo 0xFFFFFFFFFFFFFFFF + // RELOCSHARED-NEXT: 0x103A R_X86_64_SIZE32 foo 0x0 + // RELOCSHARED-NEXT: 0x1041 R_X86_64_SIZE32 foo 0x1 + // RELOCSHARED-NEXT: } + // RELOCSHARED-NEXT: ] + + // DISASMSHARED: Disassembly of section test: + // DISASMSHARED-NEXT: _data: + // DISASMSHARED-NEXT: 1000: 00 00 + // DISASMSHARED-NEXT: 1002: 00 00 + // DISASMSHARED-NEXT: 1004: 00 00 + // DISASMSHARED-NEXT: 1006: 00 00 + // DISASMSHARED-NEXT: 1008: 00 00 + // DISASMSHARED-NEXT: 100a: 00 00 + // DISASMSHARED-NEXT: 100c: 00 00 + // DISASMSHARED-NEXT: 100e: 00 00 + // DISASMSHARED-NEXT: 1010: 00 00 + // DISASMSHARED-NEXT: 1012: 00 00 + // DISASMSHARED-NEXT: 1014: 00 00 + // DISASMSHARED-NEXT: 1016: 00 00 + // DISASMSHARED-NEXT: 1018: 19 00 + // DISASMSHARED-NEXT: 101a: 00 00 + // DISASMSHARED-NEXT: 101c: 00 00 + // DISASMSHARED-NEXT: 101e: 00 00 + // DISASMSHARED-NEXT: 1020: 1a 00 + // DISASMSHARED-NEXT: 1022: 00 00 + // DISASMSHARED-NEXT: 1024: 00 00 + // DISASMSHARED-NEXT: 1026: 00 00 + // DISASMSHARED-NEXT: 1028: 1b 00 + // DISASMSHARED-NEXT: 102a: 00 00 + // DISASMSHARED-NEXT: 102c: 00 00 + // DISASMSHARED-NEXT: 102e: 00 00 + // DISASMSHARED: _start: + // DISASMSHARED-NEXT: 1030: 8b 04 25 00 00 00 00 movl 0, %eax + // DISASMSHARED-NEXT: 1037: 8b 04 25 00 00 00 00 movl 0, %eax + // DISASMSHARED-NEXT: 103e: 8b 04 25 00 00 00 00 movl 0, %eax + // DISASMSHARED-NEXT: 1045: 8b 04 25 19 00 00 00 movl 25, %eax + // DISASMSHARED-NEXT: 104c: 8b 04 25 1a 00 00 00 movl 26, %eax + // DISASMSHARED-NEXT: 1053: 8b 04 25 1b 00 00 00 movl 27, %eax + + .data + .global foo + .type foo,%object + .size foo,26 + foo: + .zero 26 + + .data + .global foohidden + .hidden foohidden + .type foohidden,%object + .size foohidden,26 + foohidden: + .zero 26 + + .section test,"axw" + _data: + // R_X86_64_SIZE64: + .quad foo@SIZE-1 + .quad foo@SIZE + .quad foo@SIZE+1 + .quad foohidden@SIZE-1 + .quad foohidden@SIZE + .quad foohidden@SIZE+1 + .globl _start + _start: + // R_X86_64_SIZE32: + movl foo@SIZE-1,%eax + movl foo@SIZE,%eax + movl foo@SIZE+1,%eax + movl foohidden@SIZE-1,%eax + movl foohidden@SIZE,%eax + movl foohidden@SIZE+1,%eax +Index: test/ELF/relro-omagic.s +=================================================================== +--- test/ELF/relro-omagic.s (revision 333896) ++++ test/ELF/relro-omagic.s (working copy) +@@ -1,34 +1,35 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o + # RUN: ld.lld -shared %t2.o -o %t2.so -soname relro-omagic.s.tmp2.so + # RUN: ld.lld --hash-style=sysv -N %t.o %t2.so -o %t + # RUN: llvm-objdump -section-headers %t | FileCheck --check-prefix=NORELRO %s + # RUN: llvm-readobj --program-headers %t | FileCheck --check-prefix=NOPHDRS %s + + # NORELRO: Sections: + # NORELRO-NEXT: Idx Name Size Address Type + # NORELRO-NEXT: 0 00000000 0000000000000000 + # NORELRO-NEXT: 1 .dynsym 00000048 0000000000200120 + # NORELRO-NEXT: 2 .dynstr 00000021 0000000000200168 + # NORELRO-NEXT: 3 .hash 00000020 000000000020018c + # NORELRO-NEXT: 4 .rela.dyn 00000018 00000000002001b0 + # NORELRO-NEXT: 5 .rela.plt 00000018 00000000002001c8 + # NORELRO-NEXT: 6 .text 0000000a 00000000002001e0 TEXT DATA + # NORELRO-NEXT: 7 .plt 00000020 00000000002001f0 TEXT DATA + # NORELRO-NEXT: 8 .data 00000008 0000000000200210 DATA + # NORELRO-NEXT: 9 .foo 00000004 0000000000200218 DATA + # NORELRO-NEXT: 10 .dynamic 000000f0 0000000000200220 + # NORELRO-NEXT: 11 .got 00000008 0000000000200310 DATA + # NORELRO-NEXT: 12 .got.plt 00000020 0000000000200318 DATA + + # NOPHDRS: ProgramHeaders [ + # NOPHDRS-NOT: PT_GNU_RELRO + + .long bar + jmp *bar2@GOTPCREL(%rip) + + .section .data,"aw" + .quad 0 + + .section .foo,"aw" + .zero 4 +Index: test/ELF/rodynamic.s +=================================================================== +--- test/ELF/rodynamic.s (revision 333896) ++++ test/ELF/rodynamic.s (working copy) +@@ -1,35 +1,36 @@ ++# REQUIRES: x86 + # RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux + # RUN: llvm-mc %p/Inputs/rodynamic.s -o %t.so.o -filetype=obj -triple=x86_64-pc-linux + + # RUN: ld.lld -shared %t.so.o -o %t.so + # RUN: ld.lld %t.o %t.so -o %t.exe + # RUN: llvm-readobj -dynamic-table %t.exe | FileCheck -check-prefix=DEFDEBUG %s + # RUN: llvm-readobj -sections %t.exe | FileCheck -check-prefix=DEFSEC %s + + # RUN: ld.lld -shared -z rodynamic %t.so.o -o %t.so + # RUN: ld.lld -z rodynamic %t.o %t.so -o %t.exe + # RUN: llvm-readobj -dynamic-table %t.exe | FileCheck -check-prefix=RODEBUG %s + # RUN: llvm-readobj -sections %t.exe | FileCheck -check-prefix=ROSEC %s + + .globl _start + _start: + call foo + + # DEFDEBUG: DEBUG + + # DEFSEC: Section { + # DEFSEC: Name: .dynamic + # DEFSEC-NEXT: Type: SHT_DYNAMIC + # DEFSEC-NEXT: Flags [ + # DEFSEC-NEXT: SHF_ALLOC + # DEFSEC-NEXT: SHF_WRITE + # DEFSEC-NEXT: ] + + # RODEBUG-NOT: DEBUG + + # ROSEC: Section { + # ROSEC: Name: .dynamic + # ROSEC-NEXT: Type: SHT_DYNAMIC + # ROSEC-NEXT: Flags [ + # ROSEC-NEXT: SHF_ALLOC + # ROSEC-NEXT: ] +Index: test/ELF/section-symbol.s +=================================================================== +--- test/ELF/section-symbol.s (revision 333896) ++++ test/ELF/section-symbol.s (working copy) +@@ -1,40 +1,41 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t + // RUN: ld.lld %t -o %t.so -shared -discard-none + // RUN: llvm-readobj -t %t.so | FileCheck %s + + // Test that we don't include the section symbols from the .o in the .so + + // CHECK: Symbols [ + // CHECK-NEXT: Symbol { + // CHECK-NEXT: Name: (0) + // CHECK-NEXT: Value: 0x0 + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Local + // CHECK-NEXT: Type: None + // CHECK-NEXT: Other: 0 + // CHECK-NEXT: Section: Undefined + // CHECK-NEXT: } + // CHECK-NEXT: Symbol { + // CHECK-NEXT: Name: foo + // CHECK-NEXT: Value: + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Local + // CHECK-NEXT: Type: None + // CHECK-NEXT: Other: 0 + // CHECK-NEXT: Section: .text + // CHECK-NEXT: } + // CHECK-NEXT: Symbol { + // CHECK-NEXT: Name: _DYNAMIC + // CHECK-NEXT: Value: + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Local + // CHECK-NEXT: Type: None + // CHECK-NEXT: Other [ (0x2) + // CHECK-NEXT: STV_HIDDEN + // CHECK-NEXT: ] + // CHECK-NEXT: Section: .dynamic + // CHECK-NEXT: } + // CHECK-NEXT: ] + + foo: + .quad foo - . +Index: test/ELF/shared-lazy.s +=================================================================== +--- test/ELF/shared-lazy.s (revision 333896) ++++ test/ELF/shared-lazy.s (working copy) +@@ -1,16 +1,17 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o + // RUN: rm -f %t1.a + // RUN: llvm-ar rc %t1.a %t1.o + // RUN: ld.lld %t1.o -o %t1.so -shared + // RUN: echo ".global foo" > %t2.s + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %t2.s -o %t2.o + // RUN: ld.lld %t1.a %t1.so %t2.o -o %t.so -shared + // RUN: llvm-readelf --dyn-symbols %t.so | FileCheck %s + + // Test that 'foo' from %t1.so is used and we don't fetch a member + // from the archive. + + // CHECK: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND foo + + .global foo + foo: +Index: test/ELF/sht-group-gold-r.test +=================================================================== +--- test/ELF/sht-group-gold-r.test (revision 333896) ++++ test/ELF/sht-group-gold-r.test (working copy) +@@ -1,17 +1,18 @@ ++# REQUIRES: x86 + # GNU gold 1.14 (the newest version as of July 2017) seems to create + # non-standard-compliant SHT_GROUP sections when the -r option is given. + # + # Such SHT_GROUP sections use section names as their signatures + # instead of symbols pointed by sh_link field. Since it is prevalent, + # we accept such nonstandard sections. + + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + # RUN: ld.lld %p/Inputs/sht-group-gold-r.elf %t.o -o %t.exe + # RUN: llvm-objdump -t %t.exe | FileCheck %s + + # CHECK: .text 00000000 bar + # CHECK: .text 00000000 foo + + .globl _start + _start: + ret +Index: test/ELF/soname.s +=================================================================== +--- test/ELF/soname.s (revision 333896) ++++ test/ELF/soname.s (working copy) +@@ -1,11 +1,12 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + // RUN: ld.lld %t.o -shared -soname=bar -o %t.so + // RUN: ld.lld %t.o -shared --soname=bar -o %t2.so + // RUN: ld.lld %t.o %t.so %t2.so -o %t + // RUN: llvm-readobj --dynamic-table %t | FileCheck %s + + // CHECK: 0x0000000000000001 NEEDED Shared library: [bar] + // CHECK-NOT: NEEDED + + .global _start + _start: +Index: test/ELF/soname2.s +=================================================================== +--- test/ELF/soname2.s (revision 333896) ++++ test/ELF/soname2.s (working copy) +@@ -1,8 +1,9 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + // RUN: ld.lld %t.o -shared -soname=foo.so -o %t + // RUN: llvm-readobj --dynamic-table %t | FileCheck %s + + // CHECK: 0x000000000000000E SONAME Library soname: [foo.so] + + .global _start + _start: +Index: test/ELF/string-gc.s +=================================================================== +--- test/ELF/string-gc.s (revision 333896) ++++ test/ELF/string-gc.s (working copy) +@@ -1,73 +1,74 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + // RUN: ld.lld %t.o -o %t --gc-sections + // RUN: llvm-readobj -symbols %t | FileCheck %s + + // CHECK: Symbols [ + // CHECK-NEXT: Symbol { + // CHECK-NEXT: Name: (0) + // CHECK-NEXT: Value: 0x0 + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Local (0x0) + // CHECK-NEXT: Type: None (0x0) + // CHECK-NEXT: Other: 0 + // CHECK-NEXT: Section: Undefined (0x0) + // CHECK-NEXT: } + // CHECK-NEXT: Symbol { + // CHECK-NEXT: Name: s3 + // CHECK-NEXT: Value: 0x200120 + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Local (0x0) + // CHECK-NEXT: Type: Object (0x1) + // CHECK-NEXT: Other: 0 + // CHECK-NEXT: Section: .rodata (0x1) + // CHECK-NEXT: } + // CHECK-NEXT: Symbol { + // CHECK-NEXT: Name: s1 + // CHECK-NEXT: Value: 0x200125 + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Local (0x0) + // CHECK-NEXT: Type: Object (0x1) + // CHECK-NEXT: Other [ (0x2) + // CHECK-NEXT: STV_HIDDEN (0x2) + // CHECK-NEXT: ] + // CHECK-NEXT: Section: .rodata (0x1) + // CHECK-NEXT: } + // CHECK-NEXT: Symbol { + // CHECK-NEXT: Name: _start + // CHECK-NEXT: Value: 0x201000 + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Global (0x1) + // CHECK-NEXT: Type: Function (0x2) + // CHECK-NEXT: Other: 0 + // CHECK-NEXT: Section: .text (0x2) + // CHECK-NEXT: } + // CHECK-NEXT: ] + + .text + .globl _start + .type _start,@function + _start: + movl $s1, %eax + movl $s3, %eax + + .hidden s1 + .type s1,@object + .section .rodata.str1.1,"aMS",@progbits,1 + .globl s1 + s1: + .asciz "abcd" + + .hidden s2 + .type s2,@object + .globl s2 + s2: + .asciz "efgh" + + .type s3,@object + s3: + .asciz "ijkl" + + .type s4,@object + .globl s4 + s4: + .asciz "mnop" +Index: test/ELF/symbol-override.s +=================================================================== +--- test/ELF/symbol-override.s (revision 333896) ++++ test/ELF/symbol-override.s (working copy) +@@ -1,46 +1,47 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/symbol-override.s -o %t2.o + // RUN: ld.lld -shared %t2.o -o %t2.so + // RUN: ld.lld %t1.o %t2.so -o %t + // RUN: llvm-readobj -dyn-symbols %t | FileCheck %s + + // CHECK: DynamicSymbols [ + // CHECK-NEXT: Symbol { + // CHECK-NEXT: Name: + // CHECK-NEXT: Value: 0x0 + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Local + // CHECK-NEXT: Type: None + // CHECK-NEXT: Other: 0 + // CHECK-NEXT: Section: Undefined + // CHECK-NEXT: } + // CHECK-NEXT: Symbol { + // CHECK-NEXT: Name: do + // CHECK-NEXT: Value: 0x0 + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Global + // CHECK-NEXT: Type: Function + // CHECK-NEXT: Other: 0 + // CHECK-NEXT: Section: Undefined + // CHECK-NEXT: } + // CHECK-NEXT: Symbol { + // CHECK-NEXT: Name: foo + // CHECK-NEXT: Value: 0x201000 + // CHECK-NEXT: Size: 0 + // CHECK-NEXT: Binding: Global + // CHECK-NEXT: Type: Function + // CHECK-NEXT: Other: 0 + // CHECK-NEXT: Section: .text + // CHECK-NEXT: } + // CHECK-NEXT: ] + + .text + .globl foo + .type foo,@function + foo: + nop + + .text + .globl _start + _start: + callq do@plt +Index: test/ELF/text-section-prefix.s +=================================================================== +--- test/ELF/text-section-prefix.s (revision 333896) ++++ test/ELF/text-section-prefix.s (working copy) +@@ -1,38 +1,39 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + # RUN: ld.lld -z keep-text-section-prefix %t -o %t2 + # RUN: llvm-readelf -l %t2 | FileCheck %s + # RUN: ld.lld %t -o %t3 + # RUN: llvm-readelf -l %t3 | FileCheck --check-prefix=CHECKNO %s + # RUN: ld.lld -z nokeep-text-section-prefix %t -o %t4 + # RUN: llvm-readelf -l %t4 | FileCheck --check-prefix=CHECKNO %s + + # CHECK: .text + # CHECK: .text.hot + # CHECK: .text.startup + # CHECK: .text.exit + # CHECK: .text.unlikely + # CHECKNO: .text + # CHECKNO-NOT: .text.hot + + _start: + ret + + .section .text.f,"ax" + f: + nop + + .section .text.hot.f_hot,"ax" + f_hot: + nop + + .section .text.startup.f_startup,"ax" + f_startup: + nop + + .section .text.exit.f_exit,"ax" + f_exit: + nop + + .section .text.unlikely.f_unlikely,"ax" + f_unlikely: + nop +Index: test/ELF/tls-got.s +=================================================================== +--- test/ELF/tls-got.s (revision 333896) ++++ test/ELF/tls-got.s (working copy) +@@ -1,58 +1,59 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/tls-got.s -o %t2.o + // RUN: ld.lld -shared %t2.o -o %t2.so + // RUN: ld.lld --hash-style=sysv -e main %t1.o %t2.so -o %t3 + // RUN: llvm-readobj -s -r %t3 | FileCheck %s + // RUN: llvm-objdump -d %t3 | FileCheck --check-prefix=DISASM %s + + // CHECK: Section { + // CHECK: Index: 8 + // CHECK-NEXT: Name: .got + // CHECK-NEXT: Type: SHT_PROGBITS + // CHECK-NEXT: Flags [ + // CHECK-NEXT: SHF_ALLOC + // CHECK-NEXT: SHF_WRITE + // CHECK-NEXT: ] + // CHECK-NEXT: Address: [[ADDR:.*]] + // CHECK-NEXT: Offset: 0x20B0 + // CHECK-NEXT: Size: 16 + // CHECK-NEXT: Link: 0 + // CHECK-NEXT: Info: 0 + // CHECK-NEXT: AddressAlignment: 8 + // CHECK-NEXT: EntrySize: 0 + // CHECK-NEXT: } + + // CHECK: Relocations [ + // CHECK-NEXT: Section (4) .rela.dyn { + // CHECK-NEXT: 0x2020B8 R_X86_64_TPOFF64 tls0 0x0 + // CHECK-NEXT: 0x2020B0 R_X86_64_TPOFF64 tls1 0x0 + // CHECK-NEXT: } + // CHECK-NEXT: ] + + //0x201000 + 4265 + 7 = 0x2020B0 + //0x20100A + 4263 + 7 = 0x2020B8 + //0x201014 + 4253 + 7 = 0x2020B8 + //DISASM: Disassembly of section .text: + //DISASM-NEXT: main: + //DISASM-NEXT: 201000: 48 8b 05 a9 10 00 00 movq 4265(%rip), %rax + //DISASM-NEXT: 201007: 64 8b 00 movl %fs:(%rax), %eax + //DISASM-NEXT: 20100a: 48 8b 05 a7 10 00 00 movq 4263(%rip), %rax + //DISASM-NEXT: 201011: 64 8b 00 movl %fs:(%rax), %eax + //DISASM-NEXT: 201014: 48 8b 05 9d 10 00 00 movq 4253(%rip), %rax + //DISASM-NEXT: 20101b: 64 8b 00 movl %fs:(%rax), %eax + //DISASM-NEXT: 20101e: c3 retq + + .section .tdata,"awT",@progbits + + .text + .globl main + .align 16, 0x90 + .type main,@function + main: + movq tls1@GOTTPOFF(%rip), %rax + movl %fs:0(%rax), %eax + movq tls0@GOTTPOFF(%rip), %rax + movl %fs:0(%rax), %eax + movq tls0@GOTTPOFF(%rip), %rax + movl %fs:0(%rax), %eax + ret +Index: test/ELF/tls-opt-gdie.s +=================================================================== +--- test/ELF/tls-opt-gdie.s (revision 333896) ++++ test/ELF/tls-opt-gdie.s (working copy) +@@ -1,52 +1,53 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/tls-opt-gdie.s -o %tso.o + // RUN: ld.lld -shared %tso.o -o %t.so + // RUN: ld.lld --hash-style=sysv %t.o %t.so -o %t1 + // RUN: llvm-readobj -s -r %t1 | FileCheck --check-prefix=RELOC %s + // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s + + //RELOC: Section { + //RELOC: Index: + //RELOC: Name: .got + //RELOC-NEXT: Type: SHT_PROGBITS + //RELOC-NEXT: Flags [ + //RELOC-NEXT: SHF_ALLOC + //RELOC-NEXT: SHF_WRITE + //RELOC-NEXT: ] + //RELOC-NEXT: Address: 0x2020B0 + //RELOC-NEXT: Offset: 0x20B0 + //RELOC-NEXT: Size: 16 + //RELOC-NEXT: Link: 0 + //RELOC-NEXT: Info: 0 + //RELOC-NEXT: AddressAlignment: 8 + //RELOC-NEXT: EntrySize: 0 + //RELOC-NEXT: } + //RELOC: Relocations [ + //RELOC-NEXT: Section (4) .rela.dyn { + //RELOC-NEXT: 0x2020B0 R_X86_64_TPOFF64 tlsshared0 0x0 + //RELOC-NEXT: 0x2020B8 R_X86_64_TPOFF64 tlsshared1 0x0 + //RELOC-NEXT: } + //RELOC-NEXT: ] + + //0x201009 + (4256 + 7) = 0x2020B0 + //0x201019 + (4248 + 7) = 0x2020B8 + // DISASM: Disassembly of section .text: + // DISASM-NEXT: _start: + // DISASM-NEXT: 201000: {{.*}} movq %fs:0, %rax + // DISASM-NEXT: 201009: {{.*}} addq 4256(%rip), %rax + // DISASM-NEXT: 201010: {{.*}} movq %fs:0, %rax + // DISASM-NEXT: 201019: {{.*}} addq 4248(%rip), %rax + + .section .text + .globl _start + _start: + .byte 0x66 + leaq tlsshared0@tlsgd(%rip),%rdi + .word 0x6666 + rex64 + call __tls_get_addr@plt + .byte 0x66 + leaq tlsshared1@tlsgd(%rip),%rdi + .word 0x6666 + rex64 + call __tls_get_addr@plt +Index: test/ELF/tls-opt-gdiele-i686.s +=================================================================== +--- test/ELF/tls-opt-gdiele-i686.s (revision 333896) ++++ test/ELF/tls-opt-gdiele-i686.s (working copy) +@@ -1,59 +1,60 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %p/Inputs/tls-opt-gdiele-i686.s -o %tso.o + // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o + // RUN: ld.lld -shared %tso.o -o %tso + // RUN: ld.lld --hash-style=sysv %t.o %tso -o %tout + // RUN: llvm-readobj -r %tout | FileCheck --check-prefix=NORELOC %s + // RUN: llvm-objdump -d %tout | FileCheck --check-prefix=DISASM %s + + // NORELOC: Relocations [ + // NORELOC-NEXT: Section ({{.*}}) .rel.dyn { + // NORELOC-NEXT: 0x12058 R_386_TLS_TPOFF tlsshared0 0x0 + // NORELOC-NEXT: 0x1205C R_386_TLS_TPOFF tlsshared1 0x0 + // NORELOC-NEXT: } + // NORELOC-NEXT: ] + + // DISASM: Disassembly of section .text: + // DISASM-NEXT: _start: + // DISASM-NEXT: 11000: 65 a1 00 00 00 00 movl %gs:0, %eax + // DISASM-NEXT: 11006: 03 83 f8 ff ff ff addl -8(%ebx), %eax + // DISASM-NEXT: 1100c: 65 a1 00 00 00 00 movl %gs:0, %eax + // DISASM-NEXT: 11012: 03 83 fc ff ff ff addl -4(%ebx), %eax + // DISASM-NEXT: 11018: 65 a1 00 00 00 00 movl %gs:0, %eax + // DISASM-NEXT: 1101e: 81 e8 08 00 00 00 subl $8, %eax + // DISASM-NEXT: 11024: 65 a1 00 00 00 00 movl %gs:0, %eax + // DISASM-NEXT: 1102a: 81 e8 04 00 00 00 subl $4, %eax + + .type tlsexe1,@object + .section .tbss,"awT",@nobits + .globl tlsexe1 + .align 4 + tlsexe1: + .long 0 + .size tlsexe1, 4 + + .type tlsexe2,@object + .section .tbss,"awT",@nobits + .globl tlsexe2 + .align 4 + tlsexe2: + .long 0 + .size tlsexe2, 4 + + .section .text + .globl ___tls_get_addr + .type ___tls_get_addr,@function + ___tls_get_addr: + + .section .text + .globl _start + _start: + //GD->IE + leal tlsshared0@tlsgd(,%ebx,1),%eax + call ___tls_get_addr@plt + leal tlsshared1@tlsgd(,%ebx,1),%eax + call ___tls_get_addr@plt + //GD->IE + leal tlsexe1@tlsgd(,%ebx,1),%eax + call ___tls_get_addr@plt + leal tlsexe2@tlsgd(,%ebx,1),%eax + call ___tls_get_addr@plt +Index: test/ELF/tls-opt-i686.s +=================================================================== +--- test/ELF/tls-opt-i686.s (revision 333896) ++++ test/ELF/tls-opt-i686.s (working copy) +@@ -1,69 +1,70 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o + // RUN: ld.lld %t.o -o %t1 + // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s + // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s + + // NORELOC: Relocations [ + // NORELOC-NEXT: ] + + // DISASM: Disassembly of section .text: + // DISASM-NEXT: _start: + // LD -> LE: + // DISASM-NEXT: 11000: 65 a1 00 00 00 00 movl %gs:0, %eax + // DISASM-NEXT: 11006: 90 nop + // DISASM-NEXT: 11007: 8d 74 26 00 leal (%esi), %esi + // DISASM-NEXT: 1100b: 8d 90 f8 ff ff ff leal -8(%eax), %edx + // DISASM-NEXT: 11011: 65 a1 00 00 00 00 movl %gs:0, %eax + // DISASM-NEXT: 11017: 90 nop + // DISASM-NEXT: 11018: 8d 74 26 00 leal (%esi), %esi + // DISASM-NEXT: 1101c: 8d 90 fc ff ff ff leal -4(%eax), %edx + // IE -> LE: + // 4294967288 == 0xFFFFFFF8 + // 4294967292 == 0xFFFFFFFC + // DISASM-NEXT: 11022: 65 a1 00 00 00 00 movl %gs:0, %eax + // DISASM-NEXT: 11028: c7 c0 f8 ff ff ff movl $4294967288, %eax + // DISASM-NEXT: 1102e: 65 a1 00 00 00 00 movl %gs:0, %eax + // DISASM-NEXT: 11034: c7 c0 fc ff ff ff movl $4294967292, %eax + // DISASM-NEXT: 1103a: 65 a1 00 00 00 00 movl %gs:0, %eax + // DISASM-NEXT: 11040: 8d 80 f8 ff ff ff leal -8(%eax), %eax + // DISASM-NEXT: 11046: 65 a1 00 00 00 00 movl %gs:0, %eax + // DISASM-NEXT: 1104c: 8d 80 fc ff ff ff leal -4(%eax), %eax + .type tls0,@object + .section .tbss,"awT",@nobits + .globl tls0 + .align 4 + tls0: + .long 0 + .size tls0, 4 + + .type tls1,@object + .globl tls1 + .align 4 + tls1: + .long 0 + .size tls1, 4 + + .section .text + .globl ___tls_get_addr + .type ___tls_get_addr,@function + ___tls_get_addr: + + .section .text + .globl _start + _start: + //LD -> LE: + leal tls0@tlsldm(%ebx),%eax + call ___tls_get_addr@plt + leal tls0@dtpoff(%eax),%edx + leal tls1@tlsldm(%ebx),%eax + call ___tls_get_addr@plt + leal tls1@dtpoff(%eax),%edx + //IE -> LE: + movl %gs:0,%eax + movl tls0@gotntpoff(%ebx),%eax + movl %gs:0,%eax + movl tls1@gotntpoff(%ebx),%eax + movl %gs:0,%eax + addl tls0@gotntpoff(%ebx),%eax + movl %gs:0,%eax + addl tls1@gotntpoff(%ebx),%eax +Index: test/ELF/tls-opt-iele-i686-nopic.s +=================================================================== +--- test/ELF/tls-opt-iele-i686-nopic.s (revision 333896) ++++ test/ELF/tls-opt-iele-i686-nopic.s (working copy) +@@ -1,100 +1,101 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o + // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %p/Inputs/tls-opt-iele-i686-nopic.s -o %tso.o + // RUN: ld.lld -shared %tso.o -o %tso + // RUN: ld.lld --hash-style=sysv %t.o %tso -o %t1 + // RUN: llvm-readobj -s -r %t1 | FileCheck --check-prefix=GOTREL %s + // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s + + // GOTREL: Section { + // GOTREL: Index: + // GOTREL: Name: .got + // GOTREL-NEXT: Type: SHT_PROGBITS + // GOTREL-NEXT: Flags [ + // GOTREL-NEXT: SHF_ALLOC + // GOTREL-NEXT: SHF_WRITE + // GOTREL-NEXT: ] + // GOTREL-NEXT: Address: 0x12058 + // GOTREL-NEXT: Offset: 0x2058 + // GOTREL-NEXT: Size: 8 + // GOTREL-NEXT: Link: 0 + // GOTREL-NEXT: Info: 0 + // GOTREL-NEXT: AddressAlignment: 4 + // GOTREL-NEXT: EntrySize: 0 + // GOTREL-NEXT: } + // GOTREL: Relocations [ + // GOTREL-NEXT: Section ({{.*}}) .rel.dyn { + // GOTREL-NEXT: 0x12058 R_386_TLS_TPOFF tlsshared0 0x0 + // GOTREL-NEXT: 0x1205C R_386_TLS_TPOFF tlsshared1 0x0 + // GOTREL-NEXT: } + // GOTREL-NEXT: ] + + // DISASM: Disassembly of section .text: + // DISASM-NEXT: _start: + // 4294967288 = 0xFFFFFFF8 + // 4294967292 = 0xFFFFFFFC + // 73808 = (.got)[0] = 0x12058 + // 73812 = (.got)[1] = 0x1205C + // DISASM-NEXT: 11000: c7 c1 f8 ff ff ff movl $4294967288, %ecx + // DISASM-NEXT: 11006: 65 8b 01 movl %gs:(%ecx), %eax + // DISASM-NEXT: 11009: b8 f8 ff ff ff movl $4294967288, %eax + // DISASM-NEXT: 1100e: 65 8b 00 movl %gs:(%eax), %eax + // DISASM-NEXT: 11011: 81 c1 f8 ff ff ff addl $4294967288, %ecx + // DISASM-NEXT: 11017: 65 8b 01 movl %gs:(%ecx), %eax + // DISASM-NEXT: 1101a: c7 c1 fc ff ff ff movl $4294967292, %ecx + // DISASM-NEXT: 11020: 65 8b 01 movl %gs:(%ecx), %eax + // DISASM-NEXT: 11023: b8 fc ff ff ff movl $4294967292, %eax + // DISASM-NEXT: 11028: 65 8b 00 movl %gs:(%eax), %eax + // DISASM-NEXT: 1102b: 81 c1 fc ff ff ff addl $4294967292, %ecx + // DISASM-NEXT: 11031: 65 8b 01 movl %gs:(%ecx), %eax + // DISASM-NEXT: 11034: 8b 0d 58 20 01 00 movl 73816, %ecx + // DISASM-NEXT: 1103a: 65 8b 01 movl %gs:(%ecx), %eax + // DISASM-NEXT: 1103d: 03 0d 5c 20 01 00 addl 73820, %ecx + // DISASM-NEXT: 11043: 65 8b 01 movl %gs:(%ecx), %eax + + .type tlslocal0,@object + .section .tbss,"awT",@nobits + .globl tlslocal0 + .align 4 + tlslocal0: + .long 0 + .size tlslocal0, 4 + + .type tlslocal1,@object + .section .tbss,"awT",@nobits + .globl tlslocal1 + .align 4 + tlslocal1: + .long 0 + .size tlslocal1, 4 + + .section .text + .globl ___tls_get_addr + .type ___tls_get_addr,@function + ___tls_get_addr: + + .section .text + .globl _start + _start: + movl tlslocal0@indntpoff,%ecx + movl %gs:(%ecx),%eax + + movl tlslocal0@indntpoff,%eax + movl %gs:(%eax),%eax + + addl tlslocal0@indntpoff,%ecx + movl %gs:(%ecx),%eax + + movl tlslocal1@indntpoff,%ecx + movl %gs:(%ecx),%eax + + movl tlslocal1@indntpoff,%eax + movl %gs:(%eax),%eax + + addl tlslocal1@indntpoff,%ecx + movl %gs:(%ecx),%eax + + movl tlsshared0@indntpoff,%ecx + movl %gs:(%ecx),%eax + + addl tlsshared1@indntpoff,%ecx + movl %gs:(%ecx),%eax +Index: test/ELF/tls-opt-local.s +=================================================================== +--- test/ELF/tls-opt-local.s (revision 333896) ++++ test/ELF/tls-opt-local.s (working copy) +@@ -1,52 +1,53 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + // RUN: ld.lld %t.o -o %t1 + // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s + // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s + + // NORELOC: Relocations [ + // NORELOC-NEXT: ] + + // DISASM: Disassembly of section .text: + // DISASM-NEXT: _start: + // DISASM-NEXT: 201000: 48 c7 c0 f8 ff ff ff movq $-8, %rax + // DISASM-NEXT: 201007: 49 c7 c7 f8 ff ff ff movq $-8, %r15 + // DISASM-NEXT: 20100e: 48 8d 80 f8 ff ff ff leaq -8(%rax), %rax + // DISASM-NEXT: 201015: 4d 8d bf f8 ff ff ff leaq -8(%r15), %r15 + // DISASM-NEXT: 20101c: 48 81 c4 f8 ff ff ff addq $-8, %rsp + // DISASM-NEXT: 201023: 49 81 c4 f8 ff ff ff addq $-8, %r12 + // DISASM-NEXT: 20102a: 48 c7 c0 fc ff ff ff movq $-4, %rax + // DISASM-NEXT: 201031: 49 c7 c7 fc ff ff ff movq $-4, %r15 + // DISASM-NEXT: 201038: 48 8d 80 fc ff ff ff leaq -4(%rax), %rax + // DISASM-NEXT: 20103f: 4d 8d bf fc ff ff ff leaq -4(%r15), %r15 + // DISASM-NEXT: 201046: 48 81 c4 fc ff ff ff addq $-4, %rsp + // DISASM-NEXT: 20104d: 49 81 c4 fc ff ff ff addq $-4, %r12 + + .section .tbss,"awT",@nobits + + .type tls0,@object + .align 4 + tls0: + .long 0 + .size tls0, 4 + + .type tls1,@object + .align 4 + tls1: + .long 0 + .size tls1, 4 + + .section .text + .globl _start + _start: + movq tls0@GOTTPOFF(%rip), %rax + movq tls0@GOTTPOFF(%rip), %r15 + addq tls0@GOTTPOFF(%rip), %rax + addq tls0@GOTTPOFF(%rip), %r15 + addq tls0@GOTTPOFF(%rip), %rsp + addq tls0@GOTTPOFF(%rip), %r12 + movq tls1@GOTTPOFF(%rip), %rax + movq tls1@GOTTPOFF(%rip), %r15 + addq tls1@GOTTPOFF(%rip), %rax + addq tls1@GOTTPOFF(%rip), %r15 + addq tls1@GOTTPOFF(%rip), %rsp + addq tls1@GOTTPOFF(%rip), %r12 +Index: test/ELF/tls-opt-no-plt.s +=================================================================== +--- test/ELF/tls-opt-no-plt.s (revision 333896) ++++ test/ELF/tls-opt-no-plt.s (working copy) +@@ -1,34 +1,35 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/tls-opt-gdie.s -o %t2.o + // RUN: ld.lld %t2.o -o %t2.so -shared + // RUN: ld.lld %t.o %t2.so -o %t.exe + // RUN: llvm-readobj -s %t.exe | FileCheck %s + + // CHECK-NOT: .plt + + .global _start + _start: + data16 + leaq foo@TLSGD(%rip), %rdi + data16 + data16 + rex64 + callq __tls_get_addr@PLT + + leaq bar@TLSLD(%rip), %rdi + callq __tls_get_addr@PLT + leaq bar@DTPOFF(%rax), %rax + + .type bar,@object + .section .tdata,"awT",@progbits + .align 8 + bar: + .long 42 + + + .type foo,@object + .section .tdata,"awT",@progbits + .globl foo + .align 8 + foo: + .long 42 +Index: test/ELF/tls-opt.s +=================================================================== +--- test/ELF/tls-opt.s (revision 333896) ++++ test/ELF/tls-opt.s (working copy) +@@ -1,99 +1,100 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + // RUN: ld.lld %t.o -o %t1 + // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s + // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s + + // NORELOC: Relocations [ + // NORELOC-NEXT: ] + + // DISASM: _start: + // DISASM-NEXT: 201000: 48 c7 c0 f8 ff ff ff movq $-8, %rax + // DISASM-NEXT: 201007: 49 c7 c7 f8 ff ff ff movq $-8, %r15 + // DISASM-NEXT: 20100e: 48 8d 80 f8 ff ff ff leaq -8(%rax), %rax + // DISASM-NEXT: 201015: 4d 8d bf f8 ff ff ff leaq -8(%r15), %r15 + // DISASM-NEXT: 20101c: 48 81 c4 f8 ff ff ff addq $-8, %rsp + // DISASM-NEXT: 201023: 49 81 c4 f8 ff ff ff addq $-8, %r12 + // DISASM-NEXT: 20102a: 48 c7 c0 fc ff ff ff movq $-4, %rax + // DISASM-NEXT: 201031: 49 c7 c7 fc ff ff ff movq $-4, %r15 + // DISASM-NEXT: 201038: 48 8d 80 fc ff ff ff leaq -4(%rax), %rax + // DISASM-NEXT: 20103f: 4d 8d bf fc ff ff ff leaq -4(%r15), %r15 + // DISASM-NEXT: 201046: 48 81 c4 fc ff ff ff addq $-4, %rsp + // DISASM-NEXT: 20104d: 49 81 c4 fc ff ff ff addq $-4, %r12 + + // LD to LE: + // DISASM-NEXT: 201054: 66 66 66 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax + // DISASM-NEXT: 201060: 48 8d 88 f8 ff ff ff leaq -8(%rax), %rcx + // DISASM-NEXT: 201067: 66 66 66 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax + // DISASM-NEXT: 201073: 48 8d 88 fc ff ff ff leaq -4(%rax), %rcx + + // GD to LE: + // DISASM-NEXT: 20107a: 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax + // DISASM-NEXT: 201083: 48 8d 80 f8 ff ff ff leaq -8(%rax), %rax + // DISASM-NEXT: 20108a: 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax + // DISASM-NEXT: 201093: 48 8d 80 fc ff ff ff leaq -4(%rax), %rax + + // LD to LE: + // DISASM: _DTPOFF64_1: + // DISASM-NEXT: 20109a: f8 clc + // DISASM: _DTPOFF64_2: + // DISASM-NEXT: 2010a3: fc cld + + .type tls0,@object + .section .tbss,"awT",@nobits + .globl tls0 + .align 4 + tls0: + .long 0 + .size tls0, 4 + + .type tls1,@object + .globl tls1 + .align 4 + tls1: + .long 0 + .size tls1, 4 + + .section .text + .globl _start + _start: + movq tls0@GOTTPOFF(%rip), %rax + movq tls0@GOTTPOFF(%rip), %r15 + addq tls0@GOTTPOFF(%rip), %rax + addq tls0@GOTTPOFF(%rip), %r15 + addq tls0@GOTTPOFF(%rip), %rsp + addq tls0@GOTTPOFF(%rip), %r12 + movq tls1@GOTTPOFF(%rip), %rax + movq tls1@GOTTPOFF(%rip), %r15 + addq tls1@GOTTPOFF(%rip), %rax + addq tls1@GOTTPOFF(%rip), %r15 + addq tls1@GOTTPOFF(%rip), %rsp + addq tls1@GOTTPOFF(%rip), %r12 + + // LD to LE + leaq tls0@tlsld(%rip), %rdi + callq __tls_get_addr@PLT + leaq tls0@dtpoff(%rax),%rcx + leaq tls1@tlsld(%rip), %rdi + callq __tls_get_addr@PLT + leaq tls1@dtpoff(%rax),%rcx + + // GD to LE + .byte 0x66 + leaq tls0@tlsgd(%rip),%rdi + .word 0x6666 + rex64 + call __tls_get_addr@plt + .byte 0x66 + leaq tls1@tlsgd(%rip),%rdi + .word 0x6666 + rex64 + call __tls_get_addr@plt + + // LD to LE + _DTPOFF64_1: + .quad tls0@DTPOFF + nop + + _DTPOFF64_2: + .quad tls1@DTPOFF + nop +Index: test/ELF/trace-symbols.s +=================================================================== +--- test/ELF/trace-symbols.s (revision 333896) ++++ test/ELF/trace-symbols.s (working copy) +@@ -1,82 +1,83 @@ ++# REQUIRES: x86 + # Test -y symbol and -trace-symbol=symbol + + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ + # RUN: %p/Inputs/trace-symbols-foo-weak.s -o %t1 + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ + # RUN: %p/Inputs/trace-symbols-foo-strong.s -o %t2 + # RUN: ld.lld -shared %t1 -o %t1.so + # RUN: ld.lld -shared %t2 -o %t2.so + # RUN: llvm-ar rcs %t1.a %t1 + # RUN: llvm-ar rcs %t2.a %t2 + + # RUN: ld.lld -y foo -trace-symbol common -trace-symbol=hsymbol \ + # RUN: %t %t1 %t2 -o %t3 2>&1 | FileCheck -check-prefix=OBJECTRFOO %s + # OBJECTRFOO: trace-symbols.s.tmp: reference to foo + + # RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \ + # RUN: %t %t1 %t2 -o %t3 2>&1 | FileCheck -check-prefix=OBJECTDCOMMON %s + # OBJECTDCOMMON: trace-symbols.s.tmp1: common definition of common + + # RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \ + # RUN: %t %t1 %t2 -o %t3 2>&1 | FileCheck -check-prefix=OBJECTD1FOO %s + # OBJECTD1FOO: trace-symbols.s.tmp: reference to foo + # OBJECTD1FOO: trace-symbols.s.tmp1: common definition of common + # OBJECTD1FOO: trace-symbols.s.tmp1: definition of foo + # OBJECTD1FOO: trace-symbols.s.tmp2: definition of foo + + # RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \ + # RUN: %t %t1 %t2 -o %t3 2>&1 | FileCheck -check-prefix=OBJECTD2FOO %s + # RUN: ld.lld -y foo -y common --trace-symbol=hsymbol \ + # RUN: %t %t2 %t1 -o %t4 2>&1 | FileCheck -check-prefix=OBJECTD2FOO %s + # RUN: ld.lld -y foo -y common %t %t1.so %t2 -o %t3 2>&1 | \ + # RUN: FileCheck -check-prefix=OBJECTD2FOO %s + # OBJECTD2FOO: trace-symbols.s.tmp2: definition of foo + + # RUN: ld.lld -y foo -y common %t %t2 %t1.a -o %t3 2>&1 | \ + # RUN: FileCheck -check-prefix=FOO_AND_COMMON %s + # FOO_AND_COMMON: trace-symbols.s.tmp: reference to foo + # FOO_AND_COMMON: trace-symbols.s.tmp2: definition of foo + # FOO_AND_COMMON: trace-symbols.s.tmp1.a: lazy definition of common + + # RUN: ld.lld -y foo -y common %t %t1.so %t2 -o %t3 2>&1 | \ + # RUN: FileCheck -check-prefix=SHLIBDCOMMON %s + # SHLIBDCOMMON: trace-symbols.s.tmp1.so: shared definition of common + + # RUN: ld.lld -y foo -y common %t %t2.so %t1.so -o %t3 2>&1 | \ + # RUN: FileCheck -check-prefix=SHLIBD2FOO %s + # RUN: ld.lld -y foo %t %t1.a %t2.so -o %t3 | \ + # RUN: FileCheck -check-prefix=NO-SHLIBD2FOO %s + # SHLIBD2FOO: trace-symbols.s.tmp2.so: shared definition of foo + # NO-SHLIBD2FOO-NOT: trace-symbols.s.tmp2.so: definition of foo + + # RUN: ld.lld -y foo -y common %t %t2 %t1.a -o %t3 2>&1 | \ + # RUN: FileCheck -check-prefix=ARCHIVEDCOMMON %s + # ARCHIVEDCOMMON-NOT: trace-symbols.s.tmp1.a(trace-symbols.s.tmp1): definition of \ + # common + + # RUN: ld.lld -y foo %t %t1.a %t2.so -o %t3 | \ + # RUN: FileCheck -check-prefix=ARCHIVED1FOO %s + # ARCHIVED1FOO: trace-symbols.s.tmp1.a(trace-symbols.s.tmp1): definition of foo + + # RUN: ld.lld -y foo %t %t1.a %t2.a -o %t3 | \ + # RUN: FileCheck -check-prefix=ARCHIVED2FOO %s + # ARCHIVED2FOO: trace-symbols.s.tmp2.a(trace-symbols.s.tmp2): definition of foo + + # RUN: ld.lld -y bar %t %t1.so %t2.so -o %t3 | \ + # RUN: FileCheck -check-prefix=SHLIBDBAR %s + # SHLIBDBAR: trace-symbols.s.tmp2.so: shared definition of bar + + # RUN: ld.lld -y foo -y bar %t %t1.so %t2.so -o %t3 | \ + # RUN: FileCheck -check-prefix=SHLIBRBAR %s + # 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 + # STARTLIB: trace-symbols.s.tmp1: reference to bar + + .hidden hsymbol + .globl _start + .type _start, @function + _start: + call foo +Index: test/ELF/undef-shared.s +=================================================================== +--- test/ELF/undef-shared.s (revision 333896) ++++ test/ELF/undef-shared.s (working copy) +@@ -1,22 +1,23 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + # RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s + + # CHECK: error: undefined symbol: hidden + # CHECK: >>> referenced by {{.*}}:(.data+0x0) + .global hidden + .hidden hidden + + # CHECK: error: undefined symbol: internal + # CHECK: >>> referenced by {{.*}}:(.data+0x8) + .global internal + .internal internal + + # CHECK: error: undefined symbol: protected + # CHECK: >>> referenced by {{.*}}:(.data+0x10) + .global protected + .protected protected + + .section .data, "a" + .quad hidden + .quad internal + .quad protected +Index: test/ELF/undef-shared2.s +=================================================================== +--- test/ELF/undef-shared2.s (revision 333896) ++++ test/ELF/undef-shared2.s (working copy) +@@ -1,10 +1,11 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef-shared2.s -o %t2.o + # RUN: not ld.lld %t.o %t2.o -o %t.so -shared 2>&1 | FileCheck %s + # RUN: not ld.lld %t2.o %t.o -o %t.so -shared 2>&1 | FileCheck %s + + # CHECK: error: undefined symbol: foo + + .data + .quad foo + .protected foo +Index: test/ELF/undef-version-script.s +=================================================================== +--- test/ELF/undef-version-script.s (revision 333896) ++++ test/ELF/undef-version-script.s (working copy) +@@ -1,40 +1,41 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + # RUN: echo "{ local: *; };" > %t.script + # RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so + # RUN: llvm-readobj -dyn-symbols %t.so | FileCheck %s + + # CHECK: DynamicSymbols [ + # CHECK-NEXT: Symbol { + # CHECK-NEXT: Name: @ + # CHECK-NEXT: Value: 0x0 + # CHECK-NEXT: Size: 0 + # CHECK-NEXT: Binding: Local (0x0) + # CHECK-NEXT: Type: None (0x0) + # CHECK-NEXT: Other: 0 + # CHECK-NEXT: Section: Undefined (0x0) + # CHECK-NEXT: } + # CHECK-NEXT: Symbol { + # CHECK-NEXT: Name: bar@ + # CHECK-NEXT: Value: 0x0 + # CHECK-NEXT: Size: 0 + # CHECK-NEXT: Binding: Weak (0x2) + # CHECK-NEXT: Type: None (0x0) + # CHECK-NEXT: Other: 0 + # CHECK-NEXT: Section: Undefined (0x0) + # CHECK-NEXT: } + # CHECK-NEXT: Symbol { + # CHECK-NEXT: Name: foo@ + # CHECK-NEXT: Value: 0x0 + # CHECK-NEXT: Size: 0 + # CHECK-NEXT: Binding: Global (0x1) + # CHECK-NEXT: Type: None (0x0) + # CHECK-NEXT: Other: 0 + # CHECK-NEXT: Section: Undefined (0x0) + # CHECK-NEXT: } + # CHECK-NEXT: ] + + .global foo + .weak bar + .data + .dc.a foo + .dc.a bar +Index: test/ELF/user_def_init_array_start.s +=================================================================== +--- test/ELF/user_def_init_array_start.s (revision 333896) ++++ test/ELF/user_def_init_array_start.s (working copy) +@@ -1,10 +1,11 @@ ++// REQUIRES: x86 + // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + // RUN: ld.lld %t.o -o %t2.so -shared + // Allow user defined __init_array_start. This is used by musl because of the + // the bfd linker not handling these properly. We always create them as + // hidden, musl should not have problems with lld. + + .hidden __init_array_start + .globl __init_array_start + __init_array_start: + .zero 8 +Index: test/ELF/version-script-no-warn2.s +=================================================================== +--- test/ELF/version-script-no-warn2.s (revision 333896) ++++ test/ELF/version-script-no-warn2.s (working copy) +@@ -1,8 +1,9 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/version-script-no-warn2.s -o %t1.o + # RUN: ld.lld %t1.o -o %t1.so -shared + # RUN: echo "{ global: foo; local: *; };" > %t.script + # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t2.o + # RUN: ld.lld -shared --version-script %t.script %t2.o %t1.so -o %t2.so --fatal-warnings + + .global foo + foo: +Index: test/ELF/x86-64-reloc-range.s +=================================================================== +--- test/ELF/x86-64-reloc-range.s (revision 333896) ++++ test/ELF/x86-64-reloc-range.s (working copy) +@@ -1,13 +1,14 @@ ++// REQUIRES: x86 + // RUN: llvm-mc %s -o %t.o -triple x86_64-pc-linux -filetype=obj + // RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s + + // CHECK: {{.*}}:(.text+0x3): relocation R_X86_64_PC32 out of range: 2147483648 is not in [-2147483648, 2147483647] + // CHECK-NOT: relocation + + lea foo(%rip), %rax + lea foo(%rip), %rax + + .hidden foo + .bss + .zero 0x7fffe007 + foo: +Index: test/ELF/zdefs.s +=================================================================== +--- test/ELF/zdefs.s (revision 333896) ++++ test/ELF/zdefs.s (working copy) +@@ -1,8 +1,9 @@ ++# REQUIRES: x86 + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + # RUN: ld.lld -shared %t.o -o %t1.so + + # RUN: not ld.lld -z defs -shared %t.o -o %t1.so 2>&1 | FileCheck -check-prefix=ERR %s + # ERR: error: undefined symbol: foo + # ERR: >>> referenced by {{.*}}:(.text+0x1) + + callq foo@PLT Index: lld/trunk/test/COFF/associative-comdat.s =================================================================== --- lld/trunk/test/COFF/associative-comdat.s +++ lld/trunk/test/COFF/associative-comdat.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple=x86_64-windows-msvc %s -filetype=obj -o %t1.obj # RUN: llvm-mc -triple=x86_64-windows-msvc %S/Inputs/associative-comdat-2.s -filetype=obj -o %t2.obj Index: lld/trunk/test/COFF/dll.test =================================================================== --- lld/trunk/test/COFF/dll.test +++ lld/trunk/test/COFF/dll.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj # RUN: lld-link /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2 \ # RUN: /export:mangled Index: lld/trunk/test/COFF/dllexport-mingw.s =================================================================== --- lld/trunk/test/COFF/dllexport-mingw.s +++ lld/trunk/test/COFF/dllexport-mingw.s @@ -1,4 +1,4 @@ -# REQEUIRES: x86 +# REQUIRES: x86 # RUN: llvm-mc -triple=i686-windows-gnu %s -filetype=obj -o %t.obj Index: lld/trunk/test/COFF/duplicate.test =================================================================== --- lld/trunk/test/COFF/duplicate.test +++ lld/trunk/test/COFF/duplicate.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o alpha.obj %S/Inputs/alpha.ll RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o beta.obj %S/Inputs/beta.ll RUN: lld-link /out:alpha.dll /dll alpha.obj /implib:alpha.lib Index: lld/trunk/test/COFF/export-all.s =================================================================== --- lld/trunk/test/COFF/export-all.s +++ lld/trunk/test/COFF/export-all.s @@ -1,4 +1,4 @@ -# REQEUIRES: x86 +# REQUIRES: x86 # RUN: llvm-mc -triple=i686-windows-gnu %s -filetype=obj -o %t.obj Index: lld/trunk/test/COFF/gfids-corrupt.s =================================================================== --- lld/trunk/test/COFF/gfids-corrupt.s +++ lld/trunk/test/COFF/gfids-corrupt.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj # RUN: lld-link %t.obj -opt:noref -guard:nolongjmp -out:%t.exe -entry:main 2>&1 | FileCheck %s --check-prefix=ERRS # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s Index: lld/trunk/test/COFF/gfids-fallback.s =================================================================== --- lld/trunk/test/COFF/gfids-fallback.s +++ lld/trunk/test/COFF/gfids-fallback.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: grep -B99999 [S]PLITMARKER %s | llvm-mc -triple x86_64-windows-msvc -filetype=obj -o %t1.obj # RUN: grep -A99999 [S]PLITMARKER %s | llvm-mc -triple x86_64-windows-msvc -filetype=obj -o %t2.obj # RUN: lld-link %t1.obj %t2.obj -guard:nolongjmp -out:%t.exe -entry:main -opt:noref Index: lld/trunk/test/COFF/gfids-gc.s =================================================================== --- lld/trunk/test/COFF/gfids-gc.s +++ lld/trunk/test/COFF/gfids-gc.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj # RUN: lld-link %t.obj -guard:nolongjmp -out:%t.exe -opt:noref -entry:main # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s --check-prefix=CHECK-NOGC Index: lld/trunk/test/COFF/gfids-icf.s =================================================================== --- lld/trunk/test/COFF/gfids-icf.s +++ lld/trunk/test/COFF/gfids-icf.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj # RUN: lld-link %t.obj -guard:nolongjmp -out:%t.exe -opt:icf -entry:main # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s --check-prefix=CHECK Index: lld/trunk/test/COFF/guard-longjmp.s =================================================================== --- lld/trunk/test/COFF/guard-longjmp.s +++ lld/trunk/test/COFF/guard-longjmp.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj # RUN: lld-link %t.obj -guard:cf -out:%t.exe -entry:main # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s Index: lld/trunk/test/COFF/guardcf-lto.ll =================================================================== --- lld/trunk/test/COFF/guardcf-lto.ll +++ lld/trunk/test/COFF/guardcf-lto.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; Set up an import library for a DLL that will do the indirect call. ; RUN: echo -e 'LIBRARY library\nEXPORTS\n do_indirect_call\n' > %t.def ; RUN: lld-link -lib -def:%t.def -out:%t.lib -machine:x64 Index: lld/trunk/test/COFF/icf-executable.s =================================================================== --- lld/trunk/test/COFF/icf-executable.s +++ lld/trunk/test/COFF/icf-executable.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple=x86_64-windows-msvc %s -filetype=obj -o %t.obj # RUN: lld-link -entry:main %t.obj -out:%t.exe -verbose 2>&1 | FileCheck %s Index: lld/trunk/test/COFF/icf-pdata.s =================================================================== --- lld/trunk/test/COFF/icf-pdata.s +++ lld/trunk/test/COFF/icf-pdata.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc %s -triple x86_64-windows-msvc -filetype=obj -o %t.obj # RUN: lld-link %t.obj -dll -noentry -out:%t.dll -merge:.xdata=.xdata # RUN: llvm-readobj -sections -coff-exports %t.dll | FileCheck %s Index: lld/trunk/test/COFF/icf-xdata.s =================================================================== --- lld/trunk/test/COFF/icf-xdata.s +++ lld/trunk/test/COFF/icf-xdata.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc %s -triple x86_64-windows-msvc -filetype=obj -o %t.obj # RUN: lld-link %t.obj -dll -noentry -out:%t.dll -merge:.xdata=.xdata 2>&1 \ # RUN: | FileCheck %s --check-prefix=WARN Index: lld/trunk/test/COFF/implib-name.test =================================================================== --- lld/trunk/test/COFF/implib-name.test +++ lld/trunk/test/COFF/implib-name.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: mkdir -p %T # RUN: llvm-mc -triple x86_64-unknown-windows-msvc -filetype obj -o %T/object.obj %S/Inputs/object.s Index: lld/trunk/test/COFF/loadcfg.ll =================================================================== --- lld/trunk/test/COFF/loadcfg.ll +++ lld/trunk/test/COFF/loadcfg.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %t.obj %s ; RUN: lld-link /out:%t.exe %t.obj /entry:main /subsystem:console ; RUN: llvm-readobj -file-headers %t.exe | FileCheck %s Index: lld/trunk/test/COFF/lto-chkstk.ll =================================================================== --- lld/trunk/test/COFF/lto-chkstk.ll +++ lld/trunk/test/COFF/lto-chkstk.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %t.obj %s ; RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %T/lto-chkstk-foo.obj %S/Inputs/lto-chkstk-foo.s ; RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %T/lto-chkstk-chkstk.obj %S/Inputs/lto-chkstk-chkstk.s Index: lld/trunk/test/COFF/lto-comdat.ll =================================================================== --- lld/trunk/test/COFF/lto-comdat.ll +++ lld/trunk/test/COFF/lto-comdat.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %T/comdat-main.lto.obj %s ; RUN: llvm-as -o %T/comdat1.lto.obj %S/Inputs/lto-comdat1.ll ; RUN: llvm-as -o %T/comdat2.lto.obj %S/Inputs/lto-comdat2.ll Index: lld/trunk/test/COFF/lto-icf.ll =================================================================== --- lld/trunk/test/COFF/lto-icf.ll +++ lld/trunk/test/COFF/lto-icf.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; Test that ICF works after LTO, i.e. both functions have the same address. ; Previously, when we didn't enable function sections, ICF didn't work. Index: lld/trunk/test/COFF/lto-lazy-reference.ll =================================================================== --- lld/trunk/test/COFF/lto-lazy-reference.ll +++ lld/trunk/test/COFF/lto-lazy-reference.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llc -mtriple=i686-pc-windows-msvc -filetype=obj -o %T/lto-lazy-reference-quadruple.obj %S/Inputs/lto-lazy-reference-quadruple.ll ; RUN: llvm-as -o %T/lto-lazy-reference-dummy.bc %S/Inputs/lto-lazy-reference-dummy.ll ; RUN: rm -f %t.lib Index: lld/trunk/test/COFF/lto-linker-opts.ll =================================================================== --- lld/trunk/test/COFF/lto-linker-opts.ll +++ lld/trunk/test/COFF/lto-linker-opts.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %T/lto-linker-opts.obj %s ; RUN: env LIB=%S/Inputs lld-link /out:%T/lto-linker-opts.exe /entry:main /subsystem:console %T/lto-linker-opts.obj Index: lld/trunk/test/COFF/lto-new-symbol.ll =================================================================== --- lld/trunk/test/COFF/lto-new-symbol.ll +++ lld/trunk/test/COFF/lto-new-symbol.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %t.obj %s ; RUN: lld-link /out:%t.exe /entry:foo /subsystem:console %t.obj Index: lld/trunk/test/COFF/lto-opt-level.ll =================================================================== --- lld/trunk/test/COFF/lto-opt-level.ll +++ lld/trunk/test/COFF/lto-opt-level.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %t.obj %s ; RUN: lld-link /out:%t0.exe /entry:main /subsystem:console /opt:lldlto=0 /lldmap:%t0.map %t.obj ; RUN: FileCheck --check-prefix=CHECK-O0 %s < %t0.map Index: lld/trunk/test/COFF/lto-parallel.ll =================================================================== --- lld/trunk/test/COFF/lto-parallel.ll +++ lld/trunk/test/COFF/lto-parallel.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %t.obj %s ; RUN: lld-link -opt:noicf /out:%t.exe /entry:foo /include:bar /opt:lldltopartitions=2 /subsystem:console /lldmap:%t.map %t.obj ; RUN: FileCheck %s < %t.map Index: lld/trunk/test/COFF/lto-reloc-model.ll =================================================================== --- lld/trunk/test/COFF/lto-reloc-model.ll +++ lld/trunk/test/COFF/lto-reloc-model.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %t %s ; RUN: lld-link /entry:main /subsystem:console /out:%t.exe %t ; RUN: llvm-objdump -d %t.exe | FileCheck %s Index: lld/trunk/test/COFF/lto.ll =================================================================== --- lld/trunk/test/COFF/lto.ll +++ lld/trunk/test/COFF/lto.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %T/main.lto.obj %s ; RUN: llvm-as -o %T/foo.lto.obj %S/Inputs/lto-dep.ll ; RUN: rm -f %T/foo.lto.lib Index: lld/trunk/test/COFF/pdb-global-gc.yaml =================================================================== --- lld/trunk/test/COFF/pdb-global-gc.yaml +++ lld/trunk/test/COFF/pdb-global-gc.yaml @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: yaml2obj %s -o %t.obj # RUN: llvm-mc %S/Inputs/pdb-global-gc.s -triple x86_64-windows-msvc -filetype=obj -o %t2.obj # RUN: lld-link %t.obj %t2.obj -debug -entry:main \ Index: lld/trunk/test/COFF/reloc-discarded-dwarf.s =================================================================== --- lld/trunk/test/COFF/reloc-discarded-dwarf.s +++ lld/trunk/test/COFF/reloc-discarded-dwarf.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t1.obj %s # RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t2.obj %s Index: lld/trunk/test/COFF/reloc-discarded-early.s =================================================================== --- lld/trunk/test/COFF/reloc-discarded-early.s +++ lld/trunk/test/COFF/reloc-discarded-early.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s # RUN: lld-link -entry:__ImageBase -subsystem:console -debug %t.obj Index: lld/trunk/test/COFF/reloc-discarded-early2.s =================================================================== --- lld/trunk/test/COFF/reloc-discarded-early2.s +++ lld/trunk/test/COFF/reloc-discarded-early2.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s # RUN: not lld-link -entry:__ImageBase -subsystem:console %t.obj 2>&1 | FileCheck %s Index: lld/trunk/test/COFF/reloc-discarded.s =================================================================== --- lld/trunk/test/COFF/reloc-discarded.s +++ lld/trunk/test/COFF/reloc-discarded.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: echo -e '.section .bss,"bw",discard,main_global\n.global main_global\n main_global:\n .long 0' | \ # RUN: llvm-mc - -filetype=obj -o %t1.obj -triple x86_64-windows-msvc # RUN: llvm-mc %s -filetype=obj -o %t2.obj -triple x86_64-windows-msvc Index: lld/trunk/test/COFF/reloc-x64.test =================================================================== --- lld/trunk/test/COFF/reloc-x64.test +++ lld/trunk/test/COFF/reloc-x64.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: yaml2obj < %s > %t.obj # RUN: lld-link /out:%t.exe /entry:main %t.obj # RUN: llvm-objdump -d %t.exe | FileCheck %s Index: lld/trunk/test/COFF/reloc-x86.test =================================================================== --- lld/trunk/test/COFF/reloc-x86.test +++ lld/trunk/test/COFF/reloc-x86.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: yaml2obj < %s > %t.obj # RUN: lld-link /out:%t.exe /entry:main /base:0x400000 %t.obj # RUN: llvm-objdump -d %t.exe | FileCheck %s Index: lld/trunk/test/COFF/safeseh-md.s =================================================================== --- lld/trunk/test/COFF/safeseh-md.s +++ lld/trunk/test/COFF/safeseh-md.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple i686-windows-msvc %s -filetype=obj -o %t.obj # RUN: lld-link %t.obj %S/Inputs/except_handler3.lib -safeseh -out:%t.exe -opt:noref -entry:main # RUN: llvm-readobj -coff-load-config %t.exe | FileCheck %s Index: lld/trunk/test/COFF/safeseh-notable.s =================================================================== --- lld/trunk/test/COFF/safeseh-notable.s +++ lld/trunk/test/COFF/safeseh-notable.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple i686-windows-msvc %s -filetype=obj -o %t.obj # RUN: lld-link %t.obj -safeseh -out:%t.exe -entry:main # RUN: llvm-readobj -file-headers %t.exe | FileCheck %s Index: lld/trunk/test/COFF/safeseh.s =================================================================== --- lld/trunk/test/COFF/safeseh.s +++ lld/trunk/test/COFF/safeseh.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple i686-windows-msvc %s -filetype=obj -o %t.obj # RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:noref -entry:main # RUN: llvm-readobj -coff-basereloc -coff-load-config -file-headers %t.exe | FileCheck %s --check-prefix=CHECK-NOGC Index: lld/trunk/test/COFF/secidx-absolute.s =================================================================== --- lld/trunk/test/COFF/secidx-absolute.s +++ lld/trunk/test/COFF/secidx-absolute.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc %s -filetype=obj -triple=x86_64-windows-msvc -o %t.obj # RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe # RUN: llvm-readobj %t.exe -sections -section-data | FileCheck %s Index: lld/trunk/test/COFF/secrel-absolute.s =================================================================== --- lld/trunk/test/COFF/secrel-absolute.s +++ lld/trunk/test/COFF/secrel-absolute.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc %s -filetype=obj -triple=x86_64-windows-msvc -o %t.obj # RUN: not lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe 2>&1 | FileCheck %s Index: lld/trunk/test/COFF/secrel-common.s =================================================================== --- lld/trunk/test/COFF/secrel-common.s +++ lld/trunk/test/COFF/secrel-common.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc %s -filetype=obj -triple=x86_64-windows-msvc -o %t.obj # RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe # RUN: llvm-readobj %t.exe -sections -section-data | FileCheck %s Index: lld/trunk/test/COFF/undefined-symbol-cv.s =================================================================== --- lld/trunk/test/COFF/undefined-symbol-cv.s +++ lld/trunk/test/COFF/undefined-symbol-cv.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s # RUN: not lld-link /out:%t.exe %t.obj 2>&1 | FileCheck %s Index: lld/trunk/test/COFF/undefined-symbol.s =================================================================== --- lld/trunk/test/COFF/undefined-symbol.s +++ lld/trunk/test/COFF/undefined-symbol.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s # RUN: not lld-link /out:%t.exe %t.obj 2>&1 | FileCheck %s Index: lld/trunk/test/COFF/weak-external.test =================================================================== --- lld/trunk/test/COFF/weak-external.test +++ lld/trunk/test/COFF/weak-external.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: yaml2obj %s > %t.obj # RUN: llvm-as -o %t.lto.obj %S/Inputs/weak-external.ll # RUN: lld-link /out:%t1.exe /entry:g /subsystem:console %t.obj Index: lld/trunk/test/COFF/weak-external2.test =================================================================== --- lld/trunk/test/COFF/weak-external2.test +++ lld/trunk/test/COFF/weak-external2.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: yaml2obj %s > %t.obj # RUN: llvm-as -o %t.lto.obj %S/Inputs/weak-external2.ll # RUN: lld-link /out:%t.exe /entry:g /subsystem:console %t.obj %t.lto.obj Index: lld/trunk/test/COFF/weak-external3.test =================================================================== --- lld/trunk/test/COFF/weak-external3.test +++ lld/trunk/test/COFF/weak-external3.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: yaml2obj %s > %t.obj # RUN: llvm-as -o %t.lto.obj %S/Inputs/weak-external3.ll # RUN: lld-link /out:%t1.exe /entry:f /subsystem:console /lldmap:%t1.map %t.lto.obj Index: lld/trunk/test/COFF/wholearchive.s =================================================================== --- lld/trunk/test/COFF/wholearchive.s +++ lld/trunk/test/COFF/wholearchive.s @@ -1,4 +1,4 @@ -# REQEUIRES: x86 +# REQUIRES: x86 # RUN: yaml2obj < %p/Inputs/export.yaml > %t.archive.obj # RUN: llvm-ar rcs %t.archive.lib %t.archive.obj Index: lld/trunk/test/ELF/bsymbolic-undef.s =================================================================== --- lld/trunk/test/ELF/bsymbolic-undef.s +++ lld/trunk/test/ELF/bsymbolic-undef.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o # RUN: ld.lld -shared -Bsymbolic %t.o -o %t.so # RUN: llvm-readobj -dyn-symbols %t.so | FileCheck %s Index: lld/trunk/test/ELF/bsymbolic.s =================================================================== --- lld/trunk/test/ELF/bsymbolic.s +++ lld/trunk/test/ELF/bsymbolic.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o // RUN: ld.lld -shared %t.o -o %t0.so // RUN: ld.lld -shared -Bsymbolic %t.o -o %t1.so Index: lld/trunk/test/ELF/comdat-linkonce.s =================================================================== --- lld/trunk/test/ELF/comdat-linkonce.s +++ lld/trunk/test/ELF/comdat-linkonce.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/comdat.s -o %t2.o // RUN: ld.lld -shared %t.o %t2.o -o %t Index: lld/trunk/test/ELF/compatible-section-types.s =================================================================== --- lld/trunk/test/ELF/compatible-section-types.s +++ lld/trunk/test/ELF/compatible-section-types.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: ld.lld -shared %t.o -o %t // RUN: llvm-objdump -section-headers %t | FileCheck %s Index: lld/trunk/test/ELF/conflict-debug-variable.s =================================================================== --- lld/trunk/test/ELF/conflict-debug-variable.s +++ lld/trunk/test/ELF/conflict-debug-variable.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o # RUN: llvm-dwarfdump %t.o | FileCheck -check-prefix=INPUT %s # RUN: not ld.lld %t.o %t.o -o %t 2>&1 | FileCheck %s Index: lld/trunk/test/ELF/conflict-debug-variable2.s =================================================================== --- lld/trunk/test/ELF/conflict-debug-variable2.s +++ lld/trunk/test/ELF/conflict-debug-variable2.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o # RUN: llvm-dwarfdump -v %t.o | FileCheck -check-prefix=INPUT %s Index: lld/trunk/test/ELF/conflict-variable-linkage-name.s =================================================================== --- lld/trunk/test/ELF/conflict-variable-linkage-name.s +++ lld/trunk/test/ELF/conflict-variable-linkage-name.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o # RUN: llvm-dwarfdump %t.o | FileCheck -check-prefix=INPUT %s # RUN: not ld.lld %t.o %t.o -o %t 2>&1 | FileCheck %s Index: lld/trunk/test/ELF/copy-rel-corrupted.s =================================================================== --- lld/trunk/test/ELF/copy-rel-corrupted.s +++ lld/trunk/test/ELF/copy-rel-corrupted.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: llvm-mc %p/Inputs/copy-rel-corrupted.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux // RUN: ld.lld %t2.o -o %t2.so -shared Index: lld/trunk/test/ELF/copy-rel-pie-error.s =================================================================== --- lld/trunk/test/ELF/copy-rel-pie-error.s +++ lld/trunk/test/ELF/copy-rel-pie-error.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: llvm-mc %p/Inputs/copy-rel-pie.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux // RUN: ld.lld %t2.o -o %t2.so -shared Index: lld/trunk/test/ELF/copy-rel-pie.s =================================================================== --- lld/trunk/test/ELF/copy-rel-pie.s +++ lld/trunk/test/ELF/copy-rel-pie.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: llvm-mc %p/Inputs/copy-rel-pie.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux // RUN: ld.lld %t2.o -o %t2.so -shared Index: lld/trunk/test/ELF/defined-tls_get_addr.s =================================================================== --- lld/trunk/test/ELF/defined-tls_get_addr.s +++ lld/trunk/test/ELF/defined-tls_get_addr.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -triple x86_64-pc-linux -filetype=obj // RUN: ld.lld %t.o -o %t Index: lld/trunk/test/ELF/dont-export-hidden.s =================================================================== --- lld/trunk/test/ELF/dont-export-hidden.s +++ lld/trunk/test/ELF/dont-export-hidden.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %p/Inputs/shared.s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: llvm-mc %s -o %t2.o -filetype=obj -triple=x86_64-pc-linux // RUN: ld.lld %t.o -o %t.so -shared Index: lld/trunk/test/ELF/duplicated-synthetic-sym.s =================================================================== --- lld/trunk/test/ELF/duplicated-synthetic-sym.s +++ lld/trunk/test/ELF/duplicated-synthetic-sym.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: rm -rf %t.dir // RUN: mkdir %t.dir Index: lld/trunk/test/ELF/dynamic-reloc-index.s =================================================================== --- lld/trunk/test/ELF/dynamic-reloc-index.s +++ lld/trunk/test/ELF/dynamic-reloc-index.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o // RUN: ld.lld -shared %t2.o -o %t2.so Index: lld/trunk/test/ELF/eh-frame-marker.s =================================================================== --- lld/trunk/test/ELF/eh-frame-marker.s +++ lld/trunk/test/ELF/eh-frame-marker.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: ld.lld --eh-frame-hdr %t.o -o %t.so -shared // RUN: llvm-readobj -t -s %t.so | FileCheck %s Index: lld/trunk/test/ELF/eh-frame-multilpe-cie.s =================================================================== --- lld/trunk/test/ELF/eh-frame-multilpe-cie.s +++ lld/trunk/test/ELF/eh-frame-multilpe-cie.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: ld.lld --eh-frame-hdr %t.o -o %t.so -shared // We would fail to parse multiple cies in the same file. Index: lld/trunk/test/ELF/empty-archive.s =================================================================== --- lld/trunk/test/ELF/empty-archive.s +++ lld/trunk/test/ELF/empty-archive.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-ar rc %t.a // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: ld.lld -shared %t.o %t.a -o %t Index: lld/trunk/test/ELF/entry.s =================================================================== --- lld/trunk/test/ELF/entry.s +++ lld/trunk/test/ELF/entry.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 # RUN: ld.lld -e foobar %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN1 %s Index: lld/trunk/test/ELF/filter.s =================================================================== --- lld/trunk/test/ELF/filter.s +++ lld/trunk/test/ELF/filter.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o # RUN: ld.lld %t.o -shared -F foo.so -F boo.so -o %t1 # RUN: llvm-readobj --dynamic-table %t1 | FileCheck %s Index: lld/trunk/test/ELF/gc-debuginfo-tls.s =================================================================== --- lld/trunk/test/ELF/gc-debuginfo-tls.s +++ lld/trunk/test/ELF/gc-debuginfo-tls.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o # RUN: ld.lld %t.o --gc-sections -shared -o %t1 # RUN: ld.lld %t.o -shared -o %t2 Index: lld/trunk/test/ELF/gc-merge-local-sym.s =================================================================== --- lld/trunk/test/ELF/gc-merge-local-sym.s +++ lld/trunk/test/ELF/gc-merge-local-sym.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: ld.lld %t.o -o %t.so -shared -O3 --gc-sections // RUN: llvm-readobj -s -section-data -t %t.so | FileCheck %s Index: lld/trunk/test/ELF/gc-sections-merge-addend.s =================================================================== --- lld/trunk/test/ELF/gc-sections-merge-addend.s +++ lld/trunk/test/ELF/gc-sections-merge-addend.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: ld.lld %t.o -o %t.so -shared --gc-sections // RUN: llvm-readobj -s -section-data %t.so | FileCheck %s Index: lld/trunk/test/ELF/gc-sections-merge-implicit-addend.s =================================================================== --- lld/trunk/test/ELF/gc-sections-merge-implicit-addend.s +++ lld/trunk/test/ELF/gc-sections-merge-implicit-addend.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=i386-pc-linux // RUN: ld.lld %t.o -o %t.so -shared --gc-sections // RUN: llvm-readobj -s -section-data %t.so | FileCheck %s Index: lld/trunk/test/ELF/gc-sections-merge.s =================================================================== --- lld/trunk/test/ELF/gc-sections-merge.s +++ lld/trunk/test/ELF/gc-sections-merge.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: ld.lld %t.o -o %t.so -shared // RUN: ld.lld %t.o -o %t.gc.so -shared --gc-sections Index: lld/trunk/test/ELF/gc-sections-protected.s =================================================================== --- lld/trunk/test/ELF/gc-sections-protected.s +++ lld/trunk/test/ELF/gc-sections-protected.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: ld.lld %t.o -o %t.so -shared --gc-sections // RUN: llvm-readobj -s %t.so | FileCheck %s Index: lld/trunk/test/ELF/global_offset_table.s =================================================================== --- lld/trunk/test/ELF/global_offset_table.s +++ lld/trunk/test/ELF/global_offset_table.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t // RUN: ld.lld %t -o %t2 .global _start Index: lld/trunk/test/ELF/global_offset_table_shared.s =================================================================== --- lld/trunk/test/ELF/global_offset_table_shared.s +++ lld/trunk/test/ELF/global_offset_table_shared.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t // RUN: ld.lld --hash-style=sysv -shared %t -o %t2 // RUN: llvm-readobj -t %t2 | FileCheck %s Index: lld/trunk/test/ELF/got-plt-header.s =================================================================== --- lld/trunk/test/ELF/got-plt-header.s +++ lld/trunk/test/ELF/got-plt-header.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: ld.lld %t.o -o %t.so -shared // RUN: llvm-readobj -s -section-data %t.so | FileCheck %s Index: lld/trunk/test/ELF/gotpcrelx.s =================================================================== --- lld/trunk/test/ELF/gotpcrelx.s +++ lld/trunk/test/ELF/gotpcrelx.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -relax-relocations -triple x86_64-pc-linux-gnu \ // RUN: %s -o %t.o // RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=RELS %s Index: lld/trunk/test/ELF/i386-got-value.s =================================================================== --- lld/trunk/test/ELF/i386-got-value.s +++ lld/trunk/test/ELF/i386-got-value.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc %s -o %t.o -filetype=obj -triple=i386-pc-linux # RUN: ld.lld %t.o -o %t.so -shared # RUN: llvm-readobj --relocations --sections --section-data %t.so | FileCheck %s Index: lld/trunk/test/ELF/i386-tls-ie-shared.s =================================================================== --- lld/trunk/test/ELF/i386-tls-ie-shared.s +++ lld/trunk/test/ELF/i386-tls-ie-shared.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %p/Inputs/tls-opt-iele-i686-nopic.s -o %tso.o // RUN: ld.lld -shared %tso.o -o %tso Index: lld/trunk/test/ELF/incompatible-section-flags.s =================================================================== --- lld/trunk/test/ELF/incompatible-section-flags.s +++ lld/trunk/test/ELF/incompatible-section-flags.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: not ld.lld -shared %t.o -o %t 2>&1 | FileCheck %s Index: lld/trunk/test/ELF/incompatible-section-types2.s =================================================================== --- lld/trunk/test/ELF/incompatible-section-types2.s +++ lld/trunk/test/ELF/incompatible-section-types2.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s Index: lld/trunk/test/ELF/invalid/invalid-elf.test =================================================================== --- lld/trunk/test/ELF/invalid/invalid-elf.test +++ lld/trunk/test/ELF/invalid/invalid-elf.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc %s -o %t -filetype=obj -triple x86_64-pc-linux # RUN: not ld.lld %t %p/Inputs/data-encoding.a -o %t2 2>&1 | \ Index: lld/trunk/test/ELF/linkerscript/discard-interp.test =================================================================== --- lld/trunk/test/ELF/linkerscript/discard-interp.test +++ lld/trunk/test/ELF/linkerscript/discard-interp.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux /dev/null -o %t.o # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/../Inputs/shared.s -o %t2.o # RUN: ld.lld -shared %t2.o -o %t2.so Index: lld/trunk/test/ELF/linkerscript/openbsd-bootdata.test =================================================================== --- lld/trunk/test/ELF/linkerscript/openbsd-bootdata.test +++ lld/trunk/test/ELF/linkerscript/openbsd-bootdata.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux /dev/null -o %t.o # RUN: ld.lld --script %s %t.o -o %t # RUN: llvm-readobj --program-headers -s %t | FileCheck %s Index: lld/trunk/test/ELF/linkerscript/openbsd-randomize.s =================================================================== --- lld/trunk/test/ELF/linkerscript/openbsd-randomize.s +++ lld/trunk/test/ELF/linkerscript/openbsd-randomize.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t.o # RUN: echo "PHDRS { text PT_LOAD FILEHDR PHDRS; rand PT_OPENBSD_RANDOMIZE; } \ # RUN: SECTIONS { . = SIZEOF_HEADERS; \ Index: lld/trunk/test/ELF/linkerscript/openbsd-wxneeded.test =================================================================== --- lld/trunk/test/ELF/linkerscript/openbsd-wxneeded.test +++ lld/trunk/test/ELF/linkerscript/openbsd-wxneeded.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux /dev/null -o %t.o # RUN: ld.lld -z wxneeded --script %s %t.o -o %t # RUN: llvm-readobj --program-headers %t | FileCheck %s Index: lld/trunk/test/ELF/local-got-pie.s =================================================================== --- lld/trunk/test/ELF/local-got-pie.s +++ lld/trunk/test/ELF/local-got-pie.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o // RUN: ld.lld --hash-style=sysv %t.o -o %t -pie // RUN: llvm-readobj -s -r -d %t | FileCheck %s Index: lld/trunk/test/ELF/local-got-shared.s =================================================================== --- lld/trunk/test/ELF/local-got-shared.s +++ lld/trunk/test/ELF/local-got-shared.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o // RUN: ld.lld --hash-style=sysv %t.o -o %t -shared // RUN: llvm-readobj -s -r -d %t | FileCheck %s Index: lld/trunk/test/ELF/local-got.s =================================================================== --- lld/trunk/test/ELF/local-got.s +++ lld/trunk/test/ELF/local-got.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o // RUN: ld.lld -shared %t2.o -o %t2.so Index: lld/trunk/test/ELF/map-gc-sections.s =================================================================== --- lld/trunk/test/ELF/map-gc-sections.s +++ lld/trunk/test/ELF/map-gc-sections.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: ld.lld %t.o -o %t -Map=- --gc-sections | FileCheck %s Index: lld/trunk/test/ELF/pr34872.s =================================================================== --- lld/trunk/test/ELF/pr34872.s +++ lld/trunk/test/ELF/pr34872.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc %s -filetype=obj -triple=x86_64-pc-linux -o %t.o # RUN: llvm-mc %p/Inputs/undefined-error.s -filetype=obj \ # RUN: -triple=x86_64-pc-linux -o %t2.o Index: lld/trunk/test/ELF/pr36475.s =================================================================== --- lld/trunk/test/ELF/pr36475.s +++ lld/trunk/test/ELF/pr36475.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o # RUN: echo "PHDRS {" > %t.script # RUN: echo " ph_text PT_LOAD FLAGS (0x1 | 0x4);" >> %t.script Index: lld/trunk/test/ELF/relocation-size-shared.s =================================================================== --- lld/trunk/test/ELF/relocation-size-shared.s +++ lld/trunk/test/ELF/relocation-size-shared.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/relocation-size-shared.s -o %tso.o // RUN: ld.lld -shared %tso.o -o %tso Index: lld/trunk/test/ELF/relocation-size.s =================================================================== --- lld/trunk/test/ELF/relocation-size.s +++ lld/trunk/test/ELF/relocation-size.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o // RUN: ld.lld %t.o -o %t1 // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s Index: lld/trunk/test/ELF/relro-omagic.s =================================================================== --- lld/trunk/test/ELF/relro-omagic.s +++ lld/trunk/test/ELF/relro-omagic.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o # RUN: ld.lld -shared %t2.o -o %t2.so -soname relro-omagic.s.tmp2.so Index: lld/trunk/test/ELF/rodynamic.s =================================================================== --- lld/trunk/test/ELF/rodynamic.s +++ lld/trunk/test/ELF/rodynamic.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux # RUN: llvm-mc %p/Inputs/rodynamic.s -o %t.so.o -filetype=obj -triple=x86_64-pc-linux Index: lld/trunk/test/ELF/section-symbol.s =================================================================== --- lld/trunk/test/ELF/section-symbol.s +++ lld/trunk/test/ELF/section-symbol.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t // RUN: ld.lld %t -o %t.so -shared -discard-none // RUN: llvm-readobj -t %t.so | FileCheck %s Index: lld/trunk/test/ELF/shared-lazy.s =================================================================== --- lld/trunk/test/ELF/shared-lazy.s +++ lld/trunk/test/ELF/shared-lazy.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o // RUN: rm -f %t1.a // RUN: llvm-ar rc %t1.a %t1.o Index: lld/trunk/test/ELF/sht-group-gold-r.test =================================================================== --- lld/trunk/test/ELF/sht-group-gold-r.test +++ lld/trunk/test/ELF/sht-group-gold-r.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # GNU gold 1.14 (the newest version as of July 2017) seems to create # non-standard-compliant SHT_GROUP sections when the -r option is given. # Index: lld/trunk/test/ELF/soname.s =================================================================== --- lld/trunk/test/ELF/soname.s +++ lld/trunk/test/ELF/soname.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: ld.lld %t.o -shared -soname=bar -o %t.so // RUN: ld.lld %t.o -shared --soname=bar -o %t2.so Index: lld/trunk/test/ELF/soname2.s =================================================================== --- lld/trunk/test/ELF/soname2.s +++ lld/trunk/test/ELF/soname2.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: ld.lld %t.o -shared -soname=foo.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s Index: lld/trunk/test/ELF/string-gc.s =================================================================== --- lld/trunk/test/ELF/string-gc.s +++ lld/trunk/test/ELF/string-gc.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: ld.lld %t.o -o %t --gc-sections // RUN: llvm-readobj -symbols %t | FileCheck %s Index: lld/trunk/test/ELF/symbol-override.s =================================================================== --- lld/trunk/test/ELF/symbol-override.s +++ lld/trunk/test/ELF/symbol-override.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/symbol-override.s -o %t2.o // RUN: ld.lld -shared %t2.o -o %t2.so Index: lld/trunk/test/ELF/text-section-prefix.s =================================================================== --- lld/trunk/test/ELF/text-section-prefix.s +++ lld/trunk/test/ELF/text-section-prefix.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t # RUN: ld.lld -z keep-text-section-prefix %t -o %t2 # RUN: llvm-readelf -l %t2 | FileCheck %s Index: lld/trunk/test/ELF/tls-got.s =================================================================== --- lld/trunk/test/ELF/tls-got.s +++ lld/trunk/test/ELF/tls-got.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/tls-got.s -o %t2.o // RUN: ld.lld -shared %t2.o -o %t2.so Index: lld/trunk/test/ELF/tls-opt-gdie.s =================================================================== --- lld/trunk/test/ELF/tls-opt-gdie.s +++ lld/trunk/test/ELF/tls-opt-gdie.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/tls-opt-gdie.s -o %tso.o // RUN: ld.lld -shared %tso.o -o %t.so Index: lld/trunk/test/ELF/tls-opt-gdiele-i686.s =================================================================== --- lld/trunk/test/ELF/tls-opt-gdiele-i686.s +++ lld/trunk/test/ELF/tls-opt-gdiele-i686.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %p/Inputs/tls-opt-gdiele-i686.s -o %tso.o // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o // RUN: ld.lld -shared %tso.o -o %tso Index: lld/trunk/test/ELF/tls-opt-i686.s =================================================================== --- lld/trunk/test/ELF/tls-opt-i686.s +++ lld/trunk/test/ELF/tls-opt-i686.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o // RUN: ld.lld %t.o -o %t1 // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s Index: lld/trunk/test/ELF/tls-opt-iele-i686-nopic.s =================================================================== --- lld/trunk/test/ELF/tls-opt-iele-i686-nopic.s +++ lld/trunk/test/ELF/tls-opt-iele-i686-nopic.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %p/Inputs/tls-opt-iele-i686-nopic.s -o %tso.o // RUN: ld.lld -shared %tso.o -o %tso Index: lld/trunk/test/ELF/tls-opt-local.s =================================================================== --- lld/trunk/test/ELF/tls-opt-local.s +++ lld/trunk/test/ELF/tls-opt-local.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o // RUN: ld.lld %t.o -o %t1 // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s Index: lld/trunk/test/ELF/tls-opt-no-plt.s =================================================================== --- lld/trunk/test/ELF/tls-opt-no-plt.s +++ lld/trunk/test/ELF/tls-opt-no-plt.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/tls-opt-gdie.s -o %t2.o // RUN: ld.lld %t2.o -o %t2.so -shared Index: lld/trunk/test/ELF/tls-opt.s =================================================================== --- lld/trunk/test/ELF/tls-opt.s +++ lld/trunk/test/ELF/tls-opt.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o // RUN: ld.lld %t.o -o %t1 // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s Index: lld/trunk/test/ELF/trace-symbols.s =================================================================== --- lld/trunk/test/ELF/trace-symbols.s +++ lld/trunk/test/ELF/trace-symbols.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # Test -y symbol and -trace-symbol=symbol # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t Index: lld/trunk/test/ELF/undef-shared.s =================================================================== --- lld/trunk/test/ELF/undef-shared.s +++ lld/trunk/test/ELF/undef-shared.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o # RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s Index: lld/trunk/test/ELF/undef-shared2.s =================================================================== --- lld/trunk/test/ELF/undef-shared2.s +++ lld/trunk/test/ELF/undef-shared2.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef-shared2.s -o %t2.o # RUN: not ld.lld %t.o %t2.o -o %t.so -shared 2>&1 | FileCheck %s Index: lld/trunk/test/ELF/undef-version-script.s =================================================================== --- lld/trunk/test/ELF/undef-version-script.s +++ lld/trunk/test/ELF/undef-version-script.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o # RUN: echo "{ local: *; };" > %t.script # RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so Index: lld/trunk/test/ELF/user_def_init_array_start.s =================================================================== --- lld/trunk/test/ELF/user_def_init_array_start.s +++ lld/trunk/test/ELF/user_def_init_array_start.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: ld.lld %t.o -o %t2.so -shared // Allow user defined __init_array_start. This is used by musl because of the Index: lld/trunk/test/ELF/version-script-no-warn2.s =================================================================== --- lld/trunk/test/ELF/version-script-no-warn2.s +++ lld/trunk/test/ELF/version-script-no-warn2.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/version-script-no-warn2.s -o %t1.o # RUN: ld.lld %t1.o -o %t1.so -shared # RUN: echo "{ global: foo; local: *; };" > %t.script Index: lld/trunk/test/ELF/x86-64-reloc-range.s =================================================================== --- lld/trunk/test/ELF/x86-64-reloc-range.s +++ lld/trunk/test/ELF/x86-64-reloc-range.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -triple x86_64-pc-linux -filetype=obj // RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s Index: lld/trunk/test/ELF/zdefs.s =================================================================== --- lld/trunk/test/ELF/zdefs.s +++ lld/trunk/test/ELF/zdefs.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o # RUN: ld.lld -shared %t.o -o %t1.so