aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/COFF/Inputs/associative-comdat-2.s13
-rw-r--r--test/COFF/Inputs/pdb1.yaml4
-rw-r--r--test/COFF/Inputs/pdb_comdat_bar.yaml440
-rw-r--r--test/COFF/Inputs/pdb_comdat_main.yaml446
-rw-r--r--test/COFF/Inputs/pdb_lines_1.yaml480
-rw-r--r--test/COFF/Inputs/pdb_lines_2.yaml209
-rw-r--r--test/COFF/associative-comdat.s46
-rw-r--r--test/COFF/def-name.test2
-rw-r--r--test/COFF/dll.test2
-rw-r--r--test/COFF/dllimport-gc.test2
-rw-r--r--test/COFF/guardcf.test74
-rw-r--r--test/COFF/hello32.test2
-rw-r--r--test/COFF/icf-associative.test8
-rw-r--r--test/COFF/manifestinput.test27
-rw-r--r--test/COFF/noentry.test2
-rw-r--r--test/COFF/out.test1
-rw-r--r--test/COFF/pdb-comdat.test100
-rw-r--r--test/COFF/pdb-lib.s2
-rw-r--r--test/COFF/pdb-safeseh.yaml85
-rw-r--r--test/COFF/pdb-secrel-absolute.yaml84
-rw-r--r--test/COFF/pdb-source-lines.test124
-rw-r--r--test/COFF/pdb-symbol-types.yaml344
-rw-r--r--test/COFF/pdb.test8
-rw-r--r--test/COFF/resource.test2
-rw-r--r--test/COFF/safeseh-diag-feat.test (renamed from test/COFF/safeseh.test)0
-rw-r--r--test/COFF/safeseh.s60
-rw-r--r--test/COFF/secidx-absolute.s33
-rw-r--r--test/COFF/secrel-absolute.s14
-rw-r--r--test/COFF/secrel-common.s41
-rw-r--r--test/ELF/Inputs/exclude-libs.s3
-rw-r--r--test/ELF/arm-gnu-ifunc-plt.s6
-rw-r--r--test/ELF/arm-got-relative.s16
-rw-r--r--test/ELF/arm-thumb-branch.s2
-rw-r--r--test/ELF/arm-thumb-plt-reloc.s4
-rw-r--r--test/ELF/defsym.s4
-rw-r--r--test/ELF/exclude-libs.s30
-rw-r--r--test/ELF/global-offset-table-position-aarch64.s30
-rw-r--r--test/ELF/global-offset-table-position-arm.s35
-rw-r--r--test/ELF/global-offset-table-position-i386.s31
-rw-r--r--test/ELF/global-offset-table-position-mips.s33
-rw-r--r--test/ELF/global-offset-table-position.s31
-rw-r--r--test/ELF/global_offset_table_shared.s9
-rw-r--r--test/ELF/invalid-z.s9
-rw-r--r--test/ELF/linkerscript/discard-section-err.s23
-rw-r--r--test/ELF/linkerscript/sections.s6
-rw-r--r--test/ELF/linkerscript/segment-none.s39
-rw-r--r--test/ELF/linkerscript/ttext-script.s11
-rw-r--r--test/ELF/lto/cache.ll11
-rw-r--r--test/ELF/lto/wrap-2.ll2
-rw-r--r--test/ELF/mips-got16-relocatable.s8
-rw-r--r--test/ELF/mips-npic-call-pic-os.s32
-rw-r--r--test/ELF/mips-npic-call-pic-script.s170
-rw-r--r--test/ELF/mips-npic-call-pic.s32
-rw-r--r--test/ELF/mips-plt-r6.s4
-rw-r--r--test/ELF/wrap.s8
-rw-r--r--test/lit.cfg11
-rw-r--r--test/mach-o/executable-exports.yaml4
57 files changed, 3076 insertions, 183 deletions
diff --git a/test/COFF/Inputs/associative-comdat-2.s b/test/COFF/Inputs/associative-comdat-2.s
new file mode 100644
index 000000000000..cd4ef46539f1
--- /dev/null
+++ b/test/COFF/Inputs/associative-comdat-2.s
@@ -0,0 +1,13 @@
+# 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
diff --git a/test/COFF/Inputs/pdb1.yaml b/test/COFF/Inputs/pdb1.yaml
index 566f2da003c5..90905ae191ec 100644
--- a/test/COFF/Inputs/pdb1.yaml
+++ b/test/COFF/Inputs/pdb1.yaml
@@ -34,14 +34,10 @@ sections:
Records:
- Kind: S_GPROC32_ID
ProcSym:
- PtrParent: 0
- PtrEnd: 0
- PtrNext: 0
CodeSize: 14
DbgStart: 4
DbgEnd: 9
FunctionType: 4101
- Segment: 0
Flags: [ ]
DisplayName: main
- Kind: S_FRAMEPROC
diff --git a/test/COFF/Inputs/pdb_comdat_bar.yaml b/test/COFF/Inputs/pdb_comdat_bar.yaml
new file mode 100644
index 000000000000..71a9535c50b7
--- /dev/null
+++ b/test/COFF/Inputs/pdb_comdat_bar.yaml
@@ -0,0 +1,440 @@
+--- !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\pdb_comdat_bar.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:
+ PtrParent: 0
+ PtrEnd: 0
+ PtrNext: 0
+ CodeSize: 14
+ DbgStart: 4
+ DbgEnd: 9
+ FunctionType: 4102
+ Segment: 0
+ Flags: [ ]
+ DisplayName: bar
+ - Kind: S_FRAMEPROC
+ FrameProcSym:
+ TotalFrameBytes: 40
+ PaddingFrameBytes: 0
+ OffsetToPadding: 0
+ BytesOfCalleeSavedRegisters: 0
+ OffsetOfExceptionHandler: 0
+ SectionIdOfExceptionHandler: 0
+ Flags: [ AsynchronousExceptionHandling, OptimizedForSpeed ]
+ - Kind: S_PROC_ID_END
+ ScopeEndSym:
+ - !Lines
+ CodeSize: 14
+ Flags: [ ]
+ RelocOffset: 0
+ RelocSegment: 0
+ Blocks:
+ - FileName: 'c:\src\llvm-project\build\pdb_comdat_bar.c'
+ Lines:
+ - Offset: 0
+ LineStart: 3
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 4
+ LineStart: 4
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 9
+ LineStart: 5
+ IsStatement: true
+ EndDelta: 0
+ Columns:
+ - !Symbols
+ Records:
+ - Kind: S_GDATA32
+ DataSym:
+ Type: 116
+ DisplayName: global
+ - !FileChecksums
+ Checksums:
+ - FileName: 'c:\src\llvm-project\build\pdb_comdat_bar.c'
+ Kind: MD5
+ Checksum: 365279DB4FCBEDD721BBFC3B14A953C2
+ - FileName: 'c:\src\llvm-project\build\foo.h'
+ Kind: MD5
+ Checksum: D74D834EFAC3AE2B45E606A8320B1D5C
+ - !StringTable
+ Strings:
+ - 'c:\src\llvm-project\build\pdb_comdat_bar.c'
+ - 'c:\src\llvm-project\build\foo.h'
+ - !Symbols
+ Records:
+ - Kind: S_BUILDINFO
+ BuildInfoSym:
+ BuildId: 4110
+ Relocations:
+ - VirtualAddress: 168
+ SymbolName: bar
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 172
+ SymbolName: bar
+ Type: IMAGE_REL_AMD64_SECTION
+ - VirtualAddress: 224
+ SymbolName: bar
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 228
+ SymbolName: bar
+ Type: IMAGE_REL_AMD64_SECTION
+ - VirtualAddress: 288
+ SymbolName: global
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 292
+ SymbolName: global
+ 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_ARGLIST
+ ArgList:
+ ArgIndices: [ 0 ]
+ - Kind: LF_PROCEDURE
+ Procedure:
+ ReturnType: 3
+ CallConv: NearC
+ Options: [ None ]
+ ParameterCount: 0
+ ArgumentList: 4096
+ - Kind: LF_POINTER
+ Pointer:
+ ReferentType: 4097
+ Attrs: 65548
+ - Kind: LF_FUNC_ID
+ FuncId:
+ ParentScope: 0
+ FunctionType: 4097
+ Name: foo
+ - Kind: LF_ARGLIST
+ ArgList:
+ ArgIndices: [ ]
+ - Kind: LF_PROCEDURE
+ Procedure:
+ ReturnType: 3
+ CallConv: NearC
+ Options: [ None ]
+ ParameterCount: 0
+ ArgumentList: 4100
+ - Kind: LF_FUNC_ID
+ FuncId:
+ ParentScope: 0
+ FunctionType: 4101
+ Name: bar
+ - 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 -Z7 -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: [ 4105 ]
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 4106
+ String: ' -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\winrt -TC -X'
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 0
+ String: pdb_comdat_bar.c
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 0
+ String: 'C:\src\llvm-project\build\vc140.pdb'
+ - Kind: LF_BUILDINFO
+ BuildInfo:
+ ArgIndices: [ 4103, 4104, 4108, 4109, 4107 ]
+ - Name: .bss
+ Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+ Alignment: 4
+ SectionData: ''
+ - Name: '.text$mn'
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 16
+ SectionData: 4883EC28E8000000004883C428C3
+ Relocations:
+ - VirtualAddress: 5
+ SymbolName: foo
+ 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: 8B0500000000FFC0890500000000C3
+ Relocations:
+ - VirtualAddress: 2
+ SymbolName: global
+ Type: IMAGE_REL_AMD64_REL32
+ - VirtualAddress: 10
+ SymbolName: global
+ Type: IMAGE_REL_AMD64_REL32
+ - Name: '.debug$S'
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
+ Alignment: 1
+ Subsections:
+ - !Symbols
+ Records:
+ - Kind: S_GPROC32_ID
+ ProcSym:
+ PtrParent: 0
+ PtrEnd: 0
+ PtrNext: 0
+ CodeSize: 15
+ DbgStart: 0
+ DbgEnd: 14
+ FunctionType: 4099
+ Segment: 0
+ Flags: [ ]
+ DisplayName: foo
+ - Kind: S_FRAMEPROC
+ FrameProcSym:
+ TotalFrameBytes: 0
+ PaddingFrameBytes: 0
+ OffsetToPadding: 0
+ BytesOfCalleeSavedRegisters: 0
+ OffsetOfExceptionHandler: 0
+ SectionIdOfExceptionHandler: 0
+ Flags: [ MarkedInline, AsynchronousExceptionHandling, OptimizedForSpeed ]
+ - Kind: S_PROC_ID_END
+ ScopeEndSym:
+ - !Lines
+ CodeSize: 15
+ Flags: [ ]
+ RelocOffset: 0
+ RelocSegment: 0
+ Blocks:
+ - FileName: 'c:\src\llvm-project\build\foo.h'
+ Lines:
+ - Offset: 0
+ LineStart: 2
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 0
+ LineStart: 3
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 14
+ LineStart: 4
+ IsStatement: true
+ EndDelta: 0
+ Columns:
+ Relocations:
+ - VirtualAddress: 44
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 48
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECTION
+ - VirtualAddress: 100
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 104
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECTION
+ - Name: .xdata
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: '0104010004420000'
+ - Name: .pdata
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: '000000000E00000000000000'
+ Relocations:
+ - VirtualAddress: 0
+ SymbolName: '$LN3'
+ Type: IMAGE_REL_AMD64_ADDR32NB
+ - VirtualAddress: 4
+ SymbolName: '$LN3'
+ Type: IMAGE_REL_AMD64_ADDR32NB
+ - VirtualAddress: 8
+ SymbolName: '$unwind$bar'
+ 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: 460
+ NumberOfRelocations: 6
+ 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: 628
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: .bss
+ Value: 0
+ SectionNumber: 4
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 4
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: global
+ Value: 0
+ SectionNumber: 4
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: '.text$mn'
+ Value: 0
+ SectionNumber: 5
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 14
+ NumberOfRelocations: 1
+ NumberOfLinenumbers: 0
+ CheckSum: 1682752513
+ Number: 0
+ - Name: '.text$mn'
+ Value: 0
+ SectionNumber: 6
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 15
+ NumberOfRelocations: 2
+ NumberOfLinenumbers: 0
+ CheckSum: 1746394828
+ Number: 0
+ Selection: IMAGE_COMDAT_SELECT_ANY
+ - Name: '.debug$S'
+ Value: 0
+ SectionNumber: 7
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 148
+ NumberOfRelocations: 4
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 6
+ Selection: IMAGE_COMDAT_SELECT_ASSOCIATIVE
+ - Name: foo
+ Value: 0
+ SectionNumber: 6
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: bar
+ Value: 0
+ SectionNumber: 5
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: '$LN3'
+ Value: 0
+ SectionNumber: 5
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_LABEL
+ - Name: .xdata
+ Value: 0
+ SectionNumber: 8
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 8
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 264583633
+ Number: 0
+ - Name: '$unwind$bar'
+ Value: 0
+ SectionNumber: 8
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: .pdata
+ Value: 0
+ SectionNumber: 9
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 12
+ NumberOfRelocations: 3
+ NumberOfLinenumbers: 0
+ CheckSum: 361370162
+ Number: 0
+ - Name: '$pdata$bar'
+ Value: 0
+ SectionNumber: 9
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+...
diff --git a/test/COFF/Inputs/pdb_comdat_main.yaml b/test/COFF/Inputs/pdb_comdat_main.yaml
new file mode 100644
index 000000000000..d9019d633415
--- /dev/null
+++ b/test/COFF/Inputs/pdb_comdat_main.yaml
@@ -0,0 +1,446 @@
+--- !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\pdb_comdat_main.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:
+ PtrParent: 0
+ PtrEnd: 0
+ PtrNext: 0
+ CodeSize: 24
+ DbgStart: 4
+ DbgEnd: 19
+ FunctionType: 4102
+ Segment: 0
+ Flags: [ ]
+ DisplayName: main
+ - Kind: S_FRAMEPROC
+ FrameProcSym:
+ TotalFrameBytes: 40
+ PaddingFrameBytes: 0
+ OffsetToPadding: 0
+ BytesOfCalleeSavedRegisters: 0
+ OffsetOfExceptionHandler: 0
+ SectionIdOfExceptionHandler: 0
+ Flags: [ AsynchronousExceptionHandling, OptimizedForSpeed ]
+ - Kind: S_PROC_ID_END
+ ScopeEndSym:
+ - !Lines
+ CodeSize: 24
+ Flags: [ ]
+ RelocOffset: 0
+ RelocSegment: 0
+ Blocks:
+ - FileName: 'c:\src\llvm-project\build\pdb_comdat_main.c'
+ Lines:
+ - Offset: 0
+ LineStart: 2
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 4
+ LineStart: 3
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 9
+ LineStart: 4
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 14
+ LineStart: 5
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 19
+ LineStart: 6
+ IsStatement: true
+ EndDelta: 0
+ Columns:
+ - !Symbols
+ Records:
+ - Kind: S_GDATA32
+ DataSym:
+ Type: 116
+ DisplayName: global
+ - !FileChecksums
+ Checksums:
+ - FileName: 'c:\src\llvm-project\build\pdb_comdat_main.c'
+ Kind: MD5
+ Checksum: F969E51BBE373436D81492EB61387F36
+ - FileName: 'c:\src\llvm-project\build\foo.h'
+ Kind: MD5
+ Checksum: D74D834EFAC3AE2B45E606A8320B1D5C
+ - !StringTable
+ Strings:
+ - 'c:\src\llvm-project\build\pdb_comdat_main.c'
+ - 'c:\src\llvm-project\build\foo.h'
+ - !Symbols
+ Records:
+ - Kind: S_BUILDINFO
+ BuildInfoSym:
+ BuildId: 4111
+ Relocations:
+ - VirtualAddress: 168
+ SymbolName: main
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 172
+ 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
+ - VirtualAddress: 304
+ SymbolName: global
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 308
+ SymbolName: global
+ 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_ARGLIST
+ ArgList:
+ ArgIndices: [ 0 ]
+ - Kind: LF_PROCEDURE
+ Procedure:
+ ReturnType: 3
+ CallConv: NearC
+ Options: [ None ]
+ ParameterCount: 0
+ ArgumentList: 4096
+ - Kind: LF_POINTER
+ Pointer:
+ ReferentType: 4097
+ Attrs: 65548
+ - Kind: LF_FUNC_ID
+ FuncId:
+ ParentScope: 0
+ FunctionType: 4097
+ Name: foo
+ - Kind: LF_ARGLIST
+ ArgList:
+ ArgIndices: [ ]
+ - Kind: LF_PROCEDURE
+ Procedure:
+ ReturnType: 116
+ CallConv: NearC
+ Options: [ None ]
+ ParameterCount: 0
+ ArgumentList: 4100
+ - Kind: LF_FUNC_ID
+ FuncId:
+ ParentScope: 0
+ FunctionType: 4101
+ Name: main
+ - Kind: LF_FUNC_ID
+ FuncId:
+ ParentScope: 0
+ FunctionType: 4097
+ Name: bar
+ - 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 -Z7 -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: [ 4106 ]
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 4107
+ String: ' -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\winrt -TC -X'
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 0
+ String: pdb_comdat_main.c
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 0
+ String: 'C:\src\llvm-project\build\vc140.pdb'
+ - Kind: LF_BUILDINFO
+ BuildInfo:
+ ArgIndices: [ 4104, 4105, 4109, 4110, 4108 ]
+ - Name: '.text$mn'
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 16
+ SectionData: 4883EC28E800000000E800000000B82A0000004883C428C3
+ Relocations:
+ - VirtualAddress: 5
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_REL32
+ - VirtualAddress: 10
+ SymbolName: bar
+ 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: 8B0500000000FFC0890500000000C3
+ Relocations:
+ - VirtualAddress: 2
+ SymbolName: global
+ Type: IMAGE_REL_AMD64_REL32
+ - VirtualAddress: 10
+ SymbolName: global
+ Type: IMAGE_REL_AMD64_REL32
+ - Name: '.debug$S'
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
+ Alignment: 1
+ Subsections:
+ - !Symbols
+ Records:
+ - Kind: S_GPROC32_ID
+ ProcSym:
+ PtrParent: 0
+ PtrEnd: 0
+ PtrNext: 0
+ CodeSize: 15
+ DbgStart: 0
+ DbgEnd: 14
+ FunctionType: 4099
+ Segment: 0
+ Flags: [ ]
+ DisplayName: foo
+ - Kind: S_FRAMEPROC
+ FrameProcSym:
+ TotalFrameBytes: 0
+ PaddingFrameBytes: 0
+ OffsetToPadding: 0
+ BytesOfCalleeSavedRegisters: 0
+ OffsetOfExceptionHandler: 0
+ SectionIdOfExceptionHandler: 0
+ Flags: [ MarkedInline, AsynchronousExceptionHandling, OptimizedForSpeed ]
+ - Kind: S_PROC_ID_END
+ ScopeEndSym:
+ - !Lines
+ CodeSize: 15
+ Flags: [ ]
+ RelocOffset: 0
+ RelocSegment: 0
+ Blocks:
+ - FileName: 'c:\src\llvm-project\build\foo.h'
+ Lines:
+ - Offset: 0
+ LineStart: 2
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 0
+ LineStart: 3
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 14
+ LineStart: 4
+ IsStatement: true
+ EndDelta: 0
+ Columns:
+ Relocations:
+ - VirtualAddress: 44
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 48
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECTION
+ - VirtualAddress: 100
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 104
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECTION
+ - Name: .xdata
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: '0104010004420000'
+ - Name: .pdata
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: '000000001800000000000000'
+ 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: 480
+ NumberOfRelocations: 6
+ 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: 648
+ 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: 24
+ NumberOfRelocations: 2
+ NumberOfLinenumbers: 0
+ CheckSum: 492663294
+ Number: 0
+ - Name: '.text$mn'
+ Value: 0
+ SectionNumber: 5
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 15
+ NumberOfRelocations: 2
+ NumberOfLinenumbers: 0
+ CheckSum: 1746394828
+ Number: 0
+ Selection: IMAGE_COMDAT_SELECT_ANY
+ - Name: '.debug$S'
+ Value: 0
+ SectionNumber: 6
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 148
+ NumberOfRelocations: 4
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 5
+ Selection: IMAGE_COMDAT_SELECT_ASSOCIATIVE
+ - Name: foo
+ Value: 0
+ SectionNumber: 5
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: bar
+ 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: 7
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 8
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 264583633
+ Number: 0
+ - Name: '$unwind$main'
+ Value: 0
+ SectionNumber: 7
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: .pdata
+ Value: 0
+ SectionNumber: 8
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 12
+ NumberOfRelocations: 3
+ NumberOfLinenumbers: 0
+ CheckSum: 2942184094
+ Number: 0
+ - Name: '$pdata$main'
+ Value: 0
+ SectionNumber: 8
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: global
+ Value: 0
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
diff --git a/test/COFF/Inputs/pdb_lines_1.yaml b/test/COFF/Inputs/pdb_lines_1.yaml
new file mode 100644
index 000000000000..3fbb2a94d45f
--- /dev/null
+++ b/test/COFF/Inputs/pdb_lines_1.yaml
@@ -0,0 +1,480 @@
+--- !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\pdb_lines_1.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:
+ PtrParent: 0
+ PtrEnd: 0
+ PtrNext: 0
+ CodeSize: 19
+ DbgStart: 4
+ DbgEnd: 14
+ FunctionType: 4102
+ Segment: 0
+ Flags: [ ]
+ DisplayName: main
+ - Kind: S_FRAMEPROC
+ FrameProcSym:
+ TotalFrameBytes: 40
+ PaddingFrameBytes: 0
+ OffsetToPadding: 0
+ BytesOfCalleeSavedRegisters: 0
+ OffsetOfExceptionHandler: 0
+ SectionIdOfExceptionHandler: 0
+ Flags: [ AsynchronousExceptionHandling, OptimizedForSpeed ]
+ - Kind: S_PROC_ID_END
+ ScopeEndSym:
+ - !Lines
+ CodeSize: 19
+ Flags: [ ]
+ RelocOffset: 0
+ RelocSegment: 0
+ Blocks:
+ - FileName: 'c:\src\llvm-project\build\pdb_lines_1.c'
+ Lines:
+ - Offset: 0
+ LineStart: 2
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 4
+ LineStart: 3
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 9
+ LineStart: 4
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 14
+ LineStart: 5
+ IsStatement: true
+ EndDelta: 0
+ Columns:
+ - !FileChecksums
+ Checksums:
+ - FileName: 'c:\src\llvm-project\build\pdb_lines_1.c'
+ Kind: MD5
+ Checksum: 4EB19DCD86C3BA2238A255C718572E7B
+ - FileName: 'c:\src\llvm-project\build\foo.h'
+ Kind: MD5
+ Checksum: 061EB73ABB642532857A4F1D9CBAC323
+ - !StringTable
+ Strings:
+ - 'c:\src\llvm-project\build\pdb_lines_1.c'
+ - 'c:\src\llvm-project\build\foo.h'
+ - !Symbols
+ Records:
+ - Kind: S_BUILDINFO
+ BuildInfoSym:
+ BuildId: 4111
+ Relocations:
+ - VirtualAddress: 164
+ SymbolName: main
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 168
+ SymbolName: main
+ Type: IMAGE_REL_AMD64_SECTION
+ - VirtualAddress: 220
+ SymbolName: main
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 224
+ 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_ARGLIST
+ ArgList:
+ ArgIndices: [ ]
+ - Kind: LF_PROCEDURE
+ Procedure:
+ ReturnType: 3
+ CallConv: NearC
+ Options: [ None ]
+ ParameterCount: 0
+ ArgumentList: 4096
+ - Kind: LF_POINTER
+ Pointer:
+ ReferentType: 4097
+ Attrs: 65548
+ - Kind: LF_FUNC_ID
+ FuncId:
+ ParentScope: 0
+ FunctionType: 4097
+ Name: foo
+ - Kind: LF_ARGLIST
+ ArgList:
+ ArgIndices: [ 0 ]
+ - Kind: LF_PROCEDURE
+ Procedure:
+ ReturnType: 116
+ CallConv: NearC
+ Options: [ None ]
+ ParameterCount: 0
+ ArgumentList: 4100
+ - Kind: LF_FUNC_ID
+ FuncId:
+ ParentScope: 0
+ FunctionType: 4101
+ Name: main
+ - Kind: LF_FUNC_ID
+ FuncId:
+ ParentScope: 0
+ FunctionType: 4097
+ Name: bar
+ - 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 -Z7 -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: [ 4106 ]
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 4107
+ String: ' -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\winrt -TC -X'
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 0
+ String: pdb_lines_1.c
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 0
+ String: 'C:\src\llvm-project\build\vc140.pdb'
+ - Kind: LF_BUILDINFO
+ BuildInfo:
+ ArgIndices: [ 4104, 4105, 4109, 4110, 4108 ]
+ - Name: '.text$mn'
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 16
+ SectionData: 4883EC28E800000000B82A0000004883C428C3
+ Relocations:
+ - VirtualAddress: 5
+ SymbolName: foo
+ 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: 4883EC28E8000000004883C428C3
+ Relocations:
+ - VirtualAddress: 5
+ SymbolName: bar
+ Type: IMAGE_REL_AMD64_REL32
+ - Name: '.debug$S'
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
+ Alignment: 1
+ Subsections:
+ - !Symbols
+ Records:
+ - Kind: S_GPROC32_ID
+ ProcSym:
+ PtrParent: 0
+ PtrEnd: 0
+ PtrNext: 0
+ CodeSize: 14
+ DbgStart: 4
+ DbgEnd: 9
+ FunctionType: 4099
+ Segment: 0
+ Flags: [ ]
+ DisplayName: foo
+ - Kind: S_FRAMEPROC
+ FrameProcSym:
+ TotalFrameBytes: 40
+ PaddingFrameBytes: 0
+ OffsetToPadding: 0
+ BytesOfCalleeSavedRegisters: 0
+ OffsetOfExceptionHandler: 0
+ SectionIdOfExceptionHandler: 0
+ Flags: [ MarkedInline, AsynchronousExceptionHandling, OptimizedForSpeed ]
+ - Kind: S_PROC_ID_END
+ ScopeEndSym:
+ - !Lines
+ CodeSize: 14
+ Flags: [ ]
+ RelocOffset: 0
+ RelocSegment: 0
+ Blocks:
+ - FileName: 'c:\src\llvm-project\build\foo.h'
+ Lines:
+ - Offset: 0
+ LineStart: 2
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 4
+ LineStart: 3
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 9
+ LineStart: 4
+ IsStatement: true
+ EndDelta: 0
+ Columns:
+ Relocations:
+ - VirtualAddress: 44
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 48
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECTION
+ - VirtualAddress: 100
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 104
+ SymbolName: foo
+ Type: IMAGE_REL_AMD64_SECTION
+ - Name: .xdata
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: '0104010004420000'
+ - Name: .pdata
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: '000000000E00000000000000'
+ Relocations:
+ - VirtualAddress: 0
+ SymbolName: '$LN3'
+ Type: IMAGE_REL_AMD64_ADDR32NB
+ - VirtualAddress: 4
+ SymbolName: '$LN3'
+ Type: IMAGE_REL_AMD64_ADDR32NB
+ - VirtualAddress: 8
+ SymbolName: '$unwind$foo'
+ Type: IMAGE_REL_AMD64_ADDR32NB
+ - Name: .xdata
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: '0104010004420000'
+ - Name: .pdata
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: '000000001300000000000000'
+ 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: 432
+ 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: 644
+ 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: 19
+ NumberOfRelocations: 1
+ NumberOfLinenumbers: 0
+ CheckSum: 791570821
+ Number: 0
+ - Name: '.text$mn'
+ Value: 0
+ SectionNumber: 5
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 14
+ NumberOfRelocations: 1
+ NumberOfLinenumbers: 0
+ CheckSum: 1682752513
+ Number: 0
+ Selection: IMAGE_COMDAT_SELECT_ANY
+ - Name: '.debug$S'
+ Value: 0
+ SectionNumber: 6
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 148
+ NumberOfRelocations: 4
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 5
+ Selection: IMAGE_COMDAT_SELECT_ASSOCIATIVE
+ - Name: bar
+ Value: 0
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: foo
+ Value: 0
+ SectionNumber: 5
+ 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: 5
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_LABEL
+ - 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: 7
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 8
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 264583633
+ Number: 5
+ Selection: IMAGE_COMDAT_SELECT_ASSOCIATIVE
+ - Name: '$unwind$foo'
+ Value: 0
+ SectionNumber: 7
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: .pdata
+ Value: 0
+ SectionNumber: 8
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 12
+ NumberOfRelocations: 3
+ NumberOfLinenumbers: 0
+ CheckSum: 361370162
+ Number: 5
+ Selection: IMAGE_COMDAT_SELECT_ASSOCIATIVE
+ - Name: '$pdata$foo'
+ Value: 0
+ SectionNumber: 8
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: .xdata
+ Value: 0
+ SectionNumber: 9
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 8
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 264583633
+ Number: 0
+ - Name: '$unwind$main'
+ Value: 0
+ SectionNumber: 9
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: .pdata
+ Value: 0
+ SectionNumber: 10
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 12
+ NumberOfRelocations: 3
+ NumberOfLinenumbers: 0
+ CheckSum: 4063508168
+ Number: 0
+ - Name: '$pdata$main'
+ Value: 0
+ SectionNumber: 10
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+...
diff --git a/test/COFF/Inputs/pdb_lines_2.yaml b/test/COFF/Inputs/pdb_lines_2.yaml
new file mode 100644
index 000000000000..8ad8d062db58
--- /dev/null
+++ b/test/COFF/Inputs/pdb_lines_2.yaml
@@ -0,0 +1,209 @@
+--- !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\pdb_lines_2.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:
+ PtrParent: 0
+ PtrEnd: 0
+ PtrNext: 0
+ CodeSize: 1
+ DbgStart: 0
+ DbgEnd: 0
+ FunctionType: 4098
+ Segment: 0
+ Flags: [ ]
+ DisplayName: bar
+ - 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: 1
+ Flags: [ ]
+ RelocOffset: 0
+ RelocSegment: 0
+ Blocks:
+ - FileName: 'c:\src\llvm-project\build\pdb_lines_2.c'
+ Lines:
+ - Offset: 0
+ LineStart: 1
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 0
+ LineStart: 2
+ IsStatement: true
+ EndDelta: 0
+ Columns:
+ - !FileChecksums
+ Checksums:
+ - FileName: 'c:\src\llvm-project\build\pdb_lines_2.c'
+ Kind: MD5
+ Checksum: DF91CB3A2B8D917486574BB50CAC4CC7
+ - !StringTable
+ Strings:
+ - 'c:\src\llvm-project\build\pdb_lines_2.c'
+ - !Symbols
+ Records:
+ - Kind: S_BUILDINFO
+ BuildInfoSym:
+ BuildId: 4106
+ Relocations:
+ - VirtualAddress: 164
+ SymbolName: bar
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 168
+ SymbolName: bar
+ Type: IMAGE_REL_AMD64_SECTION
+ - VirtualAddress: 220
+ SymbolName: bar
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 224
+ SymbolName: bar
+ 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_ARGLIST
+ ArgList:
+ ArgIndices: [ ]
+ - Kind: LF_PROCEDURE
+ Procedure:
+ ReturnType: 3
+ CallConv: NearC
+ Options: [ None ]
+ ParameterCount: 0
+ ArgumentList: 4096
+ - Kind: LF_FUNC_ID
+ FuncId:
+ ParentScope: 0
+ FunctionType: 4097
+ Name: bar
+ - 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 -Z7 -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: [ 4101 ]
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 4102
+ String: ' -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\winrt -TC -X'
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 0
+ String: pdb_lines_2.c
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 0
+ String: 'C:\src\llvm-project\build\vc140.pdb'
+ - Kind: LF_BUILDINFO
+ BuildInfo:
+ ArgIndices: [ 4099, 4100, 4104, 4105, 4103 ]
+ - Name: '.text$mn'
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 16
+ SectionData: C3
+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: 568
+ 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: 1
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 40735498
+ Number: 0
+ - Name: bar
+ Value: 0
+ SectionNumber: 4
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
diff --git a/test/COFF/associative-comdat.s b/test/COFF/associative-comdat.s
new file mode 100644
index 000000000000..dd5419533c16
--- /dev/null
+++ b/test/COFF/associative-comdat.s
@@ -0,0 +1,46 @@
+# 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: 1
+# CHECK-LABEL: Name: .data (2E 64 61 74 61 00 00 00)
+# CHECK-NEXT: VirtualSize: 0x4
+# CHECK: Section {
+# 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
+
+ .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
diff --git a/test/COFF/def-name.test b/test/COFF/def-name.test
index c48424a1bff0..b971007eda37 100644
--- a/test/COFF/def-name.test
+++ b/test/COFF/def-name.test
@@ -1,5 +1,3 @@
-# REQUIRES: winres
-
# RUN: rm -rf %t
# RUN: mkdir -p %t
# RUN: cd %t
diff --git a/test/COFF/dll.test b/test/COFF/dll.test
index db4b4056552c..abd39f4eeb24 100644
--- a/test/COFF/dll.test
+++ b/test/COFF/dll.test
@@ -1,5 +1,3 @@
-# REQUIRES: winres
-
# RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj
# RUN: lld-link /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2 \
# RUN: /export:mangled
diff --git a/test/COFF/dllimport-gc.test b/test/COFF/dllimport-gc.test
index 54ae773e793f..d8523fbc7dae 100644
--- a/test/COFF/dllimport-gc.test
+++ b/test/COFF/dllimport-gc.test
@@ -1,5 +1,3 @@
-# REQUIRES: winres
-
# RUN: yaml2obj < %p/Inputs/export.yaml > %t-lib.obj
# RUN: lld-link /out:%t.dll /dll %t-lib.obj /implib:%t.lib /export:exportfn1
diff --git a/test/COFF/guardcf.test b/test/COFF/guardcf.test
new file mode 100644
index 000000000000..4f99d705301c
--- /dev/null
+++ b/test/COFF/guardcf.test
@@ -0,0 +1,74 @@
+# RUN: yaml2obj < %s > %t.obj
+# RUN: lld-link /entry:main /out:%t.exe %t.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: 4
+ SectionData: 000000000000
+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: main
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: __guard_fids_count
+ Value: 0
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: __guard_fids_table
+ Value: 0
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: __guard_flags
+ Value: 0
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: __guard_iat_count
+ Value: 0
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: __guard_iat_table
+ Value: 0
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: __guard_longjmp_count
+ Value: 0
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: __guard_longjmp_table
+ Value: 0
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
diff --git a/test/COFF/hello32.test b/test/COFF/hello32.test
index 66b52378aaa3..9464a3c114eb 100644
--- a/test/COFF/hello32.test
+++ b/test/COFF/hello32.test
@@ -21,7 +21,7 @@ HEADER-NEXT: IMAGE_FILE_EXECUTABLE_IMAGE (0x2)
HEADER-NEXT: ]
HEADER-NEXT: }
HEADER-NEXT: ImageOptionalHeader {
-HEADER-NEXT: MajorLinkerVersion: 0
+HEADER-NEXT: MajorLinkerVersion: 14
HEADER-NEXT: MinorLinkerVersion: 0
HEADER-NEXT: SizeOfCode: 512
HEADER-NEXT: SizeOfInitializedData: 1536
diff --git a/test/COFF/icf-associative.test b/test/COFF/icf-associative.test
index 1c63b05d8f22..bfaeabb4d41a 100644
--- a/test/COFF/icf-associative.test
+++ b/test/COFF/icf-associative.test
@@ -16,7 +16,7 @@ sections:
Alignment: 16
SectionData: 4883EC28E8000000004883C428C3
- - Name: '.debug$S'
+ - Name: '.debug_blah'
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
Alignment: 1
SectionData: 0000000000000000000000000000
@@ -26,7 +26,7 @@ sections:
Alignment: 16
SectionData: 4883EC28E8000000004883C428C3
- - Name: '.debug$S'
+ - Name: '.debug_blah'
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
Alignment: 1
SectionData: FFFFFFFFFFFFFFFFFFFFFFFFFFFF
@@ -46,7 +46,7 @@ symbols:
Number: 0
Selection: IMAGE_COMDAT_SELECT_ANY
- - Name: '.debug$S'
+ - Name: '.debug_blah'
Value: 0
SectionNumber: 2
SimpleType: IMAGE_SYM_TYPE_NULL
@@ -74,7 +74,7 @@ symbols:
Number: 0
Selection: IMAGE_COMDAT_SELECT_ANY
- - Name: '.debug$S'
+ - Name: '.debug_blah'
Value: 0
SectionNumber: 4
SimpleType: IMAGE_SYM_TYPE_NULL
diff --git a/test/COFF/manifestinput.test b/test/COFF/manifestinput.test
index 376d404d604c..4eb1730bb0e4 100644
--- a/test/COFF/manifestinput.test
+++ b/test/COFF/manifestinput.test
@@ -1,4 +1,4 @@
-# REQUIRES: winres
+# REQUIRES: win_mt
# RUN: yaml2obj %p/Inputs/ret42.yaml > %t.obj
# RUN: lld-link /out:%t.exe /entry:main \
@@ -8,3 +8,28 @@
CHECK: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
CHECK: <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><dependency><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity></dependentAssembly></dependency><trustInfo><security><requestedPrivileges><requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel></requestedPrivileges></security></trustInfo></assembly>
+
+# RUN: yaml2obj %p/Inputs/ret42.yaml > %t.obj
+# RUN: lld-link /out:%t.exe /entry:main \
+# RUN: /manifest:embed \
+# RUN: /manifestuac:"level='requireAdministrator'" \
+# RUN: /manifestinput:%p/Inputs/manifestinput.test %t.obj
+# RUN: llvm-readobj -coff-resources -file-headers %t.exe | FileCheck %s \
+# RUN: -check-prefix TEST_EMBED
+
+TEST_EMBED: ResourceTableRVA: 0x1000
+TEST_EMBED-NEXT: ResourceTableSize: 0x298
+TEST_EMBED-DAG: Resources [
+TEST_EMBED-NEXT: Total Number of Resources: 1
+TEST_EMBED-DAG: Number of String Entries: 0
+TEST_EMBED-NEXT: Number of ID Entries: 1
+TEST_EMBED-NEXT: Type: kRT_MANIFEST (ID 24) [
+TEST_EMBED-NEXT: Table Offset: 0x18
+TEST_EMBED-NEXT: Number of String Entries: 0
+TEST_EMBED-NEXT: Number of ID Entries: 1
+TEST_EMBED-NEXT: Name: (ID 1) [
+TEST_EMBED-NEXT: Table Offset: 0x30
+TEST_EMBED-NEXT: Number of String Entries: 0
+TEST_EMBED-NEXT: Number of ID Entries: 1
+TEST_EMBED-NEXT: Language: (ID 1033) [
+TEST_EMBED-NEXT: Entry Offset: 0x48
diff --git a/test/COFF/noentry.test b/test/COFF/noentry.test
index 5e241e46e897..cc02c85e7010 100644
--- a/test/COFF/noentry.test
+++ b/test/COFF/noentry.test
@@ -1,5 +1,3 @@
-# REQUIRES: winres
-
# RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj
# RUN: lld-link /out:%t.dll /dll %t.obj
# RUN: llvm-readobj -file-headers %t.dll | FileCheck -check-prefix=ENTRY %s
diff --git a/test/COFF/out.test b/test/COFF/out.test
index 67b2ef01b711..a7b56145996f 100644
--- a/test/COFF/out.test
+++ b/test/COFF/out.test
@@ -1,4 +1,3 @@
-# REQUIRES: winres
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
# RUN: mkdir -p %T/out/tmp
diff --git a/test/COFF/pdb-comdat.test b/test/COFF/pdb-comdat.test
new file mode 100644
index 000000000000..769b630d0e8d
--- /dev/null
+++ b/test/COFF/pdb-comdat.test
@@ -0,0 +1,100 @@
+Consider this example program with an inline function "foo":
+
+==> foo.h <==
+extern int global;
+__inline void foo() {
+ ++global;
+}
+void bar();
+==> pdb_comdat_main.c <==
+#include "foo.h"
+int main(void) {
+ foo();
+ bar();
+ return 42;
+}
+==> pdb_comdat_bar.c <==
+#include "foo.h"
+void bar(void) {
+ foo();
+}
+
+Both object files will contain debug info for foo, but only the debug info from
+pdb_comdat_main.obj should be included in the PDB.
+
+RUN: rm -rf %t && mkdir -p %t && cd %t
+RUN: yaml2obj %S/Inputs/pdb_comdat_main.yaml -o pdb_comdat_main.obj
+RUN: yaml2obj %S/Inputs/pdb_comdat_bar.yaml -o pdb_comdat_bar.obj
+RUN: lld-link pdb_comdat_main.obj pdb_comdat_bar.obj -out:t.exe -debug -pdb:t.pdb -nodefaultlib -entry:main
+RUN: llvm-pdbutil dump -l -symbols t.pdb | FileCheck %s
+
+CHECK: Lines
+CHECK: ============================================================
+CHECK-LABEL: Mod 0000 | `{{.*}}pdb_comdat_main.obj`:
+CHECK: c:\src\llvm-project\build\pdb_comdat_main.c (MD5: F969E51BBE373436D81492EB61387F36)
+CHECK: c:\src\llvm-project\build\foo.h (MD5: D74D834EFAC3AE2B45E606A8320B1D5C)
+CHECK-LABEL: Mod 0001 | `{{.*}}pdb_comdat_bar.obj`:
+CHECK: c:\src\llvm-project\build\pdb_comdat_bar.c (MD5: 365279DB4FCBEDD721BBFC3B14A953C2)
+CHECK-NOT: c:\src\llvm-project\build\foo.h
+CHECK-LABEL: Mod 0002 | `* Linker *`:
+
+CHECK: Symbols
+CHECK: ============================================================
+CHECK-LABEL: Mod 0000 | `{{.*}}pdb_comdat_main.obj`:
+CHECK: - S_OBJNAME [size = 56] sig=0, `C:\src\llvm-project\build\pdb_comdat_main.obj`
+CHECK: - 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: - S_GPROC32_ID [size = 44] `main`
+ FIXME: We need to fill in "end".
+CHECK: parent = 0, addr = 0002:0000, code size = 24, end = 0
+CHECK: debug start = 4, debug end = 19, flags = none
+CHECK: - S_FRAMEPROC [size = 32]
+CHECK: size = 40, 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: - S_END [size = 4]
+CHECK: - S_GDATA32 [size = 24] `global`
+CHECK: type = 0x0074 (int), addr = 0000:0000
+CHECK: - S_BUILDINFO [size = 8] BuildId = `4106`
+CHECK: - S_GPROC32_ID [size = 44] `foo`
+CHECK: parent = 0, addr = 0002:0032, code size = 15, end = 0
+CHECK: debug start = 0, debug end = 14, flags = none
+CHECK: - 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 = marked inline | has async eh | opt speed
+CHECK: - S_END [size = 4]
+CHECK-LABEL: Mod 0001 | `{{.*}}pdb_comdat_bar.obj`:
+CHECK: - S_OBJNAME [size = 56] sig=0, `C:\src\llvm-project\build\pdb_comdat_bar.obj`
+CHECK: - 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: - S_GPROC32_ID [size = 44] `bar`
+CHECK: parent = 0, addr = 0002:0048, code size = 14, end = 0
+CHECK: debug start = 4, debug end = 9, flags = none
+CHECK: - S_FRAMEPROC [size = 32]
+CHECK: size = 40, 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: - S_END [size = 4]
+CHECK: - S_GDATA32 [size = 24] `global`
+CHECK: type = 0x0074 (int), addr = 0000:0000
+CHECK: - S_BUILDINFO [size = 8] BuildId = `4109`
+CHECK-NOT: - S_GPROC32_ID {{.*}} `foo`
+CHECK-LABEL: Mod 0002 | `* Linker *`:
+
+Reorder the object files and verify that the other table is selected.
+
+RUN: lld-link pdb_comdat_bar.obj pdb_comdat_main.obj -out:t.exe -debug -pdb:t.pdb -nodefaultlib -entry:main
+RUN: llvm-pdbutil dump -l t.pdb | FileCheck %s --check-prefix=REORDER
+
+REORDER-LABEL: Mod 0000 | `{{.*}}pdb_comdat_bar.obj`:
+REORDER: c:\src\llvm-project\build\pdb_comdat_bar.c (MD5: 365279DB4FCBEDD721BBFC3B14A953C2)
+REORDER: c:\src\llvm-project\build\foo.h (MD5: D74D834EFAC3AE2B45E606A8320B1D5C)
+REORDER-LABEL: Mod 0001 | `{{.*}}pdb_comdat_main.obj`:
+REORDER: c:\src\llvm-project\build\pdb_comdat_main.c
+REORDER-NOT: c:\src\llvm-project\build\foo.h
+REORDER-LABEL: Mod 0002 | `* Linker *`:
diff --git a/test/COFF/pdb-lib.s b/test/COFF/pdb-lib.s
index 073c6f08abf8..47375cc26ff2 100644
--- a/test/COFF/pdb-lib.s
+++ b/test/COFF/pdb-lib.s
@@ -3,7 +3,7 @@
# RUN: llc %S/Inputs/bar.ll -filetype=obj -mtriple=i686-windows-msvc -o bar.obj
# RUN: llvm-lib bar.obj -out:bar.lib
# RUN: lld-link -debug -pdb:foo.pdb foo.obj bar.lib -out:foo.exe -entry:main
-# RUN: llvm-pdbutil raw -modules %t/foo.pdb | FileCheck %s
+# RUN: llvm-pdbutil dump -modules %t/foo.pdb | FileCheck %s
# Make sure that the PDB has module descriptors. foo.obj and bar.lib should be
# absolute paths, and bar.obj should be the relative path passed to llvm-lib.
diff --git a/test/COFF/pdb-safeseh.yaml b/test/COFF/pdb-safeseh.yaml
new file mode 100644
index 000000000000..9faa5042924d
--- /dev/null
+++ b/test/COFF/pdb-safeseh.yaml
@@ -0,0 +1,85 @@
+# RUN: yaml2obj %s -o %t.obj
+# RUN: lld-link -debug -entry:main -out:%t.exe -pdb:%t.pdb %t.obj
+# RUN: llvm-pdbutil dump -symbols %t.pdb | FileCheck %s
+
+# There is an S_GDATA32 symbol record with .secrel32 and .secidx relocations in
+# it in this debug info. This is similar to the relocations in the loadcfg.obj
+# file in the MSVC CRT. We need to make sure that our relocation logic matches
+# MSVC's for these absolute, linker-provided symbols.
+
+# CHECK: Mod 0000 |
+# CHECK-NEXT: - S_GDATA32 [size = 40] `___safe_se_handler_table`
+# CHECK-NEXT: type = 0x0022 (unsigned long), addr = 0003:0000
+# CHECK-NEXT: Mod 0001 | `* Linker *`:
+
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_I386
+ 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: 34
+ DisplayName: ___safe_se_handler_table
+ - !StringTable
+ Strings:
+ Relocations:
+ - VirtualAddress: 20
+ SymbolName: ___safe_se_handler_table
+ Type: IMAGE_REL_I386_SECREL
+ - VirtualAddress: 24
+ SymbolName: ___safe_se_handler_table
+ Type: IMAGE_REL_I386_SECTION
+ - Name: '.text$mn'
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 16
+ SectionData: 488D0500000000C3
+ Relocations:
+ - VirtualAddress: 3
+ SymbolName: ___safe_se_handler_table
+ Type: IMAGE_REL_I386_REL32
+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: 372
+ NumberOfRelocations: 6
+ 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: 8
+ NumberOfRelocations: 1
+ NumberOfLinenumbers: 0
+ CheckSum: 1092178131
+ Number: 0
+ - Name: _main
+ Value: 0
+ SectionNumber: 2
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: ___safe_se_handler_table
+ Value: 0
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
+
diff --git a/test/COFF/pdb-secrel-absolute.yaml b/test/COFF/pdb-secrel-absolute.yaml
new file mode 100644
index 000000000000..d74f07e32b98
--- /dev/null
+++ b/test/COFF/pdb-secrel-absolute.yaml
@@ -0,0 +1,84 @@
+# RUN: yaml2obj %s -o %t.obj
+# RUN: lld-link -debug -entry:main -out:%t.exe -pdb:%t.pdb %t.obj
+# RUN: llvm-pdbutil dump -symbols %t.pdb | FileCheck %s
+
+# There is an S_GDATA32 symbol record with .secrel32 and .secidx relocations in
+# it in this debug info. This is similar to the relocations in the loadcfg.obj
+# file in the MSVC CRT. We need to make sure that our relocation logic matches
+# MSVC's for these absolute, linker-provided symbols.
+
+# CHECK: Mod 0000 |
+# CHECK-NEXT: - S_GDATA32 [size = 36] `__guard_fids_table`
+# CHECK-NEXT: type = 0x0022 (unsigned long), addr = 0003:0000
+# CHECK-NEXT: Mod 0001 | `* 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: 34
+ DisplayName: __guard_fids_table
+ - !StringTable
+ Strings:
+ Relocations:
+ - VirtualAddress: 20
+ SymbolName: __guard_fids_table
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 24
+ SymbolName: __guard_fids_table
+ Type: IMAGE_REL_AMD64_SECTION
+ - Name: '.text$mn'
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 16
+ SectionData: 488D0500000000C3
+ Relocations:
+ - VirtualAddress: 3
+ SymbolName: __guard_fids_table
+ Type: IMAGE_REL_AMD64_REL32
+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: 372
+ NumberOfRelocations: 6
+ 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: 8
+ NumberOfRelocations: 1
+ NumberOfLinenumbers: 0
+ CheckSum: 1092178131
+ Number: 0
+ - Name: main
+ Value: 0
+ SectionNumber: 2
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: __guard_fids_table
+ Value: 0
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
diff --git a/test/COFF/pdb-source-lines.test b/test/COFF/pdb-source-lines.test
new file mode 100644
index 000000000000..a630ecb22d62
--- /dev/null
+++ b/test/COFF/pdb-source-lines.test
@@ -0,0 +1,124 @@
+Test the linker line tables on roughly the following example:
+
+==> foo.h <==
+void bar(void);
+inline void foo(void) {
+ bar();
+}
+==> pdb_lines_1.c <==
+#include "foo.h"
+int main(void) {
+ foo();
+ return 42;
+}
+==> pdb_lines_2.c <==
+void bar(void) {
+}
+
+$ cl -c -Z7 pdb_lines*.c
+
+RUN: yaml2obj %S/Inputs/pdb_lines_1.yaml -o %t.pdb_lines_1.obj
+RUN: yaml2obj %S/Inputs/pdb_lines_2.yaml -o %t.pdb_lines_2.obj
+RUN: lld-link -debug -entry:main -nodefaultlib -out:%t.exe -pdb:%t.pdb %t.pdb_lines_1.obj %t.pdb_lines_2.obj
+RUN: llvm-pdbutil pdb2yaml -modules -module-files -subsections=lines,fc %t.pdb | FileCheck %s
+
+CHECK-LABEL: DbiStream:
+CHECK-NEXT: VerHeader: V110
+CHECK-NEXT: Age: 1
+CHECK-NEXT: BuildNumber: 0
+CHECK-NEXT: PdbDllVersion: 0
+CHECK-NEXT: PdbDllRbld: 0
+CHECK-NEXT: Flags: 0
+CHECK-NEXT: MachineType: x86
+CHECK-NEXT: Modules:
+
+CHECK-LABEL: - Module: {{.*}}pdb_lines_1.obj
+CHECK-NEXT: ObjFile: {{.*}}pdb_lines_1.obj
+CHECK-NEXT: SourceFiles:
+CHECK-NEXT: - '{{.*}}pdb_lines_1.c'
+CHECK-NEXT: - '{{.*}}foo.h'
+CHECK-NEXT: Subsections:
+CHECK-NEXT: - !Lines
+CHECK-NEXT: CodeSize: 19
+CHECK-NEXT: Flags: [ ]
+CHECK-NEXT: RelocOffset: 0
+CHECK-NEXT: RelocSegment: 2
+CHECK-NEXT: Blocks:
+CHECK-NEXT: - FileName: '{{.*}}pdb_lines_1.c'
+CHECK-NEXT: Lines:
+CHECK-NEXT: - Offset: 0
+CHECK-NEXT: LineStart: 2
+CHECK-NEXT: IsStatement: true
+CHECK-NEXT: EndDelta: 0
+CHECK-NEXT: - Offset: 4
+CHECK-NEXT: LineStart: 3
+CHECK-NEXT: IsStatement: true
+CHECK-NEXT: EndDelta: 0
+CHECK-NEXT: - Offset: 9
+CHECK-NEXT: LineStart: 4
+CHECK-NEXT: IsStatement: true
+CHECK-NEXT: EndDelta: 0
+CHECK-NEXT: - Offset: 14
+CHECK-NEXT: LineStart: 5
+CHECK-NEXT: IsStatement: true
+CHECK-NEXT: EndDelta: 0
+CHECK-NEXT: Columns:
+CHECK-NEXT: - !FileChecksums
+CHECK-NEXT: Checksums:
+CHECK-NEXT: - FileName: '{{.*}}pdb_lines_1.c'
+CHECK-NEXT: Kind: MD5
+CHECK-NEXT: Checksum: 4EB19DCD86C3BA2238A255C718572E7B
+CHECK-NEXT: - FileName: '{{.*}}foo.h'
+CHECK-NEXT: Kind: MD5
+CHECK-NEXT: Checksum: 061EB73ABB642532857A4F1D9CBAC323
+CHECK-NEXT: - !Lines
+CHECK-NEXT: CodeSize: 14
+CHECK-NEXT: Flags: [ ]
+CHECK-NEXT: RelocOffset: 32
+CHECK-NEXT: RelocSegment: 2
+CHECK-NEXT: Blocks:
+CHECK-NEXT: - FileName: '{{.*}}foo.h'
+CHECK-NEXT: Lines:
+CHECK-NEXT: - Offset: 0
+CHECK-NEXT: LineStart: 2
+CHECK-NEXT: IsStatement: true
+CHECK-NEXT: EndDelta: 0
+CHECK-NEXT: - Offset: 4
+CHECK-NEXT: LineStart: 3
+CHECK-NEXT: IsStatement: true
+CHECK-NEXT: EndDelta: 0
+CHECK-NEXT: - Offset: 9
+CHECK-NEXT: LineStart: 4
+CHECK-NEXT: IsStatement: true
+CHECK-NEXT: EndDelta: 0
+CHECK-NEXT: Columns:
+
+CHECK-LABEL: - Module: {{.*}}pdb_lines_2.obj
+CHECK-NEXT: ObjFile: {{.*}}pdb_lines_2.obj
+CHECK-NEXT: SourceFiles:
+CHECK-NEXT: - '{{.*}}pdb_lines_2.c'
+CHECK-NEXT: Subsections:
+CHECK-NEXT: - !Lines
+CHECK-NEXT: CodeSize: 1
+CHECK-NEXT: Flags: [ ]
+CHECK-NEXT: RelocOffset: 48
+CHECK-NEXT: RelocSegment: 2
+CHECK-NEXT: Blocks:
+CHECK-NEXT: - FileName: '{{.*}}pdb_lines_2.c'
+CHECK-NEXT: Lines:
+CHECK-NEXT: - Offset: 0
+CHECK-NEXT: LineStart: 1
+CHECK-NEXT: IsStatement: true
+CHECK-NEXT: EndDelta: 0
+CHECK-NEXT: - Offset: 0
+CHECK-NEXT: LineStart: 2
+CHECK-NEXT: IsStatement: true
+CHECK-NEXT: EndDelta: 0
+CHECK-NEXT: Columns:
+CHECK-NEXT: - !FileChecksums
+CHECK-NEXT: Checksums:
+CHECK-NEXT: - FileName: '{{.*}}pdb_lines_2.c'
+CHECK-NEXT: Kind: MD5
+CHECK-NEXT: Checksum: DF91CB3A2B8D917486574BB50CAC4CC7
+CHECK-NEXT: - Module: '* Linker *'
+CHECK-NEXT: ObjFile: ''
diff --git a/test/COFF/pdb-symbol-types.yaml b/test/COFF/pdb-symbol-types.yaml
new file mode 100644
index 000000000000..4951aa8be379
--- /dev/null
+++ b/test/COFF/pdb-symbol-types.yaml
@@ -0,0 +1,344 @@
+# RUN: yaml2obj %s -o %t.obj
+# RUN: lld-link %t.obj -nodefaultlib -entry:main -debug -out:%t.exe -pdb:%t.pdb
+# RUN: llvm-pdbutil dump -symbols %t.pdb | FileCheck %s
+
+# To regenerate the object file:
+# $ cat symbol-types.c
+# struct Foo { int x; };
+# typedef struct Foo UDT_Foo;
+# UDT_Foo global_foo = {42};
+# int main() { return global_foo.x; }
+# $ cl -c -Z7 symbol-types.c
+
+# Note that the type of 'global' goes from 0x1005 in the object file to 0x1004
+# in the PDB because the LF_FUNC_ID is moved to the id stream.
+
+# CHECK: Symbols
+# CHECK: ============================================================
+# CHECK-LABEL: Mod 0000 | `{{.*}}pdb-symbol-types.yaml.tmp.obj`:
+# CHECK: - S_OBJNAME [size = 52] sig=0, `C:\src\llvm-project\build\symbol-types.obj`
+# CHECK: - 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: - S_GPROC32_ID [size = 44] `main`
+# CHECK: parent = 0, addr = 0002:0000, code size = 7, end = 0
+# CHECK: debug start = 0, debug end = 6, flags = none
+# CHECK: - 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: - S_END [size = 4]
+# CHECK: - S_GDATA32 [size = 28] `global_foo`
+# CHECK: type = 0x1004 (Foo), addr = 0001:0000
+# CHECK: - S_UDT [size = 16] `UDT_Foo`
+# CHECK: original type = 0x1004
+# CHECK: - S_UDT [size = 12] `Foo`
+# CHECK: original type = 0x1004
+# CHECK: - S_BUILDINFO [size = 8] BuildId = `4106`
+# CHECK-LABEL: Mod 0001 | `* Linker *`:
+
+--- !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\symbol-types.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: 7
+ DbgStart: 0
+ DbgEnd: 6
+ FunctionType: 4098
+ 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: 7
+ Flags: [ ]
+ RelocOffset: 0
+ RelocSegment: 0
+ Blocks:
+ - FileName: 'c:\src\llvm-project\build\symbol-types.c'
+ Lines:
+ - Offset: 0
+ LineStart: 4
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 0
+ LineStart: 5
+ IsStatement: true
+ EndDelta: 0
+ - Offset: 6
+ LineStart: 6
+ IsStatement: true
+ EndDelta: 0
+ Columns:
+ - !Symbols
+ Records:
+ - Kind: S_GDATA32
+ DataSym:
+ Type: 4101
+ DisplayName: global_foo
+ - Kind: S_UDT
+ UDTSym:
+ Type: 4101
+ UDTName: UDT_Foo
+ - Kind: S_UDT
+ UDTSym:
+ Type: 4101
+ UDTName: Foo
+ - !FileChecksums
+ Checksums:
+ - FileName: 'c:\src\llvm-project\build\symbol-types.c'
+ Kind: MD5
+ Checksum: F833E1A4909FF6FEC5689A664F3BE725
+ - !StringTable
+ Strings:
+ - 'c:\src\llvm-project\build\symbol-types.c'
+ - !Symbols
+ Records:
+ - Kind: S_BUILDINFO
+ BuildInfoSym:
+ BuildId: 4111
+ Relocations:
+ - VirtualAddress: 164
+ SymbolName: main
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 168
+ SymbolName: main
+ Type: IMAGE_REL_AMD64_SECTION
+ - VirtualAddress: 220
+ SymbolName: main
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 224
+ SymbolName: main
+ Type: IMAGE_REL_AMD64_SECTION
+ - VirtualAddress: 284
+ SymbolName: global_foo
+ Type: IMAGE_REL_AMD64_SECREL
+ - VirtualAddress: 288
+ SymbolName: global_foo
+ 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_ARGLIST
+ ArgList:
+ ArgIndices: [ 0 ]
+ - Kind: LF_PROCEDURE
+ Procedure:
+ ReturnType: 116
+ CallConv: NearC
+ Options: [ None ]
+ ParameterCount: 0
+ ArgumentList: 4096
+ - Kind: LF_FUNC_ID
+ FuncId:
+ ParentScope: 0
+ FunctionType: 4097
+ Name: main
+ - Kind: LF_STRUCTURE
+ Class:
+ MemberCount: 0
+ Options: [ None, ForwardReference, HasUniqueName ]
+ FieldList: 0
+ Name: Foo
+ UniqueName: '.?AUFoo@@'
+ DerivationList: 0
+ VTableShape: 0
+ Size: 0
+ - 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: 4100
+ Name: Foo
+ UniqueName: '.?AUFoo@@'
+ DerivationList: 0
+ VTableShape: 0
+ Size: 4
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 0
+ String: 'c:\src\llvm-project\build\symbol-types.c'
+ - Kind: LF_UDT_SRC_LINE
+ UdtSourceLine:
+ UDT: 4101
+ SourceFile: 4102
+ LineNumber: 1
+ - 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 -Z7 -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: [ 4106 ]
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 4107
+ String: ' -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\winrt -TC -X'
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 0
+ String: symbol-types.c
+ - Kind: LF_STRING_ID
+ StringId:
+ Id: 0
+ String: 'C:\src\llvm-project\build\vc140.pdb'
+ - Kind: LF_BUILDINFO
+ BuildInfo:
+ ArgIndices: [ 4104, 4105, 4109, 4110, 4108 ]
+ - Name: .data
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+ Alignment: 4
+ SectionData: 2A000000
+ - Name: '.text$mn'
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 16
+ SectionData: 8B0500000000C3
+ Relocations:
+ - VirtualAddress: 2
+ SymbolName: global_foo
+ Type: IMAGE_REL_AMD64_REL32
+symbols:
+ - Name: '@comp.id'
+ Value: 17063575
+ SectionNumber: -1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: '@feat.00'
+ Value: 2147484048
+ SectionNumber: -1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - 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: 432
+ NumberOfRelocations: 6
+ 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: 732
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: .data
+ Value: 0
+ SectionNumber: 4
+ 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: 0
+ - Name: global_foo
+ Value: 0
+ SectionNumber: 4
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: '.text$mn'
+ Value: 0
+ SectionNumber: 5
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 7
+ NumberOfRelocations: 1
+ NumberOfLinenumbers: 0
+ CheckSum: 3635526833
+ Number: 0
+ - Name: main
+ Value: 0
+ SectionNumber: 5
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
diff --git a/test/COFF/pdb.test b/test/COFF/pdb.test
index c2881669d358..3acb7188df49 100644
--- a/test/COFF/pdb.test
+++ b/test/COFF/pdb.test
@@ -6,7 +6,7 @@
# RUN: llvm-pdbutil pdb2yaml -stream-metadata -stream-directory -pdb-stream \
# RUN: -dbi-stream -ipi-stream -tpi-stream %t.pdb | FileCheck %s
-# RUN: llvm-pdbutil raw -modules -section-map -section-contribs \
+# RUN: llvm-pdbutil dump -modules -section-map -section-contribs \
# RUN: -types -ids %t.pdb | FileCheck -check-prefix RAW %s
# CHECK: MSF:
@@ -22,7 +22,7 @@
# CHECK-NEXT: NumStreams:
# CHECK-NEXT: FileSize:
# CHECK-NEXT: StreamSizes:
-# CHECK-NEXT: StreamMap:
+# CHECK: StreamMap:
# CHECK: PdbStream:
# CHECK-NEXT: Age: 1
# CHECK-NEXT: Guid:
@@ -119,10 +119,10 @@ RAW: Modules
RAW-NEXT: ============================================================
RAW-NEXT: Mod 0000 | Name: `{{.*}}pdb.test.tmp1.obj`:
RAW-NEXT: Obj: `{{.*}}pdb.test.tmp1.obj`:
-RAW-NEXT: debug stream: 9, # files: 0, has ec info: false
+RAW-NEXT: debug stream: 9, # files: 1, has ec info: false
RAW-NEXT: Mod 0001 | Name: `{{.*}}pdb.test.tmp2.obj`:
RAW-NEXT: Obj: `{{.*}}pdb.test.tmp2.obj`:
-RAW-NEXT: debug stream: 10, # files: 0, has ec info: false
+RAW-NEXT: debug stream: 10, # files: 1, has ec info: false
RAW-NEXT: Mod 0002 | Name: `* Linker *`:
RAW-NEXT: Obj: ``:
RAW-NEXT: debug stream: 11, # files: 0, has ec info: false
diff --git a/test/COFF/resource.test b/test/COFF/resource.test
index 7b6090d89f65..a73a20258201 100644
--- a/test/COFF/resource.test
+++ b/test/COFF/resource.test
@@ -1,5 +1,3 @@
-# REQUIRES: winres
-
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
# RUN: lld-link /out:%t.exe /entry:main %t.obj %p/Inputs/resource.res
diff --git a/test/COFF/safeseh.test b/test/COFF/safeseh-diag-feat.test
index ed928a51350a..ed928a51350a 100644
--- a/test/COFF/safeseh.test
+++ b/test/COFF/safeseh-diag-feat.test
diff --git a/test/COFF/safeseh.s b/test/COFF/safeseh.s
new file mode 100644
index 000000000000..83c15afbf938
--- /dev/null
+++ b/test/COFF/safeseh.s
@@ -0,0 +1,60 @@
+# 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-load-config %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-load-config %t.exe | FileCheck %s --check-prefix=CHECK-GC
+
+# CHECK-NOGC: LoadConfig [
+# CHECK-NOGC: Size: 0x48
+# CHECK-NOGC: SEHandlerTable: 0x401048
+# CHECK-NOGC: SEHandlerCount: 1
+# CHECK-NOGC: ]
+# CHECK-NOGC: SEHTable [
+# CHECK-NOGC-NEXT: 0x402006
+# CHECK-NOGC-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
diff --git a/test/COFF/secidx-absolute.s b/test/COFF/secidx-absolute.s
new file mode 100644
index 000000000000..bfe7136b31d2
--- /dev/null
+++ b/test/COFF/secidx-absolute.s
@@ -0,0 +1,33 @@
+# 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: .rdata (2E 72 64 61 74 61 00 00)
+# CHECK: SectionData (
+# CHECK: 0000: 0300 |..|
+# CHECK: )
+# CHECK: }
+# CHECK: Section {
+# CHECK: Number: 2
+# CHECK: Name: .text (2E 74 65 78 74 00 00 00)
+# CHECK: VirtualSize: 0x1
+# CHECK: SectionData (
+# CHECK: 0000: C3 |.|
+# CHECK: )
+# CHECK: }
+# CHECK-NOT: Section
+# CHECK: ]
diff --git a/test/COFF/secrel-absolute.s b/test/COFF/secrel-absolute.s
new file mode 100644
index 000000000000..69b5ab92991b
--- /dev/null
+++ b/test/COFF/secrel-absolute.s
@@ -0,0 +1,14 @@
+# 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 points to a non-regular symbol: __guard_fids_table
+
+.text
+.global main
+main:
+ret
+
+.section .rdata,"dr"
+.secrel32 __guard_fids_table
diff --git a/test/COFF/secrel-common.s b/test/COFF/secrel-common.s
new file mode 100644
index 000000000000..0188f6cb9674
--- /dev/null
+++ b/test/COFF/secrel-common.s
@@ -0,0 +1,41 @@
+# 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.
+
+# CHECK: Sections [
+# CHECK: Section {
+# CHECK: Number: 1
+# CHECK: Name: .bss (2E 62 73 73 00 00 00 00)
+# CHECK: VirtualSize: 0x4
+# CHECK: }
+# CHECK: Section {
+# CHECK: Number: 2
+# CHECK: Name: .rdata (2E 72 64 61 74 61 00 00)
+# CHECK: SectionData (
+# CHECK: 0000: 00000000 01000000 |........|
+# CHECK: )
+# CHECK: }
+# CHECK: Section {
+# CHECK: Number: 3
+# CHECK: Name: .text (2E 74 65 78 74 00 00 00)
+# CHECK: VirtualSize: 0x1
+# CHECK: SectionData (
+# CHECK: 0000: C3 |.|
+# CHECK: )
+# 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
diff --git a/test/ELF/Inputs/exclude-libs.s b/test/ELF/Inputs/exclude-libs.s
new file mode 100644
index 000000000000..6d05c5e3aa91
--- /dev/null
+++ b/test/ELF/Inputs/exclude-libs.s
@@ -0,0 +1,3 @@
+.globl fn
+fn:
+ nop
diff --git a/test/ELF/arm-gnu-ifunc-plt.s b/test/ELF/arm-gnu-ifunc-plt.s
index 2561a4d34bed..efcaee1e9889 100644
--- a/test/ELF/arm-gnu-ifunc-plt.s
+++ b/test/ELF/arm-gnu-ifunc-plt.s
@@ -61,9 +61,9 @@
// DISASM: $d:
// DISASM-NEXT: 11050: c0 0f 00 00 .word 0x00000fc0
// Alignment to 16 byte boundary not strictly necessary on ARM, but harmless
-// DISASM-NEXT: 11054: 00 00 00 00 .word 0x00000000
-// DISASM-NEXT: 11058: 00 00 00 00 .word 0x00000000
-// DISASM-NEXT: 1105c: 00 00 00 00 .word 0x00000000
+// DISASM-NEXT: 11054: d4 d4 d4 d4 .word 0xd4d4d4d4
+// DISASM-NEXT: 11058: d4 d4 d4 d4 .word 0xd4d4d4d4
+// DISASM-NEXT: 1105c: d4 d4 d4 d4 .word 0xd4d4d4d4
// DISASM: $a:
// DISASM-NEXT: 11060: 04 c0 9f e5 ldr r12, [pc, #4]
// DISASM-NEXT: 11064: 0f c0 8c e0 add r12, r12, pc
diff --git a/test/ELF/arm-got-relative.s b/test/ELF/arm-got-relative.s
index db76711fe68e..46a3ca97d080 100644
--- a/test/ELF/arm-got-relative.s
+++ b/test/ELF/arm-got-relative.s
@@ -16,9 +16,9 @@ _start:
bx lr
.align 2
.LGOT:
- // gas implicitly uses (GOT_PREL) for _GLOBAL_OFFSET_TABLE_ in PIC
- // llvm-mc needs the (GOT_PREL) suffix or it generates R_ARM_REL32
- .word _GLOBAL_OFFSET_TABLE_(GOT_PREL) - (.LPIC+8)
+ // gas implicitly uses (R_ARM_BASE_PREL) for _GLOBAL_OFFSET_TABLE_ in PIC
+ // llvm-mc generates R_ARM_REL32, this will need updating when MC changes
+ .word _GLOBAL_OFFSET_TABLE_ - (.LPIC+8)
.word function(GOT)
.globl function
@@ -28,17 +28,17 @@ function:
bx lr
// CHECK: Dynamic Relocations {
-// CHECK-NEXT: 0x204C R_ARM_GLOB_DAT function 0x0
+// CHECK-NEXT: 0x2048 R_ARM_GLOB_DAT function 0x0
// CHECK: Name: _GLOBAL_OFFSET_TABLE_
-// CHECK-NEXT: Value: 0x0
+// CHECK-NEXT: Value: 0x2048
// CHECK-NEXT: Size:
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other [
// CHECK-NEXT: STV_HIDDEN
// CHECK-NEXT: ]
-// CHECK-NEXT: Section: Absolute
+// CHECK-NEXT: Section: .got
// CODE: Disassembly of section .text:
// CODE-NEXT: _start:
@@ -49,5 +49,5 @@ function:
// CODE:$d.1:
// (_GLOBAL_OFFSET_TABLE_ = 0x2048) - (0x1008 + 8) 0x1038
// CODE-NEXT: 1010: 38 10 00 00
-// (Got(function) - GotBase = 0x4
-// CODE-NEXT: 1014: 04 00 00 00
+// (Got(function) - GotBase = 0x0
+// CODE-NEXT: 1014: 00 00 00 00
diff --git a/test/ELF/arm-thumb-branch.s b/test/ELF/arm-thumb-branch.s
index 4dc0280b22f6..81bf7a3c68a9 100644
--- a/test/ELF/arm-thumb-branch.s
+++ b/test/ELF/arm-thumb-branch.s
@@ -54,7 +54,7 @@ callee_high:
// CHECK-NEXT: 1001c: ff f3 fd 97 b.w #16777210
// CHECK-NEXT: 10020: 3f f3 ff af bgt.w #1048574
// CHECK-NEXT: 10024: 70 47 bx lr
-// CHECK-NEXT: 10026: 00 00 movs r0, r0
+// CHECK-NEXT: 10026:
// CHECK-NEXT: Disassembly of section .callee2:
// CHECK-NEXT: callee_high:
// CHECK-NEXT: 10028: 70 47 bx lr
diff --git a/test/ELF/arm-thumb-plt-reloc.s b/test/ELF/arm-thumb-plt-reloc.s
index 95a6e9e7af79..f9afbb9c0ce1 100644
--- a/test/ELF/arm-thumb-plt-reloc.s
+++ b/test/ELF/arm-thumb-plt-reloc.s
@@ -30,7 +30,7 @@ _start:
// CHECK-NEXT: 11002: 70 47 bx lr
// CHECK: func3:
// CHECK-NEXT: 11004: 70 47 bx lr
-// CHECK-NEXT: 11006: 00 00 movs r0, r0
+// CHECK-NEXT: 11006: d4 d4
// CHECK: _start:
// 11008 + 4 -12 = 0x11000 = func1
// CHECK-NEXT: 11008: ff f7 fa ff bl #-12
@@ -49,7 +49,7 @@ _start:
// DSOTHUMB-NEXT: 1002: 70 47 bx lr
// DSOTHUMB: func3:
// DSOTHUMB-NEXT: 1004: 70 47 bx lr
-// DSOTHUMB-NEXT: 1006: 00 00 movs r0, r0
+// DSOTHUMB-NEXT: 1006: d4 d4
// DSOTHUMB: _start:
// 0x1008 + 0x28 + 4 = 0x1034 = PLT func1
// DSOTHUMB-NEXT: 1008: 00 f0 14 e8 blx #40
diff --git a/test/ELF/defsym.s b/test/ELF/defsym.s
index 778180dc9324..253d5d8f408d 100644
--- a/test/ELF/defsym.s
+++ b/test/ELF/defsym.s
@@ -9,8 +9,6 @@
# RUN: llvm-readobj -t -s %t2 | FileCheck %s
# RUN: llvm-objdump -d -print-imm-hex %t2 | FileCheck %s --check-prefix=USE
-## In compare with GNU linkers, symbol defined with --defsym does
-## not get aliased name in symbol table:
# CHECK: Symbol {
# CHECK: Name: foo1
# CHECK-NEXT: Value: 0x123
@@ -21,7 +19,7 @@
# CHECK-NEXT: Section: Absolute
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: foo1
+# CHECK-NEXT: Name: foo2
# CHECK-NEXT: Value: 0x123
# CHECK-NEXT: Size:
# CHECK-NEXT: Binding: Global
diff --git a/test/ELF/exclude-libs.s b/test/ELF/exclude-libs.s
new file mode 100644
index 000000000000..c36081f40e54
--- /dev/null
+++ b/test/ELF/exclude-libs.s
@@ -0,0 +1,30 @@
+// 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 \
+// RUN: %p/Inputs/exclude-libs.s -o %t2.o
+// RUN: mkdir -p %t.dir
+// RUN: rm -f %t.dir/exc.a
+// RUN: llvm-ar rcs %t.dir/exc.a %t2.o
+
+// RUN: ld.lld -shared %t.o %t.dir/exc.a -o %t.exe
+// RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck --check-prefix=DEFAULT %s
+
+// RUN: ld.lld -shared %t.o %t.dir/exc.a -o %t.exe --exclude-libs=foo,bar
+// RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck --check-prefix=DEFAULT %s
+
+// RUN: ld.lld -shared %t.o %t.dir/exc.a -o %t.exe --exclude-libs foo,bar,exc.a
+// RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck --check-prefix=EXCLUDE %s
+
+// RUN: ld.lld -shared %t.o %t.dir/exc.a -o %t.exe --exclude-libs foo:bar:exc.a
+// RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck --check-prefix=EXCLUDE %s
+
+// RUN: ld.lld -shared %t.o %t.dir/exc.a -o %t.exe --exclude-libs=ALL
+// RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck --check-prefix=EXCLUDE %s
+
+// DEFAULT: Name: fn
+// EXCLUDE-NOT: Name: fn
+
+.globl fn
+foo:
+ call fn@PLT
diff --git a/test/ELF/global-offset-table-position-aarch64.s b/test/ELF/global-offset-table-position-aarch64.s
new file mode 100644
index 000000000000..624e9b516fed
--- /dev/null
+++ b/test/ELF/global-offset-table-position-aarch64.s
@@ -0,0 +1,30 @@
+// RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %s -o %t
+// RUN: ld.lld -shared %t -o %t2
+// RUN: llvm-readobj -t %t2 | FileCheck %s
+// REQUIRES: aarch64
+.globl a
+.type a,@object
+.comm a,4,4
+
+.globl f
+.type f,@function
+f:
+ adrp x0, :got:a
+ ldr x0, [x0, #:got_lo12:a]
+
+.global _start
+.type _start,@function
+_start:
+ bl f
+.data
+.long _GLOBAL_OFFSET_TABLE_ - .
+
+// CHECK: Name: _GLOBAL_OFFSET_TABLE_ (11)
+// CHECK-NEXT: Value: 0x30090
+// CHECK-NEXT: Size: 0
+// CHECK-NEXT: Binding: Local (0x0)
+// CHECK-NEXT: Type: None (0x0)
+// CHECK-NEXT: Other [ (0x2)
+// CHECK-NEXT: STV_HIDDEN (0x2)
+// CHECK-NEXT: ]
+// CHECK-NEXT: Section: .got
diff --git a/test/ELF/global-offset-table-position-arm.s b/test/ELF/global-offset-table-position-arm.s
new file mode 100644
index 000000000000..781d8ce5222f
--- /dev/null
+++ b/test/ELF/global-offset-table-position-arm.s
@@ -0,0 +1,35 @@
+// RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabihf %s -o %t
+// RUN: ld.lld -shared %t -o %t2
+// RUN: llvm-readobj -t %t2 | FileCheck %s
+// REQUIRES: arm
+
+// The ARM _GLOBAL_OFFSET_TABLE_ should be defined at the start of the .got
+.globl a
+.type a,%object
+.comm a,4,4
+
+.globl f
+.type f,%function
+f:
+ ldr r2, .L1
+.L0:
+ add r2, pc
+.L1:
+.word _GLOBAL_OFFSET_TABLE_ - (.L0+4)
+.word a(GOT)
+
+.global _start
+.type _start,%function
+_start:
+ bl f
+.data
+
+// CHECK: Name: _GLOBAL_OFFSET_TABLE_
+// CHECK-NEXT: Value: 0x3068
+// 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
diff --git a/test/ELF/global-offset-table-position-i386.s b/test/ELF/global-offset-table-position-i386.s
new file mode 100644
index 000000000000..907105edcff0
--- /dev/null
+++ b/test/ELF/global-offset-table-position-i386.s
@@ -0,0 +1,31 @@
+// RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t
+// RUN: ld.lld -shared %t -o %t2
+// RUN: llvm-readobj -t %t2 | FileCheck %s
+// REQUIRES: x86
+
+// The X86 _GLOBAL_OFFSET_TABLE_ is defined at the end of the .got section.
+.globl a
+.type a,@object
+.comm a,4,4
+
+.globl f
+.type f,@function
+f:
+addl $_GLOBAL_OFFSET_TABLE_, %eax
+movl a@GOT(%eax), %eax
+
+.global _start
+.type _start,@function
+_start:
+addl $_GLOBAL_OFFSET_TABLE_, %eax
+calll f@PLT
+
+// CHECK: Name: _GLOBAL_OFFSET_TABLE_ (1)
+// CHECK-NEXT: Value: 0x306C
+// CHECK-NEXT: Size: 0
+// CHECK-NEXT: Binding: Local (0x0)
+// CHECK-NEXT: Type: None (0x0)
+// CHECK-NEXT: Other [ (0x2)
+// CHECK-NEXT: STV_HIDDEN (0x2)
+// CHECK-NEXT: ]
+// CHECK-NEXT: Section: .got (0xA)
diff --git a/test/ELF/global-offset-table-position-mips.s b/test/ELF/global-offset-table-position-mips.s
new file mode 100644
index 000000000000..92daed1c7914
--- /dev/null
+++ b/test/ELF/global-offset-table-position-mips.s
@@ -0,0 +1,33 @@
+// RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t
+// RUN: ld.lld -shared %t -o %t2
+// RUN: llvm-readobj -t %t2 | FileCheck %s
+
+// REQUIRES: mips
+
+// The Mips _GLOBAL_OFFSET_TABLE_ should be defined at the start of the .got
+
+.globl a
+.hidden a
+.type a,@object
+.comm a,4,4
+
+.globl f
+.type f,@function
+f:
+ ld $v0,%got_page(a)($gp)
+ daddiu $v0,$v0,%got_ofst(a)
+
+.global _start
+.type _start,@function
+_start:
+ lw $t0,%call16(f)($gp)
+ .word _GLOBAL_OFFSET_TABLE_ - .
+// CHECK: Name: _GLOBAL_OFFSET_TABLE_ (1)
+// CHECK-NEXT: Value: 0x20000
+// CHECK-NEXT: Size: 0
+// CHECK-NEXT: Binding: Local (0x0)
+// CHECK-NEXT: Type: None (0x0)
+// CHECK-NEXT: Other [ (0x2)
+// CHECK-NEXT: STV_HIDDEN (0x2)
+// CHECK-NEXT: ]
+// CHECK-NEXT: Section: .got (0x9)
diff --git a/test/ELF/global-offset-table-position.s b/test/ELF/global-offset-table-position.s
new file mode 100644
index 000000000000..b3317c7edd8b
--- /dev/null
+++ b/test/ELF/global-offset-table-position.s
@@ -0,0 +1,31 @@
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
+// RUN: ld.lld -shared %t -o %t2
+// RUN: llvm-readobj -t %t2 | FileCheck %s
+// REQUIRES: x86
+
+// The X86_64 _GLOBAL_OFFSET_TABLE_ is defined at the end of the .got section.
+.globl a
+.type a,@object
+.comm a,4,4
+
+.globl f
+.type f,@function
+f:
+movq a@GOTPCREL(%rip), %rax
+
+.global _start
+.type _start,@function
+_start:
+callq f@PLT
+.data
+.long _GLOBAL_OFFSET_TABLE_ - .
+
+// CHECK: Name: _GLOBAL_OFFSET_TABLE_
+// CHECK-NEXT: Value: 0x30D8
+// CHECK-NEXT: Size: 0
+// CHECK-NEXT: Binding: Local
+// CHECK-NEXT: Type: None (0x0)
+// CHECK-NEXT: Other [
+// CHECK-NEXT: STV_HIDDEN
+// CHECK-NEXT: ]
+// CHECK-NEXT: Section: .got
diff --git a/test/ELF/global_offset_table_shared.s b/test/ELF/global_offset_table_shared.s
index 7935925ae2b3..1ebc0110d4d7 100644
--- a/test/ELF/global_offset_table_shared.s
+++ b/test/ELF/global_offset_table_shared.s
@@ -1,9 +1,14 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
// RUN: ld.lld -shared %t -o %t2
// RUN: llvm-readobj -t %t2 | FileCheck %s
-.long _GLOBAL_OFFSET_TABLE_
+.long _GLOBAL_OFFSET_TABLE_ - .
// CHECK: Name: _GLOBAL_OFFSET_TABLE_
-// CHECK-NEXT: Value:
+// CHECK-NEXT: Value: 0x2060
// 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
diff --git a/test/ELF/invalid-z.s b/test/ELF/invalid-z.s
new file mode 100644
index 000000000000..a5343c93e677
--- /dev/null
+++ b/test/ELF/invalid-z.s
@@ -0,0 +1,9 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: not ld.lld %t.o -o %t -z max-page-size 2>&1 | FileCheck %s
+# CHECK: invalid max-page-size
+# CHECK-NOT: error
+
+.global _start
+_start:
+ nop
diff --git a/test/ELF/linkerscript/discard-section-err.s b/test/ELF/linkerscript/discard-section-err.s
new file mode 100644
index 000000000000..5d9955545d92
--- /dev/null
+++ b/test/ELF/linkerscript/discard-section-err.s
@@ -0,0 +1,23 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+
+# RUN: echo "SECTIONS { /DISCARD/ : { *(.shstrtab) } }" > %t.script
+# RUN: not ld.lld -o %t --script %t.script %t.o 2>&1 | \
+# RUN: FileCheck -check-prefix=SHSTRTAB %s
+# SHSTRTAB: discarding .shstrtab section is not allowed
+
+# RUN: echo "SECTIONS { /DISCARD/ : { *(.dynamic) } }" > %t.script
+# RUN: not ld.lld -pie -o %t --script %t.script %t.o 2>&1 | \
+# RUN: FileCheck -check-prefix=DYNAMIC %s
+# DYNAMIC: discarding .dynamic section is not allowed
+
+# RUN: echo "SECTIONS { /DISCARD/ : { *(.dynsym) } }" > %t.script
+# RUN: not ld.lld -pie -o %t --script %t.script %t.o 2>&1 | \
+# RUN: FileCheck -check-prefix=DYNSYM %s
+# DYNSYM: discarding .dynsym section is not allowed
+
+# RUN: echo "SECTIONS { /DISCARD/ : { *(.dynstr) } }" > %t.script
+# RUN: not ld.lld -pie -o %t --script %t.script %t.o 2>&1 | \
+# RUN: FileCheck -check-prefix=DYNSTR %s
+# DYNSTR: discarding .dynstr section is not allowed
diff --git a/test/ELF/linkerscript/sections.s b/test/ELF/linkerscript/sections.s
index d5645c303754..dd4b12f42b89 100644
--- a/test/ELF/linkerscript/sections.s
+++ b/test/ELF/linkerscript/sections.s
@@ -67,12 +67,6 @@
# SEC-SWAP-NAMES: 7 .shstrtab 0000003b {{[0-9a-f]*}}
# SEC-SWAP-NAMES: 8 .strtab 00000008 {{[0-9a-f]*}}
-# Attemp to discard .shstrtab section.
-# RUN: echo "SECTIONS { /DISCARD/ : { *(.shstrtab) } }" > %t.script
-# RUN: not ld.lld -o %t5 --script %t.script %t 2>&1 | \
-# RUN: FileCheck -check-prefix=SEC-DISCARD %s
-# SEC-DISCARD: discarding .shstrtab section is not allowed
-
# Multiple SECTIONS command specifying additional input section descriptions
# for the same output section description - input sections are merged into
# one output section.
diff --git a/test/ELF/linkerscript/segment-none.s b/test/ELF/linkerscript/segment-none.s
new file mode 100644
index 000000000000..d54e835a0c22
--- /dev/null
+++ b/test/ELF/linkerscript/segment-none.s
@@ -0,0 +1,39 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+
+## Test that section .foo is not placed in any segment when assigned to segment
+## NONE in the linker script and segment NONE is not defined.
+# RUN: echo "PHDRS {text PT_LOAD;} \
+# RUN: SECTIONS { \
+# RUN: .text : {*(.text .text*)} :text \
+# RUN: .foo : {*(.foo)} :NONE \
+# RUN: }" > %t.script
+# RUN: ld.lld -o %t --script %t.script %t.o
+# RUN: llvm-readobj -elf-output-style=GNU -s -l %t | FileCheck %s
+
+## Test that section .foo is placed in segment NONE when assigned to segment
+## NONE in the linker script and segment NONE is defined.
+# RUN: echo "PHDRS {text PT_LOAD; NONE PT_LOAD;} \
+# RUN: SECTIONS { \
+# RUN: .text : {*(.text .text*)} :text \
+# RUN: .foo : {*(.foo)} :NONE \
+# RUN: }" > %t.script
+# RUN: ld.lld -o %t --script %t.script %t.o
+# RUN: llvm-readobj -elf-output-style=GNU -s -l %t | FileCheck --check-prefix=DEFINED %s
+
+# CHECK: Section to Segment mapping:
+# CHECK-NEXT: Segment Sections...
+# CHECK-NOT: .foo
+
+# DEFINED: Section to Segment mapping:
+# DEFINED-NEXT: Segment Sections...
+# DEFINED-NEXT: 00 .text
+# DEFINED-NEXT: 01 .foo
+
+.global _start
+_start:
+ nop
+
+.section .foo,"a"
+foo:
+ .long 0
diff --git a/test/ELF/linkerscript/ttext-script.s b/test/ELF/linkerscript/ttext-script.s
new file mode 100644
index 000000000000..9dcde9bb13c5
--- /dev/null
+++ b/test/ELF/linkerscript/ttext-script.s
@@ -0,0 +1,11 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: echo "SECTIONS { .text 0x200000 : { *(.text) } }" > %t.script
+# RUN: ld.lld -T %t.script -Ttext 0x100000 %t.o -o %t
+# RUN: llvm-readobj --elf-output-style=GNU -s %t | FileCheck %s
+
+# CHECK: .text PROGBITS 0000000000100000
+
+.global _start
+_start:
+nop
diff --git a/test/ELF/lto/cache.ll b/test/ELF/lto/cache.ll
index 55e3a3d6f6cd..6731f522606f 100644
--- a/test/ELF/lto/cache.ll
+++ b/test/ELF/lto/cache.ll
@@ -12,6 +12,17 @@
; Two cached objects, plus a timestamp file and "foo", minus the file we removed.
; RUN: ls %t.cache | count 4
+; Create a file of size 64KB.
+; RUN: %python -c "print(' ' * 65536)" > %t.cache/llvmcache-foo
+
+; This should leave the file in place.
+; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy cache_size_bytes=128k -o %t3 %t2.o %t.o
+; RUN: ls %t.cache | count 5
+
+; This should remove it.
+; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy cache_size_bytes=32k -o %t3 %t2.o %t.o
+; RUN: ls %t.cache | count 4
+
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
diff --git a/test/ELF/lto/wrap-2.ll b/test/ELF/lto/wrap-2.ll
index b2e33f83138e..b318b7f65f2d 100644
--- a/test/ELF/lto/wrap-2.ll
+++ b/test/ELF/lto/wrap-2.ll
@@ -10,8 +10,8 @@
; CHECK: foo:
; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq{{.*}}<__wrap_bar>
; CHECK-NEXT: callq{{.*}}<bar>
+; CHECK-NEXT: callq{{.*}}<__real_bar>
; Check that bar and __wrap_bar retain their original binding.
; BIND: Name: bar
diff --git a/test/ELF/mips-got16-relocatable.s b/test/ELF/mips-got16-relocatable.s
index 963efeb4686e..bbacfdbaa682 100644
--- a/test/ELF/mips-got16-relocatable.s
+++ b/test/ELF/mips-got16-relocatable.s
@@ -15,8 +15,8 @@
# OBJ-NEXT: 00000000: R_MIPS_GOT16 .data
# OBJ-NEXT: 4: 27 24 00 00 addiu $4, $25, 0
# OBJ-NEXT: 00000004: R_MIPS_LO16 .data
-# OBJ-NEXT: 8: 00 00 00 00 nop
-# OBJ-NEXT: c: 00 00 00 00 nop
+# OBJ-NEXT: 8: ef ef ef ef <unknown>
+# OBJ-NEXT: c: ef ef ef ef <unknown>
# OBJ-NEXT: 10: 8f 99 00 00 lw $25, 0($gp)
# OBJ-NEXT: 00000010: R_MIPS_GOT16 .data
# OBJ-NEXT: 14: 27 24 00 10 addiu $4, $25, 16
@@ -26,8 +26,8 @@
# SO-NEXT: .text:
# SO-NEXT: 10000: 8f 99 80 18 lw $25, -32744($gp)
# SO-NEXT: 10004: 27 24 00 00 addiu $4, $25, 0
-# SO-NEXT: 10008: 00 00 00 00 nop
-# SO-NEXT: 1000c: 00 00 00 00 nop
+# SO-NEXT: 10008: ef ef ef ef <unknown>
+# SO-NEXT: 1000c: ef ef ef ef <unknown>
# SO-NEXT: 10010: 8f 99 80 18 lw $25, -32744($gp)
# SO-NEXT: 10014: 27 24 00 10 addiu $4, $25, 16
diff --git a/test/ELF/mips-npic-call-pic-os.s b/test/ELF/mips-npic-call-pic-os.s
index 131289e596e8..aea0fa1221dc 100644
--- a/test/ELF/mips-npic-call-pic-os.s
+++ b/test/ELF/mips-npic-call-pic-os.s
@@ -33,8 +33,8 @@
# CHECK-NEXT: 2002c: 08 00 80 10 j 131136 <foo2>
# CHECK-NEXT: 20030: 27 39 00 40 addiu $25, $25, 64
# CHECK-NEXT: 20034: 00 00 00 00 nop
-# CHECK-NEXT: 20038: 00 00 00 00 nop
-# CHECK-NEXT: 2003c: 00 00 00 00 nop
+# CHECK-NEXT: 20038: ef ef ef ef <unknown>
+# CHECK-NEXT: 2003c: ef ef ef ef <unknown>
# CHECK: foo2:
# CHECK-NEXT: 20040: 00 00 00 00 nop
# CHECK: __LA25Thunk_fpic:
@@ -42,14 +42,14 @@
# CHECK-NEXT: 20048: 08 00 80 18 j 131168 <fpic>
# CHECK-NEXT: 2004c: 27 39 00 60 addiu $25, $25, 96
# CHECK-NEXT: 20050: 00 00 00 00 nop
-# CHECK-NEXT: 20054: 00 00 00 00 nop
-# CHECK-NEXT: 20058: 00 00 00 00 nop
-# CHECK-NEXT: 2005c: 00 00 00 00 nop
+# CHECK-NEXT: 20054: ef ef ef ef <unknown>
+# CHECK-NEXT: 20058: ef ef ef ef <unknown>
+# CHECK-NEXT: 2005c: ef ef ef ef <unknown>
# CHECK: fpic:
# CHECK-NEXT: 20060: 00 00 00 00 nop
-# CHECK-NEXT: 20064: 00 00 00 00 nop
-# CHECK-NEXT: 20068: 00 00 00 00 nop
-# CHECK-NEXT: 2006c: 00 00 00 00 nop
+# CHECK-NEXT: 20064: ef ef ef ef <unknown>
+# CHECK-NEXT: 20068: ef ef ef ef <unknown>
+# CHECK-NEXT: 2006c: ef ef ef ef <unknown>
# CHECK: fnpic:
# CHECK-NEXT: 20070: 00 00 00 00 nop
# CHECK-NEXT: Disassembly of section differentos:
@@ -93,13 +93,13 @@
# REVERSE-NEXT: 2002c: 08 00 80 10 j 131136 <foo2>
# REVERSE-NEXT: 20030: 27 39 00 40 addiu $25, $25, 64
# REVERSE-NEXT: 20034: 00 00 00 00 nop
-# REVERSE-NEXT: 20038: 00 00 00 00 nop
-# REVERSE-NEXT: 2003c: 00 00 00 00 nop
+# REVERSE-NEXT: 20038: ef ef ef ef <unknown>
+# REVERSE-NEXT: 2003c: ef ef ef ef <unknown>
# REVERSE: foo2:
# REVERSE-NEXT: 20040: 00 00 00 00 nop
-# REVERSE-NEXT: 20044: 00 00 00 00 nop
-# REVERSE-NEXT: 20048: 00 00 00 00 nop
-# REVERSE-NEXT: 2004c: 00 00 00 00 nop
+# REVERSE-NEXT: 20044: ef ef ef ef <unknown>
+# REVERSE-NEXT: 20048: ef ef ef ef <unknown>
+# REVERSE-NEXT: 2004c: ef ef ef ef <unknown>
# REVERSE: __LA25Thunk_fpic:
# REVERSE-NEXT: 20050: 3c 19 00 02 lui $25, 2
# REVERSE-NEXT: 20054: 08 00 80 18 j 131168 <fpic>
@@ -107,9 +107,9 @@
# REVERSE-NEXT: 2005c: 00 00 00 00 nop
# REVERSE: fpic:
# REVERSE-NEXT: 20060: 00 00 00 00 nop
-# REVERSE-NEXT: 20064: 00 00 00 00 nop
-# REVERSE-NEXT: 20068: 00 00 00 00 nop
-# REVERSE-NEXT: 2006c: 00 00 00 00 nop
+# REVERSE-NEXT: 20064: ef ef ef ef <unknown>
+# REVERSE-NEXT: 20068: ef ef ef ef <unknown>
+# REVERSE-NEXT: 2006c: ef ef ef ef <unknown>
# REVERSE: fnpic:
# REVERSE-NEXT: 20070: 00 00 00 00 nop
# REVERSE-NEXT: Disassembly of section differentos:
diff --git a/test/ELF/mips-npic-call-pic-script.s b/test/ELF/mips-npic-call-pic-script.s
index 6028989ee4cb..230704459463 100644
--- a/test/ELF/mips-npic-call-pic-script.s
+++ b/test/ELF/mips-npic-call-pic-script.s
@@ -33,77 +33,77 @@
# CHECK-NEXT: 2002c: 08 00 80 10 j 131136 <foo2>
# CHECK-NEXT: 20030: 27 39 00 40 addiu $25, $25, 64
# CHECK-NEXT: 20034: 00 00 00 00 nop
-# CHECK-NEXT: 20038: 00 00 00 00 nop
-# CHECK-NEXT: 2003c: 00 00 00 00 nop
+# CHECK-NEXT: 20038: ef ef ef ef <unknown>
+# CHECK-NEXT: 2003c: ef ef ef ef <unknown>
# CHECK: foo2:
# CHECK-NEXT: 20040: 00 00 00 00 nop
-# CHECK-NEXT: 20044: 00 00 00 00 nop
-# CHECK-NEXT: 20048: 00 00 00 00 nop
-# CHECK-NEXT: 2004c: 00 00 00 00 nop
-# CHECK-NEXT: 20050: 00 00 00 00 nop
-# CHECK-NEXT: 20054: 00 00 00 00 nop
-# CHECK-NEXT: 20058: 00 00 00 00 nop
-# CHECK-NEXT: 2005c: 00 00 00 00 nop
-# CHECK-NEXT: 20060: 00 00 00 00 nop
-# CHECK-NEXT: 20064: 00 00 00 00 nop
-# CHECK-NEXT: 20068: 00 00 00 00 nop
-# CHECK-NEXT: 2006c: 00 00 00 00 nop
-# CHECK-NEXT: 20070: 00 00 00 00 nop
-# CHECK-NEXT: 20074: 00 00 00 00 nop
-# CHECK-NEXT: 20078: 00 00 00 00 nop
-# CHECK-NEXT: 2007c: 00 00 00 00 nop
-# CHECK-NEXT: 20080: 00 00 00 00 nop
-# CHECK-NEXT: 20084: 00 00 00 00 nop
-# CHECK-NEXT: 20088: 00 00 00 00 nop
-# CHECK-NEXT: 2008c: 00 00 00 00 nop
-# CHECK-NEXT: 20090: 00 00 00 00 nop
-# CHECK-NEXT: 20094: 00 00 00 00 nop
-# CHECK-NEXT: 20098: 00 00 00 00 nop
-# CHECK-NEXT: 2009c: 00 00 00 00 nop
-# CHECK-NEXT: 200a0: 00 00 00 00 nop
-# CHECK-NEXT: 200a4: 00 00 00 00 nop
-# CHECK-NEXT: 200a8: 00 00 00 00 nop
-# CHECK-NEXT: 200ac: 00 00 00 00 nop
-# CHECK-NEXT: 200b0: 00 00 00 00 nop
-# CHECK-NEXT: 200b4: 00 00 00 00 nop
-# CHECK-NEXT: 200b8: 00 00 00 00 nop
-# CHECK-NEXT: 200bc: 00 00 00 00 nop
-# CHECK-NEXT: 200c0: 00 00 00 00 nop
-# CHECK-NEXT: 200c4: 00 00 00 00 nop
-# CHECK-NEXT: 200c8: 00 00 00 00 nop
-# CHECK-NEXT: 200cc: 00 00 00 00 nop
-# CHECK-NEXT: 200d0: 00 00 00 00 nop
-# CHECK-NEXT: 200d4: 00 00 00 00 nop
-# CHECK-NEXT: 200d8: 00 00 00 00 nop
-# CHECK-NEXT: 200dc: 00 00 00 00 nop
-# CHECK-NEXT: 200e0: 00 00 00 00 nop
-# CHECK-NEXT: 200e4: 00 00 00 00 nop
-# CHECK-NEXT: 200e8: 00 00 00 00 nop
-# CHECK-NEXT: 200ec: 00 00 00 00 nop
-# CHECK-NEXT: 200f0: 00 00 00 00 nop
-# CHECK-NEXT: 200f4: 00 00 00 00 nop
-# CHECK-NEXT: 200f8: 00 00 00 00 nop
-# CHECK-NEXT: 200fc: 00 00 00 00 nop
-# CHECK-NEXT: 20100: 00 00 00 00 nop
-# CHECK-NEXT: 20104: 00 00 00 00 nop
-# CHECK-NEXT: 20108: 00 00 00 00 nop
-# CHECK-NEXT: 2010c: 00 00 00 00 nop
-# CHECK-NEXT: 20110: 00 00 00 00 nop
-# CHECK-NEXT: 20114: 00 00 00 00 nop
-# CHECK-NEXT: 20118: 00 00 00 00 nop
-# CHECK-NEXT: 2011c: 00 00 00 00 nop
-# CHECK-NEXT: 20120: 00 00 00 00 nop
-# CHECK-NEXT: 20124: 00 00 00 00 nop
-# CHECK-NEXT: 20128: 00 00 00 00 nop
-# CHECK-NEXT: 2012c: 00 00 00 00 nop
-# CHECK-NEXT: 20130: 00 00 00 00 nop
-# CHECK-NEXT: 20134: 00 00 00 00 nop
-# CHECK-NEXT: 20138: 00 00 00 00 nop
-# CHECK-NEXT: 2013c: 00 00 00 00 nop
-# CHECK-NEXT: 20140: 00 00 00 00 nop
-# CHECK-NEXT: 20144: 00 00 00 00 nop
-# CHECK-NEXT: 20148: 00 00 00 00 nop
-# CHECK-NEXT: 2014c: 00 00 00 00 nop
+# CHECK-NEXT: 20044: ef ef ef ef <unknown>
+# CHECK-NEXT: 20048: ef ef ef ef <unknown>
+# CHECK-NEXT: 2004c: ef ef ef ef <unknown>
+# CHECK-NEXT: 20050: ef ef ef ef <unknown>
+# CHECK-NEXT: 20054: ef ef ef ef <unknown>
+# CHECK-NEXT: 20058: ef ef ef ef <unknown>
+# CHECK-NEXT: 2005c: ef ef ef ef <unknown>
+# CHECK-NEXT: 20060: ef ef ef ef <unknown>
+# CHECK-NEXT: 20064: ef ef ef ef <unknown>
+# CHECK-NEXT: 20068: ef ef ef ef <unknown>
+# CHECK-NEXT: 2006c: ef ef ef ef <unknown>
+# CHECK-NEXT: 20070: ef ef ef ef <unknown>
+# CHECK-NEXT: 20074: ef ef ef ef <unknown>
+# CHECK-NEXT: 20078: ef ef ef ef <unknown>
+# CHECK-NEXT: 2007c: ef ef ef ef <unknown>
+# CHECK-NEXT: 20080: ef ef ef ef <unknown>
+# CHECK-NEXT: 20084: ef ef ef ef <unknown>
+# CHECK-NEXT: 20088: ef ef ef ef <unknown>
+# CHECK-NEXT: 2008c: ef ef ef ef <unknown>
+# CHECK-NEXT: 20090: ef ef ef ef <unknown>
+# CHECK-NEXT: 20094: ef ef ef ef <unknown>
+# CHECK-NEXT: 20098: ef ef ef ef <unknown>
+# CHECK-NEXT: 2009c: ef ef ef ef <unknown>
+# CHECK-NEXT: 200a0: ef ef ef ef <unknown>
+# CHECK-NEXT: 200a4: ef ef ef ef <unknown>
+# CHECK-NEXT: 200a8: ef ef ef ef <unknown>
+# CHECK-NEXT: 200ac: ef ef ef ef <unknown>
+# CHECK-NEXT: 200b0: ef ef ef ef <unknown>
+# CHECK-NEXT: 200b4: ef ef ef ef <unknown>
+# CHECK-NEXT: 200b8: ef ef ef ef <unknown>
+# CHECK-NEXT: 200bc: ef ef ef ef <unknown>
+# CHECK-NEXT: 200c0: ef ef ef ef <unknown>
+# CHECK-NEXT: 200c4: ef ef ef ef <unknown>
+# CHECK-NEXT: 200c8: ef ef ef ef <unknown>
+# CHECK-NEXT: 200cc: ef ef ef ef <unknown>
+# CHECK-NEXT: 200d0: ef ef ef ef <unknown>
+# CHECK-NEXT: 200d4: ef ef ef ef <unknown>
+# CHECK-NEXT: 200d8: ef ef ef ef <unknown>
+# CHECK-NEXT: 200dc: ef ef ef ef <unknown>
+# CHECK-NEXT: 200e0: ef ef ef ef <unknown>
+# CHECK-NEXT: 200e4: ef ef ef ef <unknown>
+# CHECK-NEXT: 200e8: ef ef ef ef <unknown>
+# CHECK-NEXT: 200ec: ef ef ef ef <unknown>
+# CHECK-NEXT: 200f0: ef ef ef ef <unknown>
+# CHECK-NEXT: 200f4: ef ef ef ef <unknown>
+# CHECK-NEXT: 200f8: ef ef ef ef <unknown>
+# CHECK-NEXT: 200fc: ef ef ef ef <unknown>
+# CHECK-NEXT: 20100: ef ef ef ef <unknown>
+# CHECK-NEXT: 20104: ef ef ef ef <unknown>
+# CHECK-NEXT: 20108: ef ef ef ef <unknown>
+# CHECK-NEXT: 2010c: ef ef ef ef <unknown>
+# CHECK-NEXT: 20110: ef ef ef ef <unknown>
+# CHECK-NEXT: 20114: ef ef ef ef <unknown>
+# CHECK-NEXT: 20118: ef ef ef ef <unknown>
+# CHECK-NEXT: 2011c: ef ef ef ef <unknown>
+# CHECK-NEXT: 20120: ef ef ef ef <unknown>
+# CHECK-NEXT: 20124: ef ef ef ef <unknown>
+# CHECK-NEXT: 20128: ef ef ef ef <unknown>
+# CHECK-NEXT: 2012c: ef ef ef ef <unknown>
+# CHECK-NEXT: 20130: ef ef ef ef <unknown>
+# CHECK-NEXT: 20134: ef ef ef ef <unknown>
+# CHECK-NEXT: 20138: ef ef ef ef <unknown>
+# CHECK-NEXT: 2013c: ef ef ef ef <unknown>
+# CHECK-NEXT: 20140: ef ef ef ef <unknown>
+# CHECK-NEXT: 20144: ef ef ef ef <unknown>
+# CHECK-NEXT: 20148: ef ef ef ef <unknown>
+# CHECK-NEXT: 2014c: ef ef ef ef <unknown>
# CHECK: __start:
# CHECK-NEXT: 20150: 0c 00 80 00 jal 131072 <__LA25Thunk_foo1a>
# CHECK-NEXT: 20154: 00 00 00 00 nop
@@ -124,9 +124,9 @@
# CHECK-NEXT: 2018c: 00 00 00 00 nop
# CHECK: fpic:
# CHECK-NEXT: 20190: 00 00 00 00 nop
-# CHECK-NEXT: 20194: 00 00 00 00 nop
-# CHECK-NEXT: 20198: 00 00 00 00 nop
-# CHECK-NEXT: 2019c: 00 00 00 00 nop
+# CHECK-NEXT: 20194: ef ef ef ef <unknown>
+# CHECK-NEXT: 20198: ef ef ef ef <unknown>
+# CHECK-NEXT: 2019c: ef ef ef ef <unknown>
# CHECK: fnpic:
# CHECK-NEXT: 201a0: 00 00 00 00 nop
@@ -166,9 +166,9 @@ __start:
# ORPH1-NEXT: 2003c: 00 00 00 00 nop
# ORPH1: fpic:
# ORPH1-NEXT: 20040: 00 00 00 00 nop
-# ORPH1-NEXT: 20044: 00 00 00 00 nop
-# ORPH1-NEXT: 20048: 00 00 00 00 nop
-# ORPH1-NEXT: 2004c: 00 00 00 00 nop
+# ORPH1-NEXT: 20044: ef ef ef ef <unknown>
+# ORPH1-NEXT: 20048: ef ef ef ef <unknown>
+# ORPH1-NEXT: 2004c: ef ef ef ef <unknown>
# ORPH1: fnpic:
# ORPH1-NEXT: 20050: 00 00 00 00 nop
# ORPH1: __LA25Thunk_foo1a:
@@ -181,9 +181,9 @@ __start:
# ORPH1-NEXT: 20068: 08 00 80 21 j 131204 <foo1b>
# ORPH1-NEXT: 2006c: 27 39 00 84 addiu $25, $25, 132
# ORPH1-NEXT: 20070: 00 00 00 00 nop
-# ORPH1-NEXT: 20074: 00 00 00 00 nop
-# ORPH1-NEXT: 20078: 00 00 00 00 nop
-# ORPH1-NEXT: 2007c: 00 00 00 00 nop
+# ORPH1-NEXT: 20074: ef ef ef ef <unknown>
+# ORPH1-NEXT: 20078: ef ef ef ef <unknown>
+# ORPH1-NEXT: 2007c: ef ef ef ef <unknown>
# ORPH1: foo1a:
# ORPH1-NEXT: 20080: 00 00 00 00 nop
# ORPH1: foo1b:
@@ -193,8 +193,8 @@ __start:
# ORPH1-NEXT: 2008c: 08 00 80 28 j 131232 <foo2>
# ORPH1-NEXT: 20090: 27 39 00 a0 addiu $25, $25, 160
# ORPH1-NEXT: 20094: 00 00 00 00 nop
-# ORPH1-NEXT: 20098: 00 00 00 00 nop
-# ORPH1-NEXT: 2009c: 00 00 00 00 nop
+# ORPH1-NEXT: 20098: ef ef ef ef <unknown>
+# ORPH1-NEXT: 2009c: ef ef ef ef <unknown>
# ORPH1: foo2:
# ORPH1-NEXT: 200a0: 00 00 00 00 nop
@@ -224,9 +224,9 @@ __start:
# ORPH2-NEXT: 2003c: 00 00 00 00 nop
# ORPH2: fpic:
# ORPH2-NEXT: 20040: 00 00 00 00 nop
-# ORPH2-NEXT: 20044: 00 00 00 00 nop
-# ORPH2-NEXT: 20048: 00 00 00 00 nop
-# ORPH2-NEXT: 2004c: 00 00 00 00 nop
+# ORPH2-NEXT: 20044: ef ef ef ef <unknown>
+# ORPH2-NEXT: 20048: ef ef ef ef <unknown>
+# ORPH2-NEXT: 2004c: ef ef ef ef <unknown>
# ORPH2: fnpic:
# ORPH2-NEXT: 20050: 00 00 00 00 nop
# ORPH2-NEXT: Disassembly of section .text:
@@ -249,7 +249,7 @@ __start:
# ORPH2-NEXT: 2008c: 08 00 80 28 j 131232 <foo2>
# ORPH2-NEXT: 20090: 27 39 00 a0 addiu $25, $25, 160
# ORPH2-NEXT: 20094: 00 00 00 00 nop
-# ORPH2-NEXT: 20098: 00 00 00 00 nop
-# ORPH2-NEXT: 2009c: 00 00 00 00 nop
+# ORPH2-NEXT: 20098: ef ef ef ef <unknown>
+# ORPH2-NEXT: 2009c: ef ef ef ef <unknown>
# ORPH2: foo2:
# ORPH2-NEXT: 200a0: 00 00 00 00 nop
diff --git a/test/ELF/mips-npic-call-pic.s b/test/ELF/mips-npic-call-pic.s
index a5a99d719983..c3c94d783410 100644
--- a/test/ELF/mips-npic-call-pic.s
+++ b/test/ELF/mips-npic-call-pic.s
@@ -51,8 +51,8 @@
# CHECK-NEXT: 2005c: 08 00 80 1c j 131184 <foo2>
# CHECK-NEXT: 20060: 27 39 00 70 addiu $25, $25, 112
# CHECK-NEXT: 20064: 00 00 00 00 nop
-# CHECK-NEXT: 20068: 00 00 00 00 nop
-# CHECK-NEXT: 2006c: 00 00 00 00 nop
+# CHECK-NEXT: 20068: ef ef ef ef <unknown>
+# CHECK-NEXT: 2006c: ef ef ef ef <unknown>
# CHECK: foo2:
# CHECK-NEXT: 20070: 00 00 00 00 nop
@@ -62,15 +62,15 @@
# CHECK-NEXT: 20078: 08 00 80 24 j 131216 <fpic>
# CHECK-NEXT: 2007c: 27 39 00 90 addiu $25, $25, 144
# CHECK-NEXT: 20080: 00 00 00 00 nop
-# CHECK-NEXT: 20084: 00 00 00 00 nop
-# CHECK-NEXT: 20088: 00 00 00 00 nop
-# CHECK-NEXT: 2008c: 00 00 00 00 nop
+# CHECK-NEXT: 20084: ef ef ef ef <unknown>
+# CHECK-NEXT: 20088: ef ef ef ef <unknown>
+# CHECK-NEXT: 2008c: ef ef ef ef <unknown>
# CHECK: fpic:
# CHECK-NEXT: 20090: 00 00 00 00 nop
-# CHECK-NEXT: 20094: 00 00 00 00 nop
-# CHECK-NEXT: 20098: 00 00 00 00 nop
-# CHECK-NEXT: 2009c: 00 00 00 00 nop
+# CHECK-NEXT: 20094: ef ef ef ef <unknown>
+# CHECK-NEXT: 20098: ef ef ef ef <unknown>
+# CHECK-NEXT: 2009c: ef ef ef ef <unknown>
# CHECK: fnpic:
# CHECK-NEXT: 200a0: 00 00 00 00 nop
@@ -101,13 +101,13 @@
# REVERSE-NEXT: 2002c: 08 00 80 10 j 131136 <foo2>
# REVERSE-NEXT: 20030: 27 39 00 40 addiu $25, $25, 64
# REVERSE-NEXT: 20034: 00 00 00 00 nop
-# REVERSE-NEXT: 20038: 00 00 00 00 nop
-# REVERSE-NEXT: 2003c: 00 00 00 00 nop
+# REVERSE-NEXT: 20038: ef ef ef ef <unknown>
+# REVERSE-NEXT: 2003c: ef ef ef ef <unknown>
# REVERSE: foo2:
# REVERSE-NEXT: 20040: 00 00 00 00 nop
-# REVERSE-NEXT: 20044: 00 00 00 00 nop
-# REVERSE-NEXT: 20048: 00 00 00 00 nop
-# REVERSE-NEXT: 2004c: 00 00 00 00 nop
+# REVERSE-NEXT: 20044: ef ef ef ef <unknown>
+# REVERSE-NEXT: 20048: ef ef ef ef <unknown>
+# REVERSE-NEXT: 2004c: ef ef ef ef <unknown>
# REVERSE: __start:
# REVERSE-NEXT: 20050: 0c 00 80 00 jal 131072 <__LA25Thunk_foo1a>
# REVERSE-NEXT: 20054: 00 00 00 00 nop
@@ -128,9 +128,9 @@
# REVERSE-NEXT: 2008c: 00 00 00 00 nop
# REVERSE: fpic:
# REVERSE-NEXT: 20090: 00 00 00 00 nop
-# REVERSE-NEXT: 20094: 00 00 00 00 nop
-# REVERSE-NEXT: 20098: 00 00 00 00 nop
-# REVERSE-NEXT: 2009c: 00 00 00 00 nop
+# REVERSE-NEXT: 20094: ef ef ef ef <unknown>
+# REVERSE-NEXT: 20098: ef ef ef ef <unknown>
+# REVERSE-NEXT: 2009c: ef ef ef ef <unknown>
# REVERSE: fnpic:
# REVERSE-NEXT: 200a0: 00 00 00 00 nop
diff --git a/test/ELF/mips-plt-r6.s b/test/ELF/mips-plt-r6.s
index ccf233cc73cd..4bab21c32eb9 100644
--- a/test/ELF/mips-plt-r6.s
+++ b/test/ELF/mips-plt-r6.s
@@ -18,7 +18,7 @@
#
# CHECK-NEXT: Disassembly of section .plt:
# CHECK-NEXT: .plt:
-# CHECK-NEXT: 20010: 3c 1c 00 03 aui $zero, $gp, 3
+# CHECK-NEXT: 20010: 3c 1c 00 03 aui $gp, $zero, 3
# CHECK-NEXT: 20014: 8f 99 00 04 lw $25, 4($gp)
# CHECK-NEXT: 20018: 27 9c 00 04 addiu $gp, $gp, 4
# CHECK-NEXT: 2001c: 03 1c c0 23 subu $24, $24, $gp
@@ -27,7 +27,7 @@
# CHECK-NEXT: 20028: 03 20 f8 09 jalr $25
# CHECK-NEXT: 2002c: 27 18 ff fe addiu $24, $24, -2
-# CHECK-NEXT: 20030: 3c 0f 00 03 aui $zero, $15, 3
+# CHECK-NEXT: 20030: 3c 0f 00 03 aui $15, $zero, 3
# CHECK-NEXT: 20034: 8d f9 00 0c lw $25, 12($15)
# CHECK-NEXT: 20038: 03 20 00 09 jr $25
# CHECK-NEXT: 2003c: 25 f8 00 0c addiu $24, $15, 12
diff --git a/test/ELF/wrap.s b/test/ELF/wrap.s
index 17aac2db6e18..d8d802bb8ca4 100644
--- a/test/ELF/wrap.s
+++ b/test/ELF/wrap.s
@@ -12,6 +12,14 @@
// CHECK-NEXT: movl $0x11010, %edx
// CHECK-NEXT: movl $0x11000, %edx
+// RUN: llvm-readobj -t -s %t3 | FileCheck -check-prefix=SYM %s
+// SYM: Name: __real_foo
+// SYM-NEXT: Value: 0x11000
+// SYM: Name: __wrap_foo
+// SYM-NEXT: Value: 0x11010
+// SYM: Name: foo
+// SYM-NEXT: Value: 0x11010
+
.global _start
_start:
movl $foo, %edx
diff --git a/test/lit.cfg b/test/lit.cfg
index c8471e1280aa..0cb62d4cab97 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -45,7 +45,7 @@ else:
config.test_format = lit.formats.ShTest(execute_external)
# suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.ll', '.s', '.objtxt', '.test']
+config.suffixes = ['.ll', '.s', '.test', '.yaml', '.objtxt']
# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
# subdirectories contain auxiliary inputs for various tests in their parent
@@ -262,8 +262,7 @@ llvm_config_cmd.wait()
# Set a fake constant version so that we get consitent output.
config.environment['LLD_VERSION'] = 'LLD 1.0'
-# Check if Windows resource file compiler exists.
-cvtres = lit.util.which('cvtres', config.environment['PATH'])
-rc = lit.util.which('rc', config.environment['PATH'])
-if cvtres and rc:
- config.available_features.add('winres')
+# Indirectly check if the mt.exe Microsoft utility exists by searching for
+# cvtres, which always accompanies it.
+if lit.util.which('cvtres', config.environment['PATH']):
+ config.available_features.add('win_mt')
diff --git a/test/mach-o/executable-exports.yaml b/test/mach-o/executable-exports.yaml
index 0b8717eb724e..f16cbd5ce935 100644
--- a/test/mach-o/executable-exports.yaml
+++ b/test/mach-o/executable-exports.yaml
@@ -42,5 +42,5 @@ global-symbols:
...
# CHECK-NOT: _myHidden
-# CHECK: 0x00000FFD _myRegular
-# CHECK: 0x00000FFE _myWeak [weak_def]
+# CHECK: 0x100000FFD _myRegular
+# CHECK: 0x100000FFE _myWeak [weak_def]