diff options
Diffstat (limited to 'test')
97 files changed, 1317 insertions, 98 deletions
diff --git a/test/COFF/Inputs/default.def b/test/COFF/Inputs/default.def new file mode 100644 index 0000000000000..1d59beebbb264 --- /dev/null +++ b/test/COFF/Inputs/default.def @@ -0,0 +1,2 @@ +EXPORTS + f diff --git a/test/COFF/Inputs/extension.def b/test/COFF/Inputs/extension.def new file mode 100644 index 0000000000000..d93f0dc1ecced --- /dev/null +++ b/test/COFF/Inputs/extension.def @@ -0,0 +1,3 @@ +LIBRARY library.ext +EXPORTS + f diff --git a/test/COFF/Inputs/named.def b/test/COFF/Inputs/named.def new file mode 100644 index 0000000000000..07c8622189dbb --- /dev/null +++ b/test/COFF/Inputs/named.def @@ -0,0 +1,3 @@ +LIBRARY library +EXPORTS + f diff --git a/test/COFF/Inputs/object.s b/test/COFF/Inputs/object.s new file mode 100644 index 0000000000000..b70599385591d --- /dev/null +++ b/test/COFF/Inputs/object.s @@ -0,0 +1,13 @@ + + .text + + .def f + .scl 2 + .type 32 + .endef + .global f +f: + retq $0 + + .section .drectve,"rd" + .ascii " /EXPORT:f" diff --git a/test/COFF/Inputs/pdb-type-server-simple-a.yaml b/test/COFF/Inputs/pdb-type-server-simple-a.yaml new file mode 100644 index 0000000000000..78c68168127b7 --- /dev/null +++ b/test/COFF/Inputs/pdb-type-server-simple-a.yaml @@ -0,0 +1,255 @@ +--- !COFF +header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [ ] +sections: + - Name: .drectve + Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] + Alignment: 1 + SectionData: 2020202F44454641554C544C49423A224C4942434D5422202F44454641554C544C49423A224F4C444E414D45532220 + - Name: '.debug$S' + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] + Alignment: 1 + Subsections: + - !Symbols + Records: + - Kind: S_OBJNAME + ObjNameSym: + Signature: 0 + ObjectName: 'C:\src\llvm-project\build\a.obj' + - Kind: S_COMPILE3 + Compile3Sym: + Flags: [ SecurityChecks, HotPatch ] + Machine: X64 + FrontendMajor: 19 + FrontendMinor: 0 + FrontendBuild: 24215 + FrontendQFE: 1 + BackendMajor: 19 + BackendMinor: 0 + BackendBuild: 24215 + BackendQFE: 1 + Version: 'Microsoft (R) Optimizing Compiler' + - !Symbols + Records: + - Kind: S_GPROC32_ID + ProcSym: + CodeSize: 27 + DbgStart: 4 + DbgEnd: 22 + FunctionType: 4098 + Flags: [ ] + DisplayName: main + - Kind: S_FRAMEPROC + FrameProcSym: + TotalFrameBytes: 56 + PaddingFrameBytes: 0 + OffsetToPadding: 0 + BytesOfCalleeSavedRegisters: 0 + OffsetOfExceptionHandler: 0 + SectionIdOfExceptionHandler: 0 + Flags: [ AsynchronousExceptionHandling, OptimizedForSpeed ] + - Kind: S_REGREL32 + RegRelativeSym: + Offset: 32 + Type: 4102 + Register: RSP + VarName: f + - Kind: S_PROC_ID_END + ScopeEndSym: + - !Lines + CodeSize: 27 + Flags: [ ] + RelocOffset: 0 + RelocSegment: 0 + Blocks: + - FileName: 'c:\src\llvm-project\build\a.c' + Lines: + - Offset: 0 + LineStart: 3 + IsStatement: true + EndDelta: 0 + - Offset: 4 + LineStart: 4 + IsStatement: true + EndDelta: 0 + - Offset: 12 + LineStart: 5 + IsStatement: true + EndDelta: 0 + - Offset: 22 + LineStart: 6 + IsStatement: true + EndDelta: 0 + Columns: + - !Symbols + Records: + - Kind: S_UDT + UDTSym: + Type: 4102 + UDTName: Foo + - !FileChecksums + Checksums: + - FileName: 'c:\src\llvm-project\build\a.c' + Kind: MD5 + Checksum: BF69E7E933074E1B7ED1FE8FB395965B + - !StringTable + Strings: + - 'c:\src\llvm-project\build\a.c' + - !Symbols + Records: + - Kind: S_BUILDINFO + BuildInfoSym: + BuildId: 4107 + Relocations: + - VirtualAddress: 152 + SymbolName: main + Type: IMAGE_REL_AMD64_SECREL + - VirtualAddress: 156 + SymbolName: main + Type: IMAGE_REL_AMD64_SECTION + - VirtualAddress: 224 + SymbolName: main + Type: IMAGE_REL_AMD64_SECREL + - VirtualAddress: 228 + SymbolName: main + Type: IMAGE_REL_AMD64_SECTION + - Name: '.debug$T' + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] + Alignment: 1 + Types: + - Kind: LF_TYPESERVER2 + TypeServer2: + Guid: '{41414141-4141-4141-4141-414141414141}' + Age: 1 + Name: 'C:\src\llvm-project\build\ts.pdb' + - Name: '.text$mn' + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: 4883EC38C74424202A000000488D4C2420E8000000004883C438C3 + Relocations: + - VirtualAddress: 18 + SymbolName: g + Type: IMAGE_REL_AMD64_REL32 + - Name: .xdata + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] + Alignment: 4 + SectionData: '0104010004620000' + - Name: .pdata + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] + Alignment: 4 + SectionData: 000000001B00000000000000 + Relocations: + - VirtualAddress: 0 + SymbolName: '$LN3' + Type: IMAGE_REL_AMD64_ADDR32NB + - VirtualAddress: 4 + SymbolName: '$LN3' + Type: IMAGE_REL_AMD64_ADDR32NB + - VirtualAddress: 8 + SymbolName: '$unwind$main' + Type: IMAGE_REL_AMD64_ADDR32NB +symbols: + - Name: .drectve + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 47 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.debug$S' + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 388 + NumberOfRelocations: 4 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.debug$T' + Value: 0 + SectionNumber: 3 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 64 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.text$mn' + Value: 0 + SectionNumber: 4 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 27 + NumberOfRelocations: 1 + NumberOfLinenumbers: 0 + CheckSum: 1939996292 + Number: 0 + - Name: g + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: main + Value: 0 + SectionNumber: 4 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: '$LN3' + Value: 0 + SectionNumber: 4 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_LABEL + - Name: .xdata + Value: 0 + SectionNumber: 5 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 8 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 931692337 + Number: 0 + - Name: '$unwind$main' + Value: 0 + SectionNumber: 5 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + - Name: .pdata + Value: 0 + SectionNumber: 6 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 12 + NumberOfRelocations: 3 + NumberOfLinenumbers: 0 + CheckSum: 567356797 + Number: 0 + - Name: '$pdata$main' + Value: 0 + SectionNumber: 6 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC +... diff --git a/test/COFF/Inputs/pdb-type-server-simple-b.yaml b/test/COFF/Inputs/pdb-type-server-simple-b.yaml new file mode 100644 index 0000000000000..56e97d5308941 --- /dev/null +++ b/test/COFF/Inputs/pdb-type-server-simple-b.yaml @@ -0,0 +1,173 @@ +--- !COFF +header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [ ] +sections: + - Name: .drectve + Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] + Alignment: 1 + SectionData: 2020202F44454641554C544C49423A224C4942434D5422202F44454641554C544C49423A224F4C444E414D45532220 + - Name: '.debug$S' + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] + Alignment: 1 + Subsections: + - !Symbols + Records: + - Kind: S_OBJNAME + ObjNameSym: + Signature: 0 + ObjectName: 'C:\src\llvm-project\build\b.obj' + - Kind: S_COMPILE3 + Compile3Sym: + Flags: [ SecurityChecks, HotPatch ] + Machine: X64 + FrontendMajor: 19 + FrontendMinor: 0 + FrontendBuild: 24215 + FrontendQFE: 1 + BackendMajor: 19 + BackendMinor: 0 + BackendBuild: 24215 + BackendQFE: 1 + Version: 'Microsoft (R) Optimizing Compiler' + - !Symbols + Records: + - Kind: S_GPROC32_ID + ProcSym: + CodeSize: 13 + DbgStart: 5 + DbgEnd: 12 + FunctionType: 4099 + Flags: [ ] + DisplayName: g + - Kind: S_FRAMEPROC + FrameProcSym: + TotalFrameBytes: 0 + PaddingFrameBytes: 0 + OffsetToPadding: 0 + BytesOfCalleeSavedRegisters: 0 + OffsetOfExceptionHandler: 0 + SectionIdOfExceptionHandler: 0 + Flags: [ AsynchronousExceptionHandling, OptimizedForSpeed ] + - Kind: S_REGREL32 + RegRelativeSym: + Offset: 8 + Type: 4097 + Register: RSP + VarName: p + - Kind: S_PROC_ID_END + ScopeEndSym: + - !Lines + CodeSize: 13 + Flags: [ ] + RelocOffset: 0 + RelocSegment: 0 + Blocks: + - FileName: 'c:\src\llvm-project\build\b.c' + Lines: + - Offset: 0 + LineStart: 2 + IsStatement: true + EndDelta: 0 + Columns: + - !Symbols + Records: + - Kind: S_UDT + UDTSym: + Type: 4102 + UDTName: Foo + - !FileChecksums + Checksums: + - FileName: 'c:\src\llvm-project\build\b.c' + Kind: MD5 + Checksum: DDF8FD35CD67990C5D4147516BE10D0C + - !StringTable + Strings: + - 'c:\src\llvm-project\build\b.c' + - !Symbols + Records: + - Kind: S_BUILDINFO + BuildInfoSym: + BuildId: 4111 + Relocations: + - VirtualAddress: 152 + SymbolName: g + Type: IMAGE_REL_AMD64_SECREL + - VirtualAddress: 156 + SymbolName: g + Type: IMAGE_REL_AMD64_SECTION + - VirtualAddress: 220 + SymbolName: g + Type: IMAGE_REL_AMD64_SECREL + - VirtualAddress: 224 + SymbolName: g + Type: IMAGE_REL_AMD64_SECTION + - Name: '.debug$T' + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] + Alignment: 1 + Types: + - Kind: LF_TYPESERVER2 + TypeServer2: + Guid: '{41414141-4141-4141-4141-414141414141}' + Age: 1 + Name: 'C:\src\llvm-project\build\ts.pdb' + - Name: '.text$mn' + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: 48894C2408488B4424088B00C3 +symbols: + - Name: .drectve + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 47 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.debug$S' + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 360 + NumberOfRelocations: 4 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.debug$T' + Value: 0 + SectionNumber: 3 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 64 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.text$mn' + Value: 0 + SectionNumber: 4 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 13 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 3246683207 + Number: 0 + - Name: g + Value: 0 + SectionNumber: 4 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL +... diff --git a/test/COFF/Inputs/pdb-type-server-simple-ts.yaml b/test/COFF/Inputs/pdb-type-server-simple-ts.yaml new file mode 100644 index 0000000000000..73496571ac724 --- /dev/null +++ b/test/COFF/Inputs/pdb-type-server-simple-ts.yaml @@ -0,0 +1,147 @@ +--- +MSF: + SuperBlock: + BlockSize: 4096 + FreeBlockMap: 1 + NumBlocks: 19 + NumDirectoryBytes: 64 + Unknown1: 0 + BlockMapAddr: 17 + NumDirectoryBlocks: 1 + DirectoryBlocks: [ 16 ] + NumStreams: 0 + FileSize: 77824 +PdbStream: + Age: 1 + Guid: '{41414141-4141-4141-4141-414141414141}' + Signature: 1500053944 + Features: [ VC140 ] + Version: VC70 +TpiStream: + Version: VC80 + Records: + - Kind: LF_STRUCTURE + Class: + MemberCount: 0 + Options: [ None, ForwardReference, HasUniqueName ] + FieldList: 0 + Name: Foo + UniqueName: '.?AUFoo@@' + DerivationList: 0 + VTableShape: 0 + Size: 0 + - Kind: LF_POINTER + Pointer: + ReferentType: 4096 + Attrs: 65548 + - Kind: LF_ARGLIST + ArgList: + ArgIndices: [ 4097 ] + - Kind: LF_PROCEDURE + Procedure: + ReturnType: 116 + CallConv: NearC + Options: [ None ] + ParameterCount: 1 + ArgumentList: 4098 + - Kind: LF_POINTER + Pointer: + ReferentType: 4099 + Attrs: 65548 + - Kind: LF_FIELDLIST + FieldList: + - Kind: LF_MEMBER + DataMember: + Attrs: 3 + Type: 116 + FieldOffset: 0 + Name: x + - Kind: LF_STRUCTURE + Class: + MemberCount: 1 + Options: [ None, HasUniqueName ] + FieldList: 4101 + Name: Foo + UniqueName: '.?AUFoo@@' + DerivationList: 0 + VTableShape: 0 + Size: 4 + - Kind: LF_ARGLIST + ArgList: + ArgIndices: [ 0 ] + - Kind: LF_PROCEDURE + Procedure: + ReturnType: 116 + CallConv: NearC + Options: [ None ] + ParameterCount: 0 + ArgumentList: 4103 +IpiStream: + Version: VC80 + Records: + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'c:\src\llvm-project\build\a.c' + - Kind: LF_UDT_SRC_LINE + UdtSourceLine: + UDT: 4102 + SourceFile: 4096 + LineNumber: 1 + - Kind: LF_FUNC_ID + FuncId: + ParentScope: 0 + FunctionType: 4104 + Name: main + - Kind: LF_FUNC_ID + FuncId: + ParentScope: 0 + FunctionType: 4099 + Name: g + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'C:\src\llvm-project\build' + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'C:\PROGRA~2\MICROS~1.0\VC\Bin\amd64\cl.exe' + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: '-c -Zi -MT -IC:\PROGRA~2\MICROS~1.0\VC\include -IC:\PROGRA~2\MICROS~1.0\VC\atlmfc\include -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\ucrt -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\shared -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\um' + - Kind: LF_SUBSTR_LIST + StringList: + StringIndices: [ 4102 ] + - Kind: LF_STRING_ID + StringId: + Id: 4103 + String: ' -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\winrt -TC -X' + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: a.c + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'C:\src\llvm-project\build\ts.pdb' + - Kind: LF_BUILDINFO + BuildInfo: + ArgIndices: [ 4100, 4101, 4105, 4106, 4104 ] + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'c:\src\llvm-project\build\b.c' + - Kind: LF_UDT_SRC_LINE + UdtSourceLine: + UDT: 4102 + SourceFile: 4108 + LineNumber: 1 + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: b.c + - Kind: LF_BUILDINFO + BuildInfo: + ArgIndices: [ 4100, 4101, 4110, 4106, 4104 ] +... diff --git a/test/COFF/common.test b/test/COFF/common.test index 007cfcfb6f928..4a00153f3e936 100644 --- a/test/COFF/common.test +++ b/test/COFF/common.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: yaml2obj %s > %t.obj # RUN: lld-link /out:%t.exe /entry:main %t.obj %t.obj # RUN: llvm-objdump -d %t.exe | FileCheck %s diff --git a/test/COFF/conflict.test b/test/COFF/conflict.test index a634c7185675b..ae8e6c8ad3278 100644 --- a/test/COFF/conflict.test +++ b/test/COFF/conflict.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: yaml2obj < %s > %t1.obj # RUN: yaml2obj < %s > %t2.obj # RUN: not lld-link /out:%t.exe %t1.obj %t2.obj >& %t.log diff --git a/test/COFF/constant.test b/test/COFF/constant.test index 3c8956beac9cd..02d6b3e2ccae7 100644 --- a/test/COFF/constant.test +++ b/test/COFF/constant.test @@ -1,3 +1,4 @@ +REQUIRES: x86 RUN: mkdir -p %t RUN: llvm-mc -triple i686-unknown-windows-msvc -filetype obj -o %t/import.o %S/Inputs/constant-import.s RUN: llc -mtriple i686-unknown-windows-msvc -filetype obj -o %t/export.o %S/Inputs/constant-export.ll diff --git a/test/COFF/def-export-stdcall.s b/test/COFF/def-export-stdcall.s index cdca7ae76acfd..d7700d9e95350 100644 --- a/test/COFF/def-export-stdcall.s +++ b/test/COFF/def-export-stdcall.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=i686-windows-msvc %s -o %t.obj # RUN: echo -e "LIBRARY foo\nEXPORTS\n stdcall" > %t.def # RUN: lld-link -entry:dllmain -dll -def:%t.def %t.obj -out:%t.dll -implib:%t.lib diff --git a/test/COFF/delayimports32.test b/test/COFF/delayimports32.test index 9c4fcae5b6a59..53aadbb6a1852 100644 --- a/test/COFF/delayimports32.test +++ b/test/COFF/delayimports32.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: yaml2obj < %p/Inputs/hello32.yaml > %t.obj # RUN: lld-link %t.obj %p/Inputs/std32.lib /subsystem:console \ # RUN: /entry:main@0 /alternatename:___delayLoadHelper2@8=_main@0 \ diff --git a/test/COFF/entry-mangled.test b/test/COFF/entry-mangled.test index acf54ba079735..1140e8298fbc9 100644 --- a/test/COFF/entry-mangled.test +++ b/test/COFF/entry-mangled.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: yaml2obj < %s > %t.obj # RUN: lld-link /out:%t.exe /entry:main %t.obj # RUN: llvm-as -o %t.lto.obj %S/Inputs/entry-mangled.ll diff --git a/test/COFF/entrylib.ll b/test/COFF/entrylib.ll index 4ffa42c44a3e8..602b4ff63336d 100644 --- a/test/COFF/entrylib.ll +++ b/test/COFF/entrylib.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %t.obj %s ; RUN: rm -f %t.lib ; RUN: llvm-ar cru %t.lib %t.obj diff --git a/test/COFF/implib-name.test b/test/COFF/implib-name.test new file mode 100644 index 0000000000000..81b5b258483f4 --- /dev/null +++ b/test/COFF/implib-name.test @@ -0,0 +1,71 @@ +# 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 + diff --git a/test/COFF/imports.test b/test/COFF/imports.test index 584c24eb1b76e..326bfbebbb05e 100644 --- a/test/COFF/imports.test +++ b/test/COFF/imports.test @@ -1,3 +1,4 @@ +# REQUIRES: x86 # Verify that the lld can handle .lib files and emit .idata sections. # # RUN: lld-link /out:%t.exe /entry:main /subsystem:console \ diff --git a/test/COFF/include-lto.ll b/test/COFF/include-lto.ll index 6ca32fa71ad15..d5ae546ab7190 100644 --- a/test/COFF/include-lto.ll +++ b/test/COFF/include-lto.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %t.obj %s ; RUN: lld-link /dll /out:%t.dll %t.obj ; RUN: llvm-objdump -d %t.dll | FileCheck %s diff --git a/test/COFF/msvclto-archive.ll b/test/COFF/msvclto-archive.ll index 047b19e76ddfa..334565a1bef71 100644 --- a/test/COFF/msvclto-archive.ll +++ b/test/COFF/msvclto-archive.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ;; Make sure we re-create archive files to strip bitcode files. ;; Do not create empty archives because the MSVC linker diff --git a/test/COFF/msvclto-order.ll b/test/COFF/msvclto-order.ll index 8991dce4a8d55..6f569af4af0c4 100644 --- a/test/COFF/msvclto-order.ll +++ b/test/COFF/msvclto-order.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: opt -thinlto-bc %s -o %t.obj ; RUN: llc -filetype=obj %S/Inputs/msvclto-order-a.ll -o %T/msvclto-order-a.obj ; RUN: llvm-ar crs %T/msvclto-order-a.lib %T/msvclto-order-a.obj diff --git a/test/COFF/msvclto.ll b/test/COFF/msvclto.ll index 7fa9c54711b4e..66fabeb80c740 100644 --- a/test/COFF/msvclto.ll +++ b/test/COFF/msvclto.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %t.obj %s ; RUN: mkdir -p %t.dir ; RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %t.dir/bitcode.obj %p/Inputs/msvclto.s diff --git a/test/COFF/pdb-comdat.test b/test/COFF/pdb-comdat.test index ea691aec87adc..f85dacdbf4bb5 100644 --- a/test/COFF/pdb-comdat.test +++ b/test/COFF/pdb-comdat.test @@ -56,7 +56,7 @@ CHECK: flags = has async eh | opt speed CHECK: 196 | S_END [size = 4] CHECK: 200 | S_GDATA32 [size = 24] `global` CHECK: type = 0x0074 (int), addr = 0000:0000 -CHECK: 224 | S_BUILDINFO [size = 8] BuildId = `4106` +CHECK: 224 | S_BUILDINFO [size = 8] BuildId = `0x100A` CHECK: 232 | S_GPROC32_ID [size = 44] `foo` CHECK: parent = 0, end = 308, addr = 0002:0032, code size = 15 CHECK: debug start = 0, debug end = 14, flags = none @@ -81,7 +81,7 @@ CHECK: flags = has async eh | opt speed CHECK: 196 | S_END [size = 4] CHECK: 200 | S_GDATA32 [size = 24] `global` CHECK: type = 0x0074 (int), addr = 0000:0000 -CHECK: 224 | S_BUILDINFO [size = 8] BuildId = `4109` +CHECK: 224 | S_BUILDINFO [size = 8] BuildId = `0x100D` CHECK-NOT: S_GPROC32_ID {{.*}} `foo` CHECK-LABEL: Mod 0002 | `* Linker *`: diff --git a/test/COFF/pdb-lib.s b/test/COFF/pdb-lib.s index ab95f82a2a911..74d987eac8141 100644 --- a/test/COFF/pdb-lib.s +++ b/test/COFF/pdb-lib.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: rm -rf %t && mkdir -p %t && cd %t # RUN: llvm-mc -filetype=obj -triple=i686-windows-msvc %s -o foo.obj # RUN: llc %S/Inputs/bar.ll -filetype=obj -mtriple=i686-windows-msvc -o bar.obj diff --git a/test/COFF/pdb-symbol-types.yaml b/test/COFF/pdb-symbol-types.yaml index 8abbc365b34ed..2ad6f5b07bf47 100644 --- a/test/COFF/pdb-symbol-types.yaml +++ b/test/COFF/pdb-symbol-types.yaml @@ -35,7 +35,7 @@ # CHECK: original type = 0x1004 # CHECK: 240 | S_UDT [size = 12] `Foo` # CHECK: original type = 0x1004 -# CHECK: 252 | S_BUILDINFO [size = 8] BuildId = `4106` +# CHECK: 252 | S_BUILDINFO [size = 8] BuildId = `0x100A` # CHECK-LABEL: Mod 0001 | `* Linker *`: --- !COFF diff --git a/test/COFF/pdb-type-server-missing.yaml b/test/COFF/pdb-type-server-missing.yaml new file mode 100644 index 0000000000000..91bb04f5622f5 --- /dev/null +++ b/test/COFF/pdb-type-server-missing.yaml @@ -0,0 +1,132 @@ +# This is an object compiled with /Zi (see the LF_TYPESERVER2 record) without an +# adjacent type server PDB. Test that LLD fails gracefully on it. + +# FIXME: Ideally we'd do what MSVC does, which is to warn and drop all debug +# info in the object with the missing PDB. + +# RUN: yaml2obj %s -o %t.obj +# RUN: not lld-link %t.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main 2>&1 | FileCheck %s + +# CHECK: error: Type server PDB was not found + +--- !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_GPROC32_ID + ProcSym: + CodeSize: 3 + DbgStart: 0 + DbgEnd: 2 + FunctionType: 4199 + Flags: [ ] + DisplayName: main + - Kind: S_FRAMEPROC + FrameProcSym: + TotalFrameBytes: 0 + PaddingFrameBytes: 0 + OffsetToPadding: 0 + BytesOfCalleeSavedRegisters: 0 + OffsetOfExceptionHandler: 0 + SectionIdOfExceptionHandler: 0 + Flags: [ AsynchronousExceptionHandling, OptimizedForSpeed ] + - Kind: S_PROC_ID_END + ScopeEndSym: + - !Lines + CodeSize: 3 + Flags: [ ] + RelocOffset: 0 + RelocSegment: 0 + Blocks: + - FileName: 'c:\src\llvm-project\build\t.c' + Lines: + - Offset: 0 + LineStart: 1 + IsStatement: true + EndDelta: 0 + Columns: + - !FileChecksums + Checksums: + - FileName: 'c:\src\llvm-project\build\t.c' + Kind: MD5 + Checksum: 270A878DCC1B845655B162F56C4F5020 + - !StringTable + Strings: + - 'c:\src\llvm-project\build\t.c' + Relocations: + - VirtualAddress: 44 + SymbolName: main + Type: IMAGE_REL_AMD64_SECREL + - VirtualAddress: 48 + SymbolName: main + Type: IMAGE_REL_AMD64_SECTION + - VirtualAddress: 100 + SymbolName: main + Type: IMAGE_REL_AMD64_SECREL + - VirtualAddress: 104 + SymbolName: main + Type: IMAGE_REL_AMD64_SECTION + - Name: '.debug$T' + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] + Alignment: 1 + Types: + - Kind: LF_TYPESERVER2 + TypeServer2: + Guid: '{01DF191B-22BF-6B42-96CE-5258B8329FE5}' + Age: 18 + Name: 'C:\src\llvm-project\build\definitely_not_found_for_sure.pdb' + - Name: '.text$mn' + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: 33C0C3 +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: 328 + NumberOfRelocations: 4 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.debug$T' + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 564 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.text$mn' + Value: 0 + SectionNumber: 3 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 3 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 4021952397 + Number: 0 + - Name: main + Value: 0 + SectionNumber: 3 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL +... diff --git a/test/COFF/pdb-type-server-simple.test b/test/COFF/pdb-type-server-simple.test new file mode 100644 index 0000000000000..c0de4e390914b --- /dev/null +++ b/test/COFF/pdb-type-server-simple.test @@ -0,0 +1,91 @@ +Replicate this scenario: + +$ cat a.c +struct Foo { int x; }; +int g(struct Foo *p); +int main() { + struct Foo f = {42}; + return g(&f); +} + +$ cat b.c +struct Foo { int x; }; +int g(struct Foo *p) { return p->x; } + +$ cl -c a.c b.c -Zi -Fdts.pdb + +$ lld-link a.obj b.obj -debug -entry:main -nodefaultlib -out:t.exe + +RUN: rm -rf %t && mkdir -p %t && cd %t +RUN: yaml2obj %S/Inputs/pdb-type-server-simple-a.yaml -o a.obj +RUN: yaml2obj %S/Inputs/pdb-type-server-simple-b.yaml -o b.obj +RUN: llvm-pdbutil yaml2pdb %S/Inputs/pdb-type-server-simple-ts.yaml -pdb ts.pdb +RUN: lld-link a.obj b.obj -entry:main -debug -out:t.exe -pdb:t.pdb -nodefaultlib +RUN: llvm-pdbutil dump -symbols -types -ids %t/t.pdb | FileCheck %s + + +CHECK-LABEL: Types (TPI Stream) +CHECK: ============================================================ + +CHECK: [[FOO_DECL:[^ ]*]] | LF_STRUCTURE [size = 36] `Foo` + +CHECK: [[FOO_PTR:[^ ]*]] | LF_POINTER [size = 12] +CHECK-NEXT: referent = [[FOO_DECL]] + +CHECK: [[G_ARGS:[^ ]*]] | LF_ARGLIST [size = 12] +CHECK-NEXT: [[FOO_PTR]]: `Foo*` + +CHECK: [[G_PROTO:[^ ]*]] | LF_PROCEDURE [size = 16] +CHECK-NEXT: return type = 0x0074 (int), # args = 1, param list = [[G_ARGS]] +CHECK-NEXT: calling conv = cdecl, options = None + +CHECK: [[FOO_COMPLETE:[^ ]*]] | LF_STRUCTURE [size = 36] `Foo` +CHECK-NEXT: unique name: `.?AUFoo@@` +CHECK-NEXT: vtable: <no type>, base list: <no type>, field list: 0x{{.*}} +CHECK: options: has unique name +CHECK: [[MAIN_PROTO:[^ ]*]] | LF_PROCEDURE [size = 16] +CHECK: return type = 0x0074 (int), # args = 0, param list = 0x{{.*}} +CHECK: calling conv = cdecl, options = None + + +CHECK-LABEL: Types (IPI Stream) +CHECK: ============================================================ +CHECK: [[MAIN_ID:[^ ]*]] | LF_FUNC_ID [size = 20] +CHECK: name = main, type = [[MAIN_PROTO]], parent scope = <no type> +CHECK: [[G_ID:[^ ]*]] | LF_FUNC_ID [size = 16] +CHECK: name = g, type = [[G_PROTO]], parent scope = <no type> +CHECK: [[A_BUILD:[^ ]*]] | LF_BUILDINFO [size = 28] +CHECK: {{.*}}: `a.c` +CHECK: [[B_BUILD:[^ ]*]] | LF_BUILDINFO [size = 28] +CHECK: {{.*}}: `b.c` + +CHECK-LABEL: Symbols +CHECK: ============================================================ +CHECK-LABEL: Mod 0000 | `{{.*}}a.obj`: +CHECK: 4 | S_OBJNAME [size = 40] sig=0, `C:\src\llvm-project\build\a.obj` +CHECK: 104 | S_GPROC32_ID [size = 44] `main` +CHECK: parent = 0, end = 196, addr = 0002:0000, code size = 27 +CHECK: type = {{.*}}, debug start = 4, debug end = 22, flags = none +CHECK: 200 | S_UDT [size = 12] `Foo` +CHECK: original type = [[FOO_COMPLETE]] +CHECK: 212 | S_BUILDINFO [size = 8] BuildId = `[[A_BUILD]]` +CHECK-LABEL: Mod 0001 | `{{.*}}b.obj`: +CHECK: 4 | S_OBJNAME [size = 40] sig=0, `C:\src\llvm-project\build\b.obj` +CHECK: 44 | S_COMPILE3 [size = 60] +CHECK: machine = intel x86-x64, Ver = Microsoft (R) Optimizing Compiler, language = c +CHECK: frontend = 19.0.24215.1, backend = 19.0.24215.1 +CHECK: flags = security checks | hot patchable +CHECK: 104 | S_GPROC32_ID [size = 44] `g` +CHECK: parent = 0, end = 196, addr = 0002:0032, code size = 13 +CHECK: type = {{.*}}, debug start = 5, debug end = 12, flags = none +CHECK: 148 | S_FRAMEPROC [size = 32] +CHECK: size = 0, padding size = 0, offset to padding = 0 +CHECK: bytes of callee saved registers = 0, exception handler addr = 0000:0000 +CHECK: flags = has async eh | opt speed +CHECK: 180 | S_REGREL32 [size = 16] `p` +CHECK: type = [[FOO_PTR]] (Foo*), register = rsp, offset = 8 +CHECK: 196 | S_END [size = 4] +CHECK: 200 | S_UDT [size = 12] `Foo` +CHECK: original type = [[FOO_COMPLETE]] +CHECK: 212 | S_BUILDINFO [size = 8] BuildId = `[[B_BUILD]]` +CHECK-LABEL: Mod 0002 | `* Linker *`: diff --git a/test/COFF/reloc-discarded-dwarf.s b/test/COFF/reloc-discarded-dwarf.s new file mode 100644 index 0000000000000..d779d2f5b8fc2 --- /dev/null +++ b/test/COFF/reloc-discarded-dwarf.s @@ -0,0 +1,15 @@ +# 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 diff --git a/test/COFF/reloc-oob.yaml b/test/COFF/reloc-oob.yaml new file mode 100644 index 0000000000000..0ed4c4d579761 --- /dev/null +++ b/test/COFF/reloc-oob.yaml @@ -0,0 +1,62 @@ +# Make sure LLD does some light relocation bounds checking. + +# RUN: yaml2obj %s -o %t.obj +# RUN: not lld-link %t.obj -entry:main -nodefaultlib -out:%t.exe 2>&1 | FileCheck %s + +# CHECK: error: relocation points beyond the end of its parent section + +--- !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: 16 + SectionData: 5589E550C745FC00000000A10000000083C4045DC3 + Relocations: + - VirtualAddress: 24 + SymbolName: _g + Type: IMAGE_REL_I386_DIR32 + - Name: .data + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] + Alignment: 4 + SectionData: 2A000000 +symbols: + - Name: .text + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 21 + NumberOfRelocations: 1 + NumberOfLinenumbers: 0 + CheckSum: 662775349 + Number: 1 + - Name: .data + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 3482275674 + Number: 2 + - Name: _main + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: _g + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_EXTERNAL +... diff --git a/test/COFF/savetemps.ll b/test/COFF/savetemps.ll index 4e59812441a90..7f2e11c177153 100644 --- a/test/COFF/savetemps.ll +++ b/test/COFF/savetemps.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: rm -fr %T/savetemps ; RUN: mkdir %T/savetemps ; RUN: llvm-as -o %T/savetemps/savetemps.obj %s diff --git a/test/COFF/thinlto-archives.ll b/test/COFF/thinlto-archives.ll index 7a5e36aa1fb95..9a47a3a6feb64 100644 --- a/test/COFF/thinlto-archives.ll +++ b/test/COFF/thinlto-archives.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: rm -fr %T/thinlto-archives ; RUN: mkdir %T/thinlto-archives %T/thinlto-archives/a %T/thinlto-archives/b ; RUN: opt -thinlto-bc -o %T/thinlto-archives/main.obj %s diff --git a/test/COFF/thinlto-mangled.ll b/test/COFF/thinlto-mangled.ll index efcd9c3d2d0a8..8c901cbd70ba1 100644 --- a/test/COFF/thinlto-mangled.ll +++ b/test/COFF/thinlto-mangled.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: opt -thinlto-bc %s -o %t.obj ; RUN: opt -thinlto-bc %S/Inputs/thinlto-mangled-qux.ll -o %T/thinlto-mangled-qux.obj ; RUN: lld-link -out:%t.exe -entry:main %t.obj %T/thinlto-mangled-qux.obj diff --git a/test/COFF/thinlto.ll b/test/COFF/thinlto.ll index 11b689d6327ef..f01d0d802289b 100644 --- a/test/COFF/thinlto.ll +++ b/test/COFF/thinlto.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: rm -fr %T/thinlto ; RUN: mkdir %T/thinlto ; RUN: opt -thinlto-bc -o %T/thinlto/main.obj %s diff --git a/test/ELF/Inputs/ctors_dtors_priority1.s b/test/ELF/Inputs/ctors_dtors_priority1.s index 2eb19d7edad95..2102dba278dc1 100644 --- a/test/ELF/Inputs/ctors_dtors_priority1.s +++ b/test/ELF/Inputs/ctors_dtors_priority1.s @@ -1,5 +1,5 @@ .section .ctors, "aw", @progbits - .byte 0xA1 + .quad 0xA1 .section .dtors, "aw", @progbits - .byte 0xA2 + .quad 0xA2 diff --git a/test/ELF/Inputs/ctors_dtors_priority2.s b/test/ELF/Inputs/ctors_dtors_priority2.s index fb85ce87c5c5f..e94b15e2b8940 100644 --- a/test/ELF/Inputs/ctors_dtors_priority2.s +++ b/test/ELF/Inputs/ctors_dtors_priority2.s @@ -1,5 +1,5 @@ .section .ctors, "aw", @progbits - .byte 0xB1 + .quad 0xB1 .section .dtors, "aw", @progbits - .byte 0xB2 + .quad 0xB2 diff --git a/test/ELF/Inputs/ctors_dtors_priority3.s b/test/ELF/Inputs/ctors_dtors_priority3.s index 96418d351a85a..7bba90cc70f80 100644 --- a/test/ELF/Inputs/ctors_dtors_priority3.s +++ b/test/ELF/Inputs/ctors_dtors_priority3.s @@ -1,5 +1,5 @@ .section .ctors, "aw", @progbits - .byte 0xC1 + .quad 0xC1 .section .dtors, "aw", @progbits - .byte 0xC2 + .quad 0xC2 diff --git a/test/ELF/Inputs/gdb-index-a.elf b/test/ELF/Inputs/gdb-index-a.elf Binary files differdeleted file mode 100644 index 9b90b0dc233e9..0000000000000 --- a/test/ELF/Inputs/gdb-index-a.elf +++ /dev/null diff --git a/test/ELF/Inputs/gdb-index-b.elf b/test/ELF/Inputs/gdb-index-b.elf Binary files differdeleted file mode 100644 index b3356d8c773b2..0000000000000 --- a/test/ELF/Inputs/gdb-index-b.elf +++ /dev/null diff --git a/test/ELF/Inputs/gdb-index.s b/test/ELF/Inputs/gdb-index.s new file mode 100644 index 0000000000000..907a66d350b05 --- /dev/null +++ b/test/ELF/Inputs/gdb-index.s @@ -0,0 +1,73 @@ +.text +.Ltext0: +.globl main2 +.type main2, @function +main2: + nop + nop +.Letext0: + +.section .debug_info,"",@progbits +.long 0x30 +.value 0x4 +.long 0 +.byte 0x8 +.uleb128 0x1 +.quad .Ltext0 +.quad .Letext0-.Ltext0 +.long 0 +.long 0 +.long 0 +.long 0 +.byte 0x63 +.byte 0x88 +.byte 0xb4 +.byte 0x61 +.byte 0xaa +.byte 0xb6 +.byte 0xb0 +.byte 0x67 + +.section .debug_abbrev,"",@progbits +.uleb128 0x1 +.uleb128 0x11 +.byte 0 +.uleb128 0x11 +.uleb128 0x1 +.uleb128 0x12 +.uleb128 0x7 +.uleb128 0x10 +.uleb128 0x17 +.uleb128 0x2130 +.uleb128 0xe +.uleb128 0x1b +.uleb128 0xe +.uleb128 0x2134 +.uleb128 0x19 +.uleb128 0x2133 +.uleb128 0x17 +.uleb128 0x2131 +.uleb128 0x7 +.byte 0 +.byte 0 +.byte 0 + +.section .debug_gnu_pubnames,"",@progbits +.long 0x18 +.value 0x2 +.long 0 +.long 0x33 +.long 0x18 +.byte 0x30 +.string "main2" +.long 0 + +.section .debug_gnu_pubtypes,"",@progbits +.long 0x17 +.value 0x2 +.long 0 +.long 0x33 +.long 0x2b +.byte 0x90 +.string "int" +.long 0 diff --git a/test/ELF/Inputs/symver-archive1.s b/test/ELF/Inputs/symver-archive1.s deleted file mode 100644 index be7c644942155..0000000000000 --- a/test/ELF/Inputs/symver-archive1.s +++ /dev/null @@ -1,6 +0,0 @@ -.text -.globl x -.type x, @function -x: - -.symver x, xx@@VER diff --git a/test/ELF/Inputs/symver-archive2.s b/test/ELF/Inputs/symver-archive2.s deleted file mode 100644 index a9b9d0b0a35b5..0000000000000 --- a/test/ELF/Inputs/symver-archive2.s +++ /dev/null @@ -1 +0,0 @@ -call xx@PLT diff --git a/test/ELF/allow-shlib-undefined.s b/test/ELF/allow-shlib-undefined.s index 2d068b0f60ed5..abb0351db7234 100644 --- a/test/ELF/allow-shlib-undefined.s +++ b/test/ELF/allow-shlib-undefined.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # --allow-shlib-undefined and --no-allow-shlib-undefined are fully # ignored in linker implementation. # --allow-shlib-undefined is set by default diff --git a/test/ELF/as-needed-no-reloc.s b/test/ELF/as-needed-no-reloc.s index 68f03d782c245..f8c34f80a5958 100644 --- a/test/ELF/as-needed-no-reloc.s +++ b/test/ELF/as-needed-no-reloc.s @@ -16,7 +16,7 @@ # CHECK-NEXT: Other: 0 # CHECK-NEXT: Section: Undefined -# CHECK: NEEDED SharedLibrary ({{.*}}as-needed-no-reloc{{.*}}2.so) +# CHECK: NEEDED Shared library: [{{.*}}as-needed-no-reloc{{.*}}2.so] .globl _start _start: diff --git a/test/ELF/as-needed.s b/test/ELF/as-needed.s index 4f1a48abac366..37c6103b0ed0a 100644 --- a/test/ELF/as-needed.s +++ b/test/ELF/as-needed.s @@ -28,13 +28,13 @@ // RUN: ld.lld %t.o %t.script -o %t2 // RUN: llvm-readobj -dynamic-table %t2 | FileCheck -check-prefix=CHECK2 %s -// CHECK: NEEDED SharedLibrary (shared1) -// CHECK: NEEDED SharedLibrary (shared2) -// CHECK: NEEDED SharedLibrary (shared3) +// CHECK: NEEDED Shared library: [shared1] +// CHECK: NEEDED Shared library: [shared2] +// CHECK: NEEDED Shared library: [shared3] -// CHECK2: NEEDED SharedLibrary (shared1) -// CHECK2-NOT: NEEDED SharedLibrary (shared2) -// CHECK2-NOT: NEEDED SharedLibrary (shared3) +// CHECK2: NEEDED Shared library: [shared1] +// CHECK2-NOT: NEEDED Shared library: [shared2] +// CHECK2-NOT: NEEDED Shared library: [shared3] .global _start _start: diff --git a/test/ELF/auxiliary.s b/test/ELF/auxiliary.s index 236d0a421d4fc..18fbdf05f9ecf 100644 --- a/test/ELF/auxiliary.s +++ b/test/ELF/auxiliary.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 aaa --auxiliary bbb -o %t # RUN: llvm-readobj --dynamic-table %t | FileCheck %s diff --git a/test/ELF/compressed-debug-input.s b/test/ELF/compressed-debug-input.s index fbd5b02a07f04..d96ebdcb30b45 100644 --- a/test/ELF/compressed-debug-input.s +++ b/test/ELF/compressed-debug-input.s @@ -1,4 +1,4 @@ -# REQUIRES: zlib +# REQUIRES: zlib, x86 # RUN: llvm-mc -compress-debug-sections=zlib -filetype=obj -triple=x86_64-unknown-linux %s -o %t # RUN: llvm-readobj -sections %t | FileCheck -check-prefix=ZLIB %s diff --git a/test/ELF/ctors_dtors_priority.s b/test/ELF/ctors_dtors_priority.s index 10d6471f953a9..fcddcbb020f31 100644 --- a/test/ELF/ctors_dtors_priority.s +++ b/test/ELF/ctors_dtors_priority.s @@ -14,28 +14,35 @@ _start: nop .section .ctors, "aw", @progbits - .byte 1 + .quad 1 .section .ctors.100, "aw", @progbits - .byte 2 + .quad 2 .section .ctors.005, "aw", @progbits - .byte 3 + .quad 3 .section .ctors, "aw", @progbits - .byte 4 + .quad 4 .section .ctors, "aw", @progbits - .byte 5 + .quad 5 .section .dtors, "aw", @progbits - .byte 0x11 + .quad 0x11 .section .dtors.100, "aw", @progbits - .byte 0x12 + .quad 0x12 .section .dtors.005, "aw", @progbits - .byte 0x13 + .quad 0x13 .section .dtors, "aw", @progbits - .byte 0x14 + .quad 0x14 .section .dtors, "aw", @progbits - .byte 0x15 + .quad 0x15 // CHECK: Contents of section .ctors: -// CHECK-NEXT: a1010405 b10302c1 +// CHECK-NEXT: 202000 a1000000 00000000 01000000 00000000 +// CHECK-NEXT: 202010 04000000 00000000 05000000 00000000 +// CHECK-NEXT: 202020 b1000000 00000000 03000000 00000000 +// CHECK-NEXT: 202030 02000000 00000000 c1000000 00000000 + // CHECK: Contents of section .dtors: -// CHECK-NEXT: a2111415 b21312c2 +// CHECK-NEXT: 202040 a2000000 00000000 11000000 00000000 +// CHECK-NEXT: 202050 14000000 00000000 15000000 00000000 +// CHECK-NEXT: 202060 b2000000 00000000 13000000 00000000 +// CHECK-NEXT: 202070 12000000 00000000 c2000000 00000000 diff --git a/test/ELF/debug-gnu-pubnames.s b/test/ELF/debug-gnu-pubnames.s index 0a8693c97eb8e..aebfdfd0fb91c 100644 --- a/test/ELF/debug-gnu-pubnames.s +++ b/test/ELF/debug-gnu-pubnames.s @@ -1,10 +1,18 @@ # REQUIRES: x86 -# RUN: ld.lld -e main %p/Inputs/gdb-index-a.elf %p/Inputs/gdb-index-b.elf -o %t1.exe -# RUN: llvm-readobj -sections %t1.exe | FileCheck -check-prefix=CHECK1 %s -# CHECK1: Name: .debug_gnu_pubnames -# CHECK1: Name: .debug_gnu_pubtypes - -# RUN: ld.lld -gdb-index -e main %p/Inputs/gdb-index-a.elf %p/Inputs/gdb-index-b.elf -o %t2.exe -# RUN: llvm-readobj -sections %t2.exe | FileCheck -check-prefix=CHECK2 %s -# CHECK2-NOT: Name: .debug_gnu_pubnames -# CHECK2-NOT: Name: .debug_gnu_pubtypes +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + +# RUN: ld.lld %t.o -o %t1.exe +# RUN: llvm-readobj -sections %t1.exe | FileCheck %s +# CHECK: .debug_gnu_pubnames +# CHECK: .debug_gnu_pubtypes + +# RUN: ld.lld -gdb-index %t.o -o %t2.exe +# RUN: llvm-readobj -sections %t2.exe | FileCheck %s --check-prefix=GDB +# GDB-NOT: .debug_gnu_pubnames +# GDB-NOT: .debug_gnu_pubtypes + +.section .debug_gnu_pubnames,"",@progbits +.long 0 + +.section .debug_gnu_pubtypes,"",@progbits +.long 0 diff --git a/test/ELF/dynamic-reloc.s b/test/ELF/dynamic-reloc.s index 8fda0b45abea7..939093c17b41a 100644 --- a/test/ELF/dynamic-reloc.s +++ b/test/ELF/dynamic-reloc.s @@ -43,7 +43,7 @@ // CHECK: DynamicSection [ // CHECK-NEXT: Tag Type Name/Value -// CHECK-NEXT: 0x0000000000000001 NEEDED SharedLibrary ({{.*}}2.so) +// CHECK-NEXT: 0x0000000000000001 NEEDED Shared library: [{{.*}}2.so] // CHECK-NEXT: 0x0000000000000015 DEBUG 0x0 // CHECK-NEXT: 0x0000000000000017 JMPREL // CHECK-NEXT: 0x0000000000000002 PLTRELSZ 24 (bytes) diff --git a/test/ELF/filter.s b/test/ELF/filter.s new file mode 100644 index 0000000000000..fa8e5267b18b5 --- /dev/null +++ b/test/ELF/filter.s @@ -0,0 +1,15 @@ +# 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. +# RUN: ld.lld %t.o -shared --filter=foo.so --filter=boo.so -o %t2 +# RUN: llvm-readobj --dynamic-table %t2 | 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 diff --git a/test/ELF/gc-sections-shared.s b/test/ELF/gc-sections-shared.s index a88f2b4434797..efb21faee6bdc 100644 --- a/test/ELF/gc-sections-shared.s +++ b/test/ELF/gc-sections-shared.s @@ -38,7 +38,7 @@ # CHECK-NEXT: } # CHECK-NEXT: ] -# CHECK: NEEDED SharedLibrary ({{.*}}.so) +# CHECK: NEEDED Shared library: [{{.*}}.so] .section .text.foo, "ax" .globl foo diff --git a/test/ELF/gdb-index-empty.s b/test/ELF/gdb-index-empty.s index 24f20803a0088..0158357c9bfdb 100644 --- a/test/ELF/gdb-index-empty.s +++ b/test/ELF/gdb-index-empty.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux -o %t %s # RUN: ld.lld --gdb-index --gc-sections -o %t2 %t # RUN: llvm-dwarfdump -debug-dump=gdb_index %t2 | FileCheck %s diff --git a/test/ELF/gdb-index-gc-sections.s b/test/ELF/gdb-index-gc-sections.s index 70a14754656cb..58c47ae5e987c 100644 --- a/test/ELF/gdb-index-gc-sections.s +++ b/test/ELF/gdb-index-gc-sections.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux -o %t %s # RUN: ld.lld --gdb-index --gc-sections -o %t2 %t # RUN: llvm-dwarfdump -debug-dump=gdb_index %t2 | FileCheck %s diff --git a/test/ELF/gdb-index.s b/test/ELF/gdb-index.s index b7d8a708ace53..e04845e022c32 100644 --- a/test/ELF/gdb-index.s +++ b/test/ELF/gdb-index.s @@ -1,32 +1,19 @@ -## gdb-index-a.elf and gdb-index-b.elf are a test.o and test2.o renamed, -## were generated in this way: -## test.cpp: -## int main() { return 0; } -## test2.cpp: -## int main2() { return 0; } -## Compiled with: -## gcc -gsplit-dwarf -c test.cpp test2.cpp -## gcc version 5.3.1 20160413 -## Info about gdb-index: https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html - # REQUIRES: x86 -# RUN: ld.lld --gdb-index -e main %p/Inputs/gdb-index-a.elf %p/Inputs/gdb-index-b.elf -o %t +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/gdb-index.s -o %t2.o +# RUN: ld.lld --gdb-index -e main %t1.o %t2.o -o %t # RUN: llvm-dwarfdump -debug-dump=gdb_index %t | FileCheck %s # RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=DISASM # DISASM: Disassembly of section .text: # DISASM: main: -# DISASM-CHECK: 11000: 55 pushq %rbp -# DISASM-CHECK: 11001: 48 89 e5 movq %rsp, %rbp -# DISASM-CHECK: 11004: b8 00 00 00 00 movl $0, %eax -# DISASM-CHECK: 11009: 5d popq %rbp -# DISASM-CHECK: 1100a: c3 retq -# DISASM: _Z5main2v: -# DISASM-CHECK: 1100b: 55 pushq %rbp -# DISASM-CHECK: 1100c: 48 89 e5 movq %rsp, %rbp -# DISASM-CHECK: 1100f: b8 00 00 00 00 movl $0, %eax -# DISASM-CHECK: 11014: 5d popq %rbp -# DISASM-CHECK: 11015: c3 retq +# DISASM-CHECK: 201000: 90 nop +# DISASM-CHECK: 201001: cc int3 +# DISASM-CHECK: 201002: cc int3 +# DISASM-CHECK: 201003: cc int3 +# DISASM: main2: +# DISASM-CHECK: 201004: 90 nop +# DISASM-CHECK: 201005: 90 nop # CHECK: .gnu_index contents: # CHECK-NEXT: Version = 7 @@ -34,8 +21,8 @@ # CHECK-NEXT: 0: Offset = 0x0, Length = 0x34 # CHECK-NEXT: 1: Offset = 0x34, Length = 0x34 # CHECK: Address area offset = 0x38, has 2 entries: -# CHECK-NEXT: Low/High address = [0x201000, 0x20100b) (Size: 0xb), CU id = 0 -# CHECK-NEXT: Low/High address = [0x20100b, 0x201016) (Size: 0xb), CU id = 1 +# CHECK-NEXT: Low/High address = [0x201000, 0x201001) (Size: 0x1), CU id = 0 +# CHECK-NEXT: Low/High address = [0x201004, 0x201006) (Size: 0x2), CU id = 1 # CHECK: Symbol table offset = 0x60, size = 1024, filled slots: # CHECK-NEXT: 489: Name offset = 0x1d, CU vector offset = 0x0 # CHECK-NEXT: String name: main, CU vector index: 0 @@ -47,3 +34,79 @@ # CHECK-NEXT: 0(0x0): 0x30000000 # CHECK-NEXT: 1(0x8): 0x90000000 0x90000001 # CHECK-NEXT: 2(0x14): 0x30000001 + +## The following section contents are created by this using gcc 7.1.0: +## echo 'int main() { return 0; }' | gcc -gsplit-dwarf -xc++ -S -o- - + +.text +.Ltext0: +.globl main +.type main, @function +main: + nop +.Letext0: + +.section .debug_info,"",@progbits +.long 0x30 +.value 0x4 +.long 0 +.byte 0x8 +.uleb128 0x1 +.quad .Ltext0 +.quad .Letext0-.Ltext0 +.long 0 +.long 0 +.long 0 +.long 0 +.byte 0x63 +.byte 0x88 +.byte 0xb4 +.byte 0x61 +.byte 0xaa +.byte 0xb6 +.byte 0xb0 +.byte 0x67 + +.section .debug_abbrev,"",@progbits +.uleb128 0x1 +.uleb128 0x11 +.byte 0 +.uleb128 0x11 +.uleb128 0x1 +.uleb128 0x12 +.uleb128 0x7 +.uleb128 0x10 +.uleb128 0x17 +.uleb128 0x2130 +.uleb128 0xe +.uleb128 0x1b +.uleb128 0xe +.uleb128 0x2134 +.uleb128 0x19 +.uleb128 0x2133 +.uleb128 0x17 +.uleb128 0x2131 +.uleb128 0x7 +.byte 0 +.byte 0 +.byte 0 + +.section .debug_gnu_pubnames,"",@progbits +.long 0x18 +.value 0x2 +.long 0 +.long 0x33 +.long 0x18 +.byte 0x30 +.string "main" +.long 0 + +.section .debug_gnu_pubtypes,"",@progbits +.long 0x17 +.value 0x2 +.long 0 +.long 0x33 +.long 0x2b +.byte 0x90 +.string "int" +.long 0 diff --git a/test/ELF/i386-reloc-large-addend.s b/test/ELF/i386-reloc-large-addend.s index b644640404e2d..5af5844755622 100644 --- a/test/ELF/i386-reloc-large-addend.s +++ b/test/ELF/i386-reloc-large-addend.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -triple i386-pc-linux-code16 -filetype=obj // RUN: echo ".global foo; foo = 0x1" > %t1.s diff --git a/test/ELF/i386-reloc-range.s b/test/ELF/i386-reloc-range.s index 47447d0efa32c..4fb5325e54345 100644 --- a/test/ELF/i386-reloc-range.s +++ b/test/ELF/i386-reloc-range.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -triple i386-pc-linux-code16 -filetype=obj // RUN: echo ".global foo; foo = 0x10202" > %t1.s diff --git a/test/ELF/invalid/tls-symbol.s b/test/ELF/invalid/tls-symbol.s index 7c65c6c9f2c7c..354ca573d5c0d 100644 --- a/test/ELF/invalid/tls-symbol.s +++ b/test/ELF/invalid/tls-symbol.s @@ -1,5 +1,5 @@ # REQUIRES: x86 -## The test file contains a STT_TLS symbol but has no TLS section. +## The test file contains an STT_TLS symbol but has no TLS section. # RUN: not ld.lld %S/Inputs/tls-symbol.elf -o %t 2>&1 | FileCheck %s -# CHECK: has a STT_TLS symbol but doesn't have a PT_TLS section +# CHECK: has an STT_TLS symbol but doesn't have an SHF_TLS section diff --git a/test/ELF/linkerscript/exidx-crash.s b/test/ELF/linkerscript/exidx-crash.s new file mode 100644 index 0000000000000..c29d0135414d5 --- /dev/null +++ b/test/ELF/linkerscript/exidx-crash.s @@ -0,0 +1,7 @@ +# REQUIRES: aarch64 + +# We used to crash on this. + +# RUN: llvm-mc %s -o %t.o -filetype=obj -triple=aarch64-pc-linux +# RUN: echo "SECTIONS { .ARM.exidx : { *(.foo) } }" > %t.script +# RUN: ld.lld -T %t.script %t.o -o %t diff --git a/test/ELF/linkerscript/got-write-offset.s b/test/ELF/linkerscript/got-write-offset.s new file mode 100644 index 0000000000000..323da7b4a46b3 --- /dev/null +++ b/test/ELF/linkerscript/got-write-offset.s @@ -0,0 +1,23 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux-gnu %s -o %t +# RUN: echo "SECTIONS { \ +# RUN: .data 0x1000 : { *(.data) } \ +# RUN: .got 0x2000 : { \ +# RUN: LONG(0) \ +# RUN: *(.got) \ +# RUN: } \ +# RUN: };" > %t.script +# RUN: ld.lld -shared -o %t.out --script %t.script %t +# RUN: llvm-objdump -s %t.out | FileCheck %s +.text +.global foo +foo: + movl bar@GOT, %eax +.data +.local bar +bar: + .zero 4 +# CHECK: Contents of section .data: +# CHECK-NEXT: 1000 00000000 +# CHECK: Contents of section .got: +# CHECK-NEXT: 2000 00000000 00100000 diff --git a/test/ELF/linkerscript/output-too-large.s b/test/ELF/linkerscript/output-too-large.s index db021eaa99e07..c892a88a947e8 100644 --- a/test/ELF/linkerscript/output-too-large.s +++ b/test/ELF/linkerscript/output-too-large.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t.o # RUN: echo "SECTIONS { .text : { . = 0xffffffff; *(.text*); } }" > %t.script # RUN: not ld.lld --script %t.script %t.o -o %t 2>&1 | FileCheck %s diff --git a/test/ELF/lto/available-externally.ll b/test/ELF/lto/available-externally.ll index 181042b9d1e1c..315e710ec87cf 100644 --- a/test/ELF/lto/available-externally.ll +++ b/test/ELF/lto/available-externally.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as %s -o %t1.o ; RUN: llvm-as %p/Inputs/available-externally.ll -o %t2.o ; RUN: ld.lld %t1.o %t2.o -m elf_x86_64 -o %t.so -shared -save-temps diff --git a/test/ELF/lto/comdat2.ll b/test/ELF/lto/comdat2.ll index 1509585f1553f..283182155ae68 100644 --- a/test/ELF/lto/comdat2.ll +++ b/test/ELF/lto/comdat2.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o ; RUN: llvm-mc -triple=x86_64-pc-linux %p/Inputs/comdat.s -o %t2.o -filetype=obj ; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t.so -shared diff --git a/test/ELF/lto/common2.ll b/test/ELF/lto/common2.ll index b44bbac4fda31..2345a203b24ca 100644 --- a/test/ELF/lto/common2.ll +++ b/test/ELF/lto/common2.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as %s -o %t1.o ; RUN: ld.lld -m elf_x86_64 %t1.o -o %t -shared -save-temps ; RUN: llvm-dis < %t.0.2.internalize.bc | FileCheck %s diff --git a/test/ELF/lto/common3.ll b/test/ELF/lto/common3.ll index 6d40de547fcd6..aea33f443f4c3 100644 --- a/test/ELF/lto/common3.ll +++ b/test/ELF/lto/common3.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as %s -o %t1.o ; RUN: llvm-as %S/Inputs/common3.ll -o %t2.o ; RUN: ld.lld -m elf_x86_64 %t1.o %t2.o -o %t -shared -save-temps diff --git a/test/ELF/lto/discard-value-names.ll b/test/ELF/lto/discard-value-names.ll index c71dc386113dd..f1e95fe75000d 100644 --- a/test/ELF/lto/discard-value-names.ll +++ b/test/ELF/lto/discard-value-names.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o ; RUN: ld.lld -m elf_x86_64 -shared -save-temps %t.o -o %t2.o diff --git a/test/ELF/lto/opt-level.ll b/test/ELF/lto/opt-level.ll index 934bf01b6c320..1065ca7757515 100644 --- a/test/ELF/lto/opt-level.ll +++ b/test/ELF/lto/opt-level.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as -o %t.o %s ; RUN: ld.lld -o %t0 -m elf_x86_64 -e main --lto-O0 %t.o ; RUN: llvm-nm %t0 | FileCheck --check-prefix=CHECK-O0 %s diff --git a/test/ELF/lto/opt-remarks.ll b/test/ELF/lto/opt-remarks.ll index 88304205cabab..e29cc72bb3cc4 100644 --- a/test/ELF/lto/opt-remarks.ll +++ b/test/ELF/lto/opt-remarks.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o ; RUN: rm -f %t.yaml diff --git a/test/ELF/lto/relax-relocs.ll b/test/ELF/lto/relax-relocs.ll index 929e124b2d8e3..8e8d9d1657870 100644 --- a/test/ELF/lto/relax-relocs.ll +++ b/test/ELF/lto/relax-relocs.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o ; RUN: ld.lld -m elf_x86_64 -save-temps -shared %t.o -o %t.so ; RUN: llvm-readobj -r %t.so.lto.o | FileCheck %s diff --git a/test/ELF/lto/thin-archivecollision.ll b/test/ELF/lto/thin-archivecollision.ll index f1dd5ae4d85ff..554c2b02fc40c 100644 --- a/test/ELF/lto/thin-archivecollision.ll +++ b/test/ELF/lto/thin-archivecollision.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: opt -module-summary %s -o %t.o ; RUN: mkdir -p %t1 %t2 ; RUN: opt -module-summary %p/Inputs/thin1.ll -o %t1/t.coll.o diff --git a/test/ELF/lto/thinlto.ll b/test/ELF/lto/thinlto.ll index 2036c554a76db..99dd19130d28f 100644 --- a/test/ELF/lto/thinlto.ll +++ b/test/ELF/lto/thinlto.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; Basic ThinLTO tests. ; RUN: opt -module-summary %s -o %t.o ; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.o diff --git a/test/ELF/lto/type-merge2.ll b/test/ELF/lto/type-merge2.ll index 45777a7e6a489..6ebbf778dd8e6 100644 --- a/test/ELF/lto/type-merge2.ll +++ b/test/ELF/lto/type-merge2.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o ; RUN: llvm-as %p/Inputs/type-merge2.ll -o %t2.o ; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t.so -shared -save-temps diff --git a/test/ELF/lto/unnamed-addr-comdat.ll b/test/ELF/lto/unnamed-addr-comdat.ll index ed48f3ba5e04e..29a59415851b7 100644 --- a/test/ELF/lto/unnamed-addr-comdat.ll +++ b/test/ELF/lto/unnamed-addr-comdat.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o ; RUN: ld.lld -m elf_x86_64 %t.o %t.o -o %t.so -save-temps -shared ; RUN: llvm-dis %t.so.0.2.internalize.bc -o - | FileCheck %s diff --git a/test/ELF/lto/unnamed-addr-drop.ll b/test/ELF/lto/unnamed-addr-drop.ll index 9142537fe57d8..e827cbb435e6b 100644 --- a/test/ELF/lto/unnamed-addr-drop.ll +++ b/test/ELF/lto/unnamed-addr-drop.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as %s -o %t1.o ; RUN: llvm-as %S/Inputs/unnamed-addr-drop.ll -o %t2.o ; RUN: ld.lld -m elf_x86_64 %t1.o %t2.o -o %t.so -save-temps -shared diff --git a/test/ELF/lto/unnamed-addr.ll b/test/ELF/lto/unnamed-addr.ll index 6a6dd73dad861..56fe148b0995e 100644 --- a/test/ELF/lto/unnamed-addr.ll +++ b/test/ELF/lto/unnamed-addr.ll @@ -1,3 +1,4 @@ +; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o ; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps -shared ; RUN: llvm-dis %t.so.0.4.opt.bc -o - | FileCheck %s diff --git a/test/ELF/many-alloc-sections.s b/test/ELF/many-alloc-sections.s index 441e5ff32d085..648ab8250286e 100644 --- a/test/ELF/many-alloc-sections.s +++ b/test/ELF/many-alloc-sections.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t.o // RUN: echo "SECTIONS { . = SIZEOF_HEADERS; .text : { *(.text) } }" > %t.script // FIXME: threads are disable because the test is too slow with them (PR32942). diff --git a/test/ELF/many-sections.s b/test/ELF/many-sections.s index ae923889ddc12..7ef0f7ceaac4f 100644 --- a/test/ELF/many-sections.s +++ b/test/ELF/many-sections.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t // RUN: llvm-readobj -t %t | FileCheck %s diff --git a/test/ELF/map-gc-sections.s b/test/ELF/map-gc-sections.s new file mode 100644 index 0000000000000..717ab819889d9 --- /dev/null +++ b/test/ELF/map-gc-sections.s @@ -0,0 +1,9 @@ +// 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 diff --git a/test/ELF/merge-section-types.s b/test/ELF/merge-section-types.s index ee80fe177fe0c..f8462824684fd 100644 --- a/test/ELF/merge-section-types.s +++ b/test/ELF/merge-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-readobj -s %t | FileCheck %s diff --git a/test/ELF/new-dtags.test b/test/ELF/new-dtags.test index 334d477622a78..1ae328c6b5024 100644 --- a/test/ELF/new-dtags.test +++ b/test/ELF/new-dtags.test @@ -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 -rpath=/somepath -shared --disable-new-dtags -o %t // RUN: ld.lld %t.o -rpath=/somepath -shared --enable-new-dtags -o %t2 diff --git a/test/ELF/no-obj.s b/test/ELF/no-obj.s index eea10a45d8795..693cdf1e9d3fa 100644 --- a/test/ELF/no-obj.s +++ b/test/ELF/no-obj.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: llvm-ar rcs %t.a %t.o // RUN: not ld.lld -o %t2 -u _start %t.a 2>&1 | FileCheck %s diff --git a/test/ELF/no-soname.s b/test/ELF/no-soname.s index d2c15ed8f9cdf..e3869ff5a03c6 100644 --- a/test/ELF/no-soname.s +++ b/test/ELF/no-soname.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: mkdir -p %T/no-soname // RUN: ld.lld %t.o -shared -o %T/no-soname/libfoo.so @@ -5,26 +6,26 @@ // RUN: ld.lld %t.o %T/no-soname/libfoo.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s -// CHECK: 0x0000000000000001 NEEDED SharedLibrary ({{.*}}/no-soname/libfoo.so) +// CHECK: 0x0000000000000001 NEEDED Shared library: [{{.*}}/no-soname/libfoo.so] // CHECK-NOT: NEEDED // RUN: ld.lld %t.o %T/no-soname/../no-soname/libfoo.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=CHECK2 -// CHECK2: 0x0000000000000001 NEEDED SharedLibrary ({{.*}}/no-soname/../no-soname/libfoo.so) +// CHECK2: 0x0000000000000001 NEEDED Shared library: [{{.*}}/no-soname/../no-soname/libfoo.so] // CHECK2-NOT: NEEDED // RUN: ld.lld %t.o -L%T/no-soname/../no-soname -lfoo -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=CHECK3 -// CHECK3: 0x0000000000000001 NEEDED SharedLibrary (libfoo.so) +// CHECK3: 0x0000000000000001 NEEDED Shared library: [libfoo.so] // CHECK3-NOT: NEEDED // RUN: ld.lld %t.o -shared -soname libbar.so -o %T/no-soname/libbar.so // RUN: ld.lld %t.o %T/no-soname/libbar.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=CHECK4 -// CHECK4: 0x0000000000000001 NEEDED SharedLibrary (libbar.so) +// CHECK4: 0x0000000000000001 NEEDED Shared library: [libbar.so] // CHECK4-NOT: NEEDED .global _start diff --git a/test/ELF/no-symtab.s b/test/ELF/no-symtab.s index 158bd727f2511..af9df13e97688 100644 --- a/test/ELF/no-symtab.s +++ b/test/ELF/no-symtab.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 %p/Inputs/no-symtab.o -o %t .global _start diff --git a/test/ELF/no-undefined.s b/test/ELF/no-undefined.s index fa4d5e928763d..493a389870911 100644 --- a/test/ELF/no-undefined.s +++ b/test/ELF/no-undefined.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t # RUN: not ld.lld --no-undefined -shared %t -o %t.so # RUN: ld.lld -shared %t -o %t1.so diff --git a/test/ELF/pie-weak.s b/test/ELF/pie-weak.s index e74bcdfc09c0a..99dbd47488fc5 100644 --- a/test/ELF/pie-weak.s +++ b/test/ELF/pie-weak.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -relax-relocations=false -triple=x86_64-unknown-linux %s -o %t.o # RUN: ld.lld -pie %t.o -o %t # RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOCS %s diff --git a/test/ELF/progname.s b/test/ELF/progname.s index 6d91823c94815..be8ab9e31c4f5 100644 --- a/test/ELF/progname.s +++ b/test/ELF/progname.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: echo .global __progname > %t2.s // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %t2.s -o %t2.o diff --git a/test/ELF/relative-dynamic-reloc-pie.s b/test/ELF/relative-dynamic-reloc-pie.s index 25b3e0ac23338..f7c8b3c1516cb 100644 --- a/test/ELF/relative-dynamic-reloc-pie.s +++ b/test/ELF/relative-dynamic-reloc-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 -pie %t.o -o %t.pie # RUN: llvm-readobj -r -dyn-symbols %t.pie | FileCheck %s diff --git a/test/ELF/relative-dynamic-reloc.s b/test/ELF/relative-dynamic-reloc.s index 39382124e8896..0ed7e40f74364 100644 --- a/test/ELF/relative-dynamic-reloc.s +++ b/test/ELF/relative-dynamic-reloc.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 %t.so // RUN: llvm-readobj -t -r -dyn-symbols %t.so | FileCheck %s diff --git a/test/ELF/relocatable-compressed-input.s b/test/ELF/relocatable-compressed-input.s index bdfb2073a1e04..3c0199c33f7dc 100644 --- a/test/ELF/relocatable-compressed-input.s +++ b/test/ELF/relocatable-compressed-input.s @@ -1,4 +1,4 @@ -# REQUIRES: zlib +# REQUIRES: x86, zlib # RUN: llvm-mc -compress-debug-sections=zlib-gnu -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 # RUN: llvm-readobj -sections %t1 | FileCheck -check-prefix=GNU %s diff --git a/test/ELF/relocatable-reloc.s b/test/ELF/relocatable-reloc.s index c576073a75104..7c699b9bf3148 100644 --- a/test/ELF/relocatable-reloc.s +++ b/test/ELF/relocatable-reloc.s @@ -1,3 +1,4 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj %s -o %t.o -triple=x86_64-pc-linux // RUN: ld.lld %t.o %t.o -r -o %t2.o // RUN: llvm-readobj -r %t2.o | FileCheck %s diff --git a/test/ELF/relocatable-section-symbol.s b/test/ELF/relocatable-section-symbol.s index 9ac3a91d2c244..57a75ab92f114 100644 --- a/test/ELF/relocatable-section-symbol.s +++ b/test/ELF/relocatable-section-symbol.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o # RUN: ld.lld -r -o %t %t.o %t.o # RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELA %s diff --git a/test/ELF/relocatable-sections.s b/test/ELF/relocatable-sections.s index d6a922fba4827..75ede137293c4 100644 --- a/test/ELF/relocatable-sections.s +++ b/test/ELF/relocatable-sections.s @@ -1,3 +1,4 @@ +# REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o # RUN: ld.lld -r %t1.o -o %t # RUN: llvm-objdump -section-headers %t | FileCheck %s diff --git a/test/ELF/relocatable-tls.s b/test/ELF/relocatable-tls.s index 88d38c2ae4b4a..ff04dd2dfccb1 100644 --- a/test/ELF/relocatable-tls.s +++ b/test/ELF/relocatable-tls.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 \ # RUN: %S/Inputs/relocatable-tls.s -o %t2.o diff --git a/test/ELF/relocation-shared.s b/test/ELF/relocation-shared.s index e1850944c459e..4fba7a5683b0d 100644 --- a/test/ELF/relocation-shared.s +++ b/test/ELF/relocation-shared.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 -o %t.so // RUN: llvm-readobj -r -s -section-data %t.so | FileCheck %s diff --git a/test/ELF/shared-be.s b/test/ELF/shared-be.s index c969793d9d21b..0b941d373720e 100644 --- a/test/ELF/shared-be.s +++ b/test/ELF/shared-be.s @@ -21,7 +21,7 @@ // CHECK: DynamicSection [ // CHECK-NEXT: Tag Type Name/Value // CHECK-NEXT: 0x000000000000001D RUNPATH foo:bar -// CHECK-NEXT: 0x0000000000000001 NEEDED SharedLibrary ({{.*}}2.so) +// CHECK-NEXT: 0x0000000000000001 NEEDED Shared library: [{{.*}}2.so] // CHECK-NEXT: 0x0000000000000015 DEBUG 0x0 // CHECK-NEXT: 0x0000000000000007 RELA [[RELADDR]] // CHECK-NEXT: 0x0000000000000008 RELASZ [[RELSIZE]] (bytes) diff --git a/test/ELF/shared.s b/test/ELF/shared.s index 350ef5c602d00..d4c79d914ffb6 100644 --- a/test/ELF/shared.s +++ b/test/ELF/shared.s @@ -254,7 +254,7 @@ // CHECK: DynamicSection [ // CHECK-NEXT: Tag Type Name/Value // CHECK-NEXT: 0x0000001D RUNPATH foo:bar -// CHECK-NEXT: 0x00000001 NEEDED SharedLibrary ({{.*}}2.so) +// CHECK-NEXT: 0x00000001 NEEDED Shared library: [{{.*}}2.so] // CHECK-NEXT: 0x00000015 DEBUG 0x0 // CHECK-NEXT: 0x00000011 REL [[RELADDR]] // CHECK-NEXT: 0x00000012 RELSZ [[RELSIZE]] (bytes) diff --git a/test/ELF/soname.s b/test/ELF/soname.s index 65e95ce85add9..a26bb30f7a17b 100644 --- a/test/ELF/soname.s +++ b/test/ELF/soname.s @@ -4,7 +4,7 @@ // RUN: ld.lld %t.o %t.so %t2.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s -// CHECK: 0x0000000000000001 NEEDED SharedLibrary (bar) +// CHECK: 0x0000000000000001 NEEDED Shared library: [bar] // CHECK-NOT: NEEDED .global _start diff --git a/test/ELF/soname2.s b/test/ELF/soname2.s index d446766a799d6..9fb8da519bfbe 100644 --- a/test/ELF/soname2.s +++ b/test/ELF/soname2.s @@ -2,7 +2,7 @@ // RUN: ld.lld %t.o -shared -soname=foo.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s -// CHECK: 0x000000000000000E SONAME LibrarySoname (foo.so) +// CHECK: 0x000000000000000E SONAME Library soname: [foo.so] .global _start _start: diff --git a/test/ELF/symver-archive.s b/test/ELF/symver-archive.s deleted file mode 100644 index be50503a3f5d3..0000000000000 --- a/test/ELF/symver-archive.s +++ /dev/null @@ -1,15 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1 -# RUN: rm -f %t.a -# RUN: llvm-ar rcs %t.a %t1 -# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/symver-archive1.s -o %t2.o -# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/symver-archive2.s -o %t3.o -# RUN: ld.lld -o %t.out %t2.o %t3.o %t.a - -.text -.globl x -.type x, @function -x: - -.globl xx -xx = x diff --git a/test/ELF/version-script-twice.s b/test/ELF/version-script-twice.s new file mode 100644 index 0000000000000..3aeedd5b5ddce --- /dev/null +++ b/test/ELF/version-script-twice.s @@ -0,0 +1,14 @@ +# REQUIRES: x86 + +# RUN: echo "FBSD_1.1 {}; FBSD_1.2 {};" > %t.ver +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld -shared %t.o -o %t.so --version-script=%t.ver +# RUN: llvm-readobj --dyn-symbols --elf-output-style=GNU %t.so | FileCheck %s + + .weak openat +openat: +openat@FBSD_1.1 = openat +openat@@FBSD_1.2 = openat + +# CHECK-DAG: openat@FBSD_1.1 +# CHECK-DAG: openat@@FBSD_1.2 |