aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:57:38 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:57:38 +0000
commit5a5c549fe9a3fef595297bd21d36bed8409dc37d (patch)
treea964c8f5ac85b7b641cac022c5f9bf4eed3d2b9b
parentfb911942f1434f3d1750f83f25f5e42c80e60638 (diff)
downloadsrc-5a5c549fe9a3fef595297bd21d36bed8409dc37d.tar.gz
src-5a5c549fe9a3fef595297bd21d36bed8409dc37d.zip
Vendor import of lld trunk r256633:vendor/lld/lld-trunk-r256633
Notes
Notes: svn path=/vendor/lld/dist/; revision=292934 svn path=/vendor/lld/lld-trunk-r256633/; revision=292935; tag=vendor/lld/lld-trunk-r256633
-rw-r--r--CMakeLists.txt5
-rw-r--r--CODE_OWNERS.TXT19
-rw-r--r--COFF/CMakeLists.txt33
-rw-r--r--COFF/Chunks.cpp340
-rw-r--r--COFF/Chunks.h332
-rw-r--r--COFF/Config.h140
-rw-r--r--COFF/DLL.cpp556
-rw-r--r--COFF/DLL.h84
-rw-r--r--COFF/Driver.cpp677
-rw-r--r--COFF/Driver.h180
-rw-r--r--COFF/DriverUtils.cpp718
-rw-r--r--COFF/Error.cpp30
-rw-r--r--COFF/Error.h28
-rw-r--r--COFF/ICF.cpp244
-rw-r--r--COFF/InputFiles.cpp367
-rw-r--r--COFF/InputFiles.h222
-rw-r--r--COFF/MarkLive.cpp61
-rw-r--r--COFF/ModuleDef.cpp291
-rw-r--r--COFF/Options.td125
-rw-r--r--COFF/PDB.cpp60
-rw-r--r--COFF/README.md265
-rw-r--r--COFF/SymbolTable.cpp445
-rw-r--r--COFF/SymbolTable.h125
-rw-r--r--COFF/Symbols.cpp243
-rw-r--r--COFF/Symbols.h407
-rw-r--r--COFF/Writer.cpp765
-rw-r--r--COFF/Writer.h26
-rw-r--r--ELF/CMakeLists.txt26
-rw-r--r--ELF/Config.h84
-rw-r--r--ELF/Driver.cpp299
-rw-r--r--ELF/Driver.h67
-rw-r--r--ELF/DriverUtils.cpp120
-rw-r--r--ELF/Error.cpp38
-rw-r--r--ELF/Error.h32
-rw-r--r--ELF/InputFiles.cpp496
-rw-r--r--ELF/InputFiles.h211
-rw-r--r--ELF/InputSection.cpp399
-rw-r--r--ELF/InputSection.h187
-rw-r--r--ELF/LinkerScript.cpp318
-rw-r--r--ELF/MarkLive.cpp131
-rw-r--r--ELF/Options.td161
-rw-r--r--ELF/OutputSections.cpp1534
-rw-r--r--ELF/OutputSections.h485
-rw-r--r--ELF/README.md21
-rw-r--r--ELF/SymbolTable.cpp267
-rw-r--r--ELF/SymbolTable.h98
-rw-r--r--ELF/Symbols.cpp148
-rw-r--r--ELF/Symbols.h327
-rw-r--r--ELF/Target.cpp1481
-rw-r--r--ELF/Target.h117
-rw-r--r--ELF/Writer.cpp1282
-rw-r--r--ELF/Writer.h24
-rw-r--r--Makefile86
-rw-r--r--docs/Makefile155
-rw-r--r--docs/Readers.rst7
-rw-r--r--docs/design.rst55
-rw-r--r--docs/getting_started.rst4
-rw-r--r--docs/index.rst11
-rw-r--r--docs/open_projects.rst1
-rw-r--r--docs/windows_support.rst31
-rw-r--r--include/Makefile4
-rw-r--r--include/lld/Config/Makefile32
-rw-r--r--include/lld/Core/Alias.h10
-rw-r--r--include/lld/Core/DefinedAtom.h14
-rw-r--r--include/lld/Core/Error.h26
-rw-r--r--include/lld/Core/File.h178
-rw-r--r--include/lld/Core/LLVM.h2
-rw-r--r--include/lld/Core/LinkingContext.h15
-rw-r--r--include/lld/Core/Parallel.h106
-rw-r--r--include/lld/Core/Pass.h4
-rw-r--r--include/lld/Core/PassManager.h7
-rw-r--r--include/lld/Core/Reader.h19
-rw-r--r--include/lld/Core/Reference.h2
-rw-r--r--include/lld/Core/Resolver.h2
-rw-r--r--include/lld/Core/SharedLibraryFile.h16
-rw-r--r--include/lld/Core/Simple.h87
-rw-r--r--include/lld/Core/SymbolTable.h2
-rw-r--r--include/lld/Core/TODO.txt2
-rw-r--r--include/lld/Core/Writer.h12
-rw-r--r--include/lld/Driver/Driver.h48
-rw-r--r--include/lld/Driver/WinLinkModuleDef.h200
-rw-r--r--include/lld/Makefile44
-rw-r--r--include/lld/ReaderWriter/ELFLinkingContext.h268
-rw-r--r--include/lld/ReaderWriter/ELFTargets.h38
-rw-r--r--include/lld/ReaderWriter/LinkerScript.h187
-rw-r--r--include/lld/ReaderWriter/MachOLinkingContext.h76
-rw-r--r--include/lld/ReaderWriter/PECOFFLinkingContext.h463
-rw-r--r--include/lld/ReaderWriter/RelocationHelperFunctions.h57
-rw-r--r--include/lld/ReaderWriter/YamlContext.h12
-rw-r--r--lib/Config/Makefile13
-rw-r--r--lib/Core/DefinedAtom.cpp1
-rw-r--r--lib/Core/Error.cpp52
-rw-r--r--lib/Core/File.cpp8
-rw-r--r--lib/Core/LinkingContext.cpp8
-rw-r--r--lib/Core/Makefile13
-rw-r--r--lib/Core/Reader.cpp16
-rw-r--r--lib/Core/Resolver.cpp57
-rw-r--r--lib/Core/SymbolTable.cpp13
-rw-r--r--lib/Core/TODO.txt18
-rw-r--r--lib/Core/Writer.cpp4
-rw-r--r--lib/Driver/CMakeLists.txt9
-rw-r--r--lib/Driver/CoreDriver.cpp23
-rw-r--r--lib/Driver/DarwinLdDriver.cpp234
-rw-r--r--lib/Driver/DarwinLdOptions.td22
-rw-r--r--lib/Driver/Driver.cpp82
-rw-r--r--lib/Driver/GnuLdDriver.cpp263
-rw-r--r--lib/Driver/GnuLdOptions.td67
-rw-r--r--lib/Driver/Makefile38
-rw-r--r--lib/Driver/TODO.rst2
-rw-r--r--lib/Driver/UniversalDriver.cpp71
-rw-r--r--lib/Driver/WinLinkDriver.cpp1371
-rw-r--r--lib/Driver/WinLinkModuleDef.cpp295
-rw-r--r--lib/Driver/WinLinkOptions.td120
-rw-r--r--lib/Makefile16
-rw-r--r--lib/ReaderWriter/CMakeLists.txt2
-rw-r--r--lib/ReaderWriter/CoreLinkingContext.cpp135
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h50
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64ELFFile.h41
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h62
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.cpp52
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.h48
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.cpp26
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.h8
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.cpp546
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h13
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp241
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64SectionChunks.cpp39
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64SectionChunks.h37
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp45
-rw-r--r--lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h68
-rw-r--r--lib/ReaderWriter/ELF/AArch64/CMakeLists.txt2
-rw-r--r--lib/ReaderWriter/ELF/AArch64/Makefile15
-rw-r--r--lib/ReaderWriter/ELF/AMDGPU/AMDGPUExecutableWriter.cpp34
-rw-r--r--lib/ReaderWriter/ELF/AMDGPU/AMDGPUExecutableWriter.h41
-rw-r--r--lib/ReaderWriter/ELF/AMDGPU/AMDGPULinkingContext.cpp41
-rw-r--r--lib/ReaderWriter/ELF/AMDGPU/AMDGPULinkingContext.h36
-rw-r--r--lib/ReaderWriter/ELF/AMDGPU/AMDGPURelocationHandler.cpp19
-rw-r--r--lib/ReaderWriter/ELF/AMDGPU/AMDGPURelocationHandler.h31
-rw-r--r--lib/ReaderWriter/ELF/AMDGPU/AMDGPUSymbolTable.cpp32
-rw-r--r--lib/ReaderWriter/ELF/AMDGPU/AMDGPUSymbolTable.h32
-rw-r--r--lib/ReaderWriter/ELF/AMDGPU/AMDGPUTargetHandler.cpp65
-rw-r--r--lib/ReaderWriter/ELF/AMDGPU/AMDGPUTargetHandler.h80
-rw-r--r--lib/ReaderWriter/ELF/AMDGPU/CMakeLists.txt13
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMDynamicLibraryWriter.h49
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMELFFile.h143
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMELFReader.h62
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMELFWriters.h120
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h99
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMLinkingContext.cpp48
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMLinkingContext.h46
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp578
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.h15
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp816
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMSymbolTable.h39
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp28
-rw-r--r--lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h162
-rw-r--r--lib/ReaderWriter/ELF/ARM/Makefile15
-rw-r--r--lib/ReaderWriter/ELF/ARM/TODO.rst13
-rw-r--r--lib/ReaderWriter/ELF/Atoms.cpp297
-rw-r--r--lib/ReaderWriter/ELF/Atoms.h468
-rw-r--r--lib/ReaderWriter/ELF/CMakeLists.txt11
-rw-r--r--lib/ReaderWriter/ELF/Chunk.h73
-rw-r--r--lib/ReaderWriter/ELF/CreateELF.h118
-rw-r--r--lib/ReaderWriter/ELF/DefaultLayout.h1050
-rw-r--r--lib/ReaderWriter/ELF/DefaultTargetHandler.h38
-rw-r--r--lib/ReaderWriter/ELF/DynamicFile.cpp146
-rw-r--r--lib/ReaderWriter/ELF/DynamicFile.h92
-rw-r--r--lib/ReaderWriter/ELF/DynamicLibraryWriter.h40
-rw-r--r--lib/ReaderWriter/ELF/ELFFile.cpp829
-rw-r--r--lib/ReaderWriter/ELF/ELFFile.h946
-rw-r--r--lib/ReaderWriter/ELF/ELFLinkingContext.cpp86
-rw-r--r--lib/ReaderWriter/ELF/ELFReader.h85
-rw-r--r--lib/ReaderWriter/ELF/ExecutableWriter.h137
-rw-r--r--lib/ReaderWriter/ELF/FileCommon.cpp66
-rw-r--r--lib/ReaderWriter/ELF/FileCommon.h45
-rw-r--r--lib/ReaderWriter/ELF/HeaderChunks.cpp205
-rw-r--r--lib/ReaderWriter/ELF/HeaderChunks.h278
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonDynamicLibraryWriter.h62
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonELFFile.h127
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonELFReader.h62
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonELFWriters.h61
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonEncodings.h37
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonExecutableAtoms.h29
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonExecutableWriter.h75
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp34
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.h22
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonRelocationFunctions.h49
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.cpp328
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h14
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonSectionChunks.h86
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp146
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h123
-rw-r--r--lib/ReaderWriter/ELF/Hexagon/Makefile16
-rw-r--r--lib/ReaderWriter/ELF/Layout.h59
-rw-r--r--lib/ReaderWriter/ELF/Makefile18
-rw-r--r--lib/ReaderWriter/ELF/Mips/CMakeLists.txt6
-rw-r--r--lib/ReaderWriter/ELF/Mips/Makefile15
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsAbiInfoHandler.cpp675
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsAbiInfoHandler.h83
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp7
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.h2
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h101
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h89
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsELFFile.cpp348
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsELFFile.h291
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsELFFlagsMerger.cpp149
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsELFFlagsMerger.h36
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsELFReader.h93
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsELFWriters.cpp292
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsELFWriters.h122
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h154
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp97
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h22
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp687
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.h14
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp783
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsSectionChunks.cpp264
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h174
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp171
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h224
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsTargetLayout.cpp111
-rw-r--r--lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h71
-rw-r--r--lib/ReaderWriter/ELF/OrderPass.h5
-rw-r--r--lib/ReaderWriter/ELF/OutputELFWriter.cpp514
-rw-r--r--lib/ReaderWriter/ELF/OutputELFWriter.h488
-rw-r--r--lib/ReaderWriter/ELF/Reader.cpp6
-rw-r--r--lib/ReaderWriter/ELF/SectionChunks.cpp996
-rw-r--r--lib/ReaderWriter/ELF/SectionChunks.h1124
-rw-r--r--lib/ReaderWriter/ELF/SegmentChunks.cpp519
-rw-r--r--lib/ReaderWriter/ELF/SegmentChunks.h486
-rw-r--r--lib/ReaderWriter/ELF/TargetHandler.h67
-rw-r--r--lib/ReaderWriter/ELF/TargetLayout.cpp747
-rw-r--r--lib/ReaderWriter/ELF/TargetLayout.h317
-rw-r--r--lib/ReaderWriter/ELF/Writer.cpp4
-rw-r--r--lib/ReaderWriter/ELF/Writer.h7
-rw-r--r--lib/ReaderWriter/ELF/X86/Makefile15
-rw-r--r--lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h49
-rw-r--r--lib/ReaderWriter/ELF/X86/X86ELFFile.h41
-rw-r--r--lib/ReaderWriter/ELF/X86/X86ELFReader.h62
-rw-r--r--lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h34
-rw-r--r--lib/ReaderWriter/ELF/X86/X86LinkingContext.cpp23
-rw-r--r--lib/ReaderWriter/ELF/X86/X86LinkingContext.h2
-rw-r--r--lib/ReaderWriter/ELF/X86/X86RelocationHandler.cpp17
-rw-r--r--lib/ReaderWriter/ELF/X86/X86RelocationHandler.h5
-rw-r--r--lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp29
-rw-r--r--lib/ReaderWriter/ELF/X86/X86TargetHandler.h35
-rw-r--r--lib/ReaderWriter/ELF/X86_64/CMakeLists.txt1
-rw-r--r--lib/ReaderWriter/ELF/X86_64/ExampleSubTarget/ExampleLinkingContext.cpp4
-rw-r--r--lib/ReaderWriter/ELF/X86_64/ExampleSubTarget/ExampleTargetHandler.cpp5
-rw-r--r--lib/ReaderWriter/ELF/X86_64/ExampleSubTarget/ExampleTargetHandler.h2
-rw-r--r--lib/ReaderWriter/ELF/X86_64/ExampleSubTarget/Makefile15
-rw-r--r--lib/ReaderWriter/ELF/X86_64/Makefile19
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64DynamicLibraryWriter.h38
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64ELFFile.h41
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h62
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64ElfType.h21
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64ExecutableWriter.h54
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp22
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.h7
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp54
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h10
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp62
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64SectionChunks.cpp37
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64SectionChunks.h36
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp30
-rw-r--r--lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h83
-rw-r--r--lib/ReaderWriter/FileArchive.cpp106
-rw-r--r--lib/ReaderWriter/LinkerScript.cpp411
-rw-r--r--lib/ReaderWriter/MachO/ArchHandler.h6
-rw-r--r--lib/ReaderWriter/MachO/ArchHandler_arm.cpp52
-rw-r--r--lib/ReaderWriter/MachO/ArchHandler_arm64.cpp23
-rw-r--r--lib/ReaderWriter/MachO/ArchHandler_x86.cpp21
-rw-r--r--lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp113
-rw-r--r--lib/ReaderWriter/MachO/Atoms.h36
-rw-r--r--lib/ReaderWriter/MachO/CMakeLists.txt1
-rw-r--r--lib/ReaderWriter/MachO/CompactUnwindPass.cpp85
-rw-r--r--lib/ReaderWriter/MachO/ExecutableAtoms.h133
-rw-r--r--lib/ReaderWriter/MachO/ExecutableAtoms.hpp136
-rw-r--r--lib/ReaderWriter/MachO/File.h40
-rw-r--r--lib/ReaderWriter/MachO/FlatNamespaceFile.h61
-rw-r--r--lib/ReaderWriter/MachO/GOTPass.cpp29
-rw-r--r--lib/ReaderWriter/MachO/LayoutPass.cpp22
-rw-r--r--lib/ReaderWriter/MachO/LayoutPass.h17
-rw-r--r--lib/ReaderWriter/MachO/MachOLinkingContext.cpp100
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFile.h59
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp52
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp75
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp202
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp302
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp6
-rw-r--r--lib/ReaderWriter/MachO/MachOPasses.h1
-rw-r--r--lib/ReaderWriter/MachO/Makefile14
-rw-r--r--lib/ReaderWriter/MachO/SectCreateFile.h93
-rw-r--r--lib/ReaderWriter/MachO/ShimPass.cpp23
-rw-r--r--lib/ReaderWriter/MachO/StubsPass.cpp70
-rw-r--r--lib/ReaderWriter/MachO/TLVPass.cpp137
-rw-r--r--lib/ReaderWriter/MachO/WriterMachO.cpp28
-rw-r--r--lib/ReaderWriter/Makefile16
-rw-r--r--lib/ReaderWriter/Native/CMakeLists.txt7
-rw-r--r--lib/ReaderWriter/Native/Makefile14
-rw-r--r--lib/ReaderWriter/Native/NativeFileFormat.h258
-rw-r--r--lib/ReaderWriter/Native/ReaderNative.cpp1013
-rw-r--r--lib/ReaderWriter/Native/WriterNative.cpp566
-rw-r--r--lib/ReaderWriter/PECOFF/Atoms.h312
-rw-r--r--lib/ReaderWriter/PECOFF/CMakeLists.txt16
-rw-r--r--lib/ReaderWriter/PECOFF/EdataPass.cpp227
-rw-r--r--lib/ReaderWriter/PECOFF/EdataPass.h99
-rw-r--r--lib/ReaderWriter/PECOFF/IdataPass.cpp345
-rw-r--r--lib/ReaderWriter/PECOFF/IdataPass.h218
-rw-r--r--lib/ReaderWriter/PECOFF/InferSubsystemPass.h66
-rw-r--r--lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.cpp48
-rw-r--r--lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h309
-rw-r--r--lib/ReaderWriter/PECOFF/LoadConfigPass.cpp75
-rw-r--r--lib/ReaderWriter/PECOFF/LoadConfigPass.h63
-rw-r--r--lib/ReaderWriter/PECOFF/Makefile14
-rw-r--r--lib/ReaderWriter/PECOFF/OrderPass.h67
-rw-r--r--lib/ReaderWriter/PECOFF/PDBPass.h43
-rw-r--r--lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp352
-rw-r--r--lib/ReaderWriter/PECOFF/Pass.cpp95
-rw-r--r--lib/ReaderWriter/PECOFF/Pass.h34
-rw-r--r--lib/ReaderWriter/PECOFF/ReaderCOFF.cpp1140
-rw-r--r--lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp389
-rw-r--r--lib/ReaderWriter/PECOFF/WriterImportLibrary.cpp118
-rw-r--r--lib/ReaderWriter/PECOFF/WriterImportLibrary.h23
-rw-r--r--lib/ReaderWriter/PECOFF/WriterPECOFF.cpp1417
-rw-r--r--lib/ReaderWriter/YAML/Makefile14
-rw-r--r--lib/ReaderWriter/YAML/ReaderWriterYAML.cpp137
-rw-r--r--test/CMakeLists.txt4
-rw-r--r--test/COFF/Inputs/armnt-executable.obj.yaml29
-rw-r--r--test/COFF/Inputs/armnt-executable.s13
-rw-r--r--test/COFF/Inputs/conflict.ll6
-rw-r--r--test/COFF/Inputs/entry-mangled.ll6
-rw-r--r--test/COFF/Inputs/export.ll18
-rw-r--r--test/COFF/Inputs/export.yaml57
-rw-r--r--test/COFF/Inputs/export2.yaml29
-rw-r--r--test/COFF/Inputs/hello32.yaml82
-rw-r--r--test/COFF/Inputs/hello64.asm24
-rw-r--r--test/COFF/Inputs/hello64.objbin0 -> 682 bytes
-rw-r--r--test/COFF/Inputs/import.yaml41
-rw-r--r--test/COFF/Inputs/imports-mangle.libbin0 -> 2114 bytes
-rw-r--r--test/COFF/Inputs/include1a.yaml33
-rw-r--r--test/COFF/Inputs/include1b.yaml33
-rw-r--r--test/COFF/Inputs/include1c.yaml29
-rwxr-xr-xtest/COFF/Inputs/library.lib (renamed from test/pecoff/Inputs/library.lib)bin1694 -> 1694 bytes
-rw-r--r--test/COFF/Inputs/lto-chkstk-chkstk.s3
-rw-r--r--test/COFF/Inputs/lto-chkstk-foo.s3
-rw-r--r--test/COFF/Inputs/lto-comdat1.ll13
-rw-r--r--test/COFF/Inputs/lto-comdat2.ll13
-rw-r--r--test/COFF/Inputs/lto-dep.ll10
-rw-r--r--test/COFF/Inputs/machine-x64.yaml29
-rw-r--r--test/COFF/Inputs/machine-x86.yaml29
-rw-r--r--[-rwxr-xr-x]test/COFF/Inputs/resource.res (renamed from test/pecoff/Inputs/resource.res)bin108 -> 108 bytes
-rw-r--r--test/COFF/Inputs/ret42.libbin0 -> 550 bytes
-rw-r--r--test/COFF/Inputs/ret42.objbin0 -> 408 bytes
-rw-r--r--test/COFF/Inputs/ret42.yaml45
-rw-r--r--test/COFF/Inputs/std32.libbin0 -> 1898 bytes
-rw-r--r--test/COFF/Inputs/std64.libbin0 -> 2068 bytes
-rw-r--r--test/COFF/Inputs/weak-external.ll6
-rw-r--r--test/COFF/Inputs/weak-external2.ll6
-rw-r--r--test/COFF/Inputs/weak-external3.ll8
-rw-r--r--test/COFF/alternatename.test61
-rw-r--r--test/COFF/ar-comdat.test38
-rw-r--r--test/COFF/armnt-blx23t.test66
-rw-r--r--test/COFF/armnt-branch24t.test59
-rw-r--r--test/COFF/armnt-entry-point.test5
-rw-r--r--test/COFF/armnt-imports.test51
-rw-r--r--test/COFF/armnt-mov32t-exec.test60
-rw-r--r--test/COFF/armnt-movt32t.test72
-rw-r--r--test/COFF/base.test57
-rw-r--r--test/COFF/baserel.test215
-rw-r--r--test/COFF/common.test102
-rw-r--r--test/COFF/conflict.test41
-rw-r--r--test/COFF/debug.test38
-rw-r--r--test/COFF/defparser.test13
-rw-r--r--test/COFF/delayimports.test41
-rw-r--r--test/COFF/delayimports32.test86
-rw-r--r--test/COFF/dll.test53
-rw-r--r--test/COFF/dllorder.test65
-rw-r--r--test/COFF/driver.test3
-rw-r--r--test/COFF/entry-inference.test50
-rw-r--r--test/COFF/entry-inference2.test39
-rw-r--r--test/COFF/entry-inference32.test35
-rw-r--r--test/COFF/entry-mangled.test35
-rw-r--r--test/COFF/entrylib.ll11
-rw-r--r--test/COFF/export-exe.test11
-rw-r--r--test/COFF/export.test82
-rw-r--r--test/COFF/export32.test133
-rw-r--r--test/COFF/failifmismatch.test11
-rw-r--r--test/COFF/filetype.test4
-rw-r--r--test/COFF/force.test43
-rw-r--r--test/COFF/heap.test25
-rw-r--r--test/COFF/hello32.test129
-rw-r--r--test/COFF/help.test3
-rw-r--r--test/COFF/icf-circular.test81
-rw-r--r--test/COFF/icf-circular2.test69
-rw-r--r--test/COFF/icf-different-align.test61
-rw-r--r--test/COFF/icf-local.test66
-rw-r--r--test/COFF/icf-simple.test71
-rw-r--r--test/COFF/imports-mangle.test66
-rw-r--r--test/COFF/imports.test35
-rw-r--r--test/COFF/include.test83
-rw-r--r--test/COFF/include2.test14
-rw-r--r--test/COFF/internal.test42
-rw-r--r--test/COFF/invalid-obj.test14
-rw-r--r--test/COFF/largeaddressaware.test21
-rw-r--r--test/COFF/libpath.test18
-rw-r--r--test/COFF/linkenv.test4
-rw-r--r--test/COFF/lldmap.test8
-rw-r--r--test/COFF/loadcfg.ll15
-rw-r--r--test/COFF/loadcfg.test59
-rw-r--r--test/COFF/loadcfg32.test42
-rw-r--r--test/COFF/locally-imported.test61
-rw-r--r--test/COFF/locally-imported32.test50
-rw-r--r--test/COFF/long-section-name.test58
-rw-r--r--test/COFF/lto-chkstk.ll17
-rw-r--r--test/COFF/lto-comdat.ll131
-rw-r--r--test/COFF/lto-linker-opts.ll11
-rw-r--r--test/COFF/lto-new-symbol.ll16
-rw-r--r--test/COFF/lto-opt-level.ll21
-rw-r--r--test/COFF/lto-parallel.ll20
-rw-r--r--test/COFF/lto.ll130
-rw-r--r--test/COFF/machine.test30
-rw-r--r--test/COFF/manifest.test61
-rw-r--r--test/COFF/merge.test53
-rw-r--r--test/COFF/nodefaultlib.test30
-rw-r--r--test/COFF/noentry.test11
-rw-r--r--test/COFF/opt.test69
-rw-r--r--test/COFF/options.test51
-rw-r--r--test/COFF/order.test15
-rw-r--r--test/COFF/out.test16
-rw-r--r--test/COFF/reloc-arm.test71
-rw-r--r--test/COFF/reloc-x64.test102
-rw-r--r--test/COFF/reloc-x86.test82
-rw-r--r--test/COFF/resource.test14
-rw-r--r--test/COFF/responsefile.test7
-rw-r--r--test/COFF/safeseh.test51
-rw-r--r--test/COFF/seh.test70
-rw-r--r--test/COFF/sort-debug.test296
-rw-r--r--test/COFF/stack.test25
-rw-r--r--test/COFF/subsystem-inference.test74
-rw-r--r--test/COFF/subsystem.test19
-rw-r--r--test/COFF/symtab.test254
-rw-r--r--test/COFF/tls.test43
-rw-r--r--test/COFF/tls32.test43
-rw-r--r--test/COFF/unwind.test198
-rw-r--r--test/COFF/version.test19
-rw-r--r--test/COFF/weak-external.test36
-rw-r--r--test/COFF/weak-external2.test30
-rw-r--r--test/COFF/weak-external3.test32
-rw-r--r--test/Driver/def-lib-search.test4
-rw-r--r--test/Driver/flavor-option.test2
-rw-r--r--test/Driver/lib-search.test10
-rw-r--r--test/Driver/so-whole-archive.test4
-rw-r--r--test/Driver/trivial-driver.test2
-rw-r--r--test/Driver/undef-basic.objtxt2
-rw-r--r--test/ELF/Inputs/abs.s4
-rw-r--r--test/ELF/Inputs/abs255.s2
-rw-r--r--test/ELF/Inputs/abs256.s2
-rw-r--r--test/ELF/Inputs/abs257.s2
-rw-r--r--test/ELF/Inputs/allow-multiple-definition.s4
-rw-r--r--test/ELF/Inputs/allow-shlib-undefined.s3
-rw-r--r--test/ELF/Inputs/archive.s5
-rw-r--r--test/ELF/Inputs/archive2.s2
-rw-r--r--test/ELF/Inputs/archive3.s2
-rw-r--r--test/ELF/Inputs/archive4.s1
-rw-r--r--test/ELF/Inputs/comdat.s3
-rw-r--r--test/ELF/Inputs/common.s3
-rw-r--r--test/ELF/Inputs/discard-merge-unnamed.obin0 -> 584 bytes
-rw-r--r--test/ELF/Inputs/dynamic-reloc.s2
-rw-r--r--test/ELF/Inputs/invalid-binding.elfbin0 -> 536 bytes
-rw-r--r--test/ELF/Inputs/invalid-data-encoding.abin0 -> 156 bytes
-rw-r--r--test/ELF/Inputs/invalid-file-class.abin0 -> 156 bytes
-rw-r--r--test/ELF/Inputs/invalid-multiple-eh-relocs.elfbin0 -> 784 bytes
-rw-r--r--test/ELF/Inputs/invalid-section-index.elfbin0 -> 544 bytes
-rw-r--r--test/ELF/Inputs/invalid-shentsize-zero.elfbin0 -> 512 bytes
-rwxr-xr-xtest/ELF/Inputs/invalid-shstrndx.sobin0 -> 13032 bytes
-rw-r--r--test/ELF/Inputs/invalid-symtab-sh_info.elfbin0 -> 512 bytes
-rw-r--r--test/ELF/Inputs/libsearch-dyn.s3
-rw-r--r--test/ELF/Inputs/libsearch-st.s3
-rw-r--r--test/ELF/Inputs/merge.s6
-rw-r--r--test/ELF/Inputs/mips-dynamic.s4
-rw-r--r--test/ELF/Inputs/no-symtab.o (renamed from test/elf/Inputs/stripped-empty.x86_64)bin416 -> 416 bytes
-rw-r--r--test/ELF/Inputs/relocation-copy-align.s9
-rw-r--r--test/ELF/Inputs/relocation-copy.s22
-rw-r--r--test/ELF/Inputs/relocation-size-shared.s6
-rw-r--r--test/ELF/Inputs/resolution.s107
-rw-r--r--test/ELF/Inputs/shared-ppc64.s9
-rw-r--r--test/ELF/Inputs/shared.s6
-rw-r--r--test/ELF/Inputs/shared2.s6
-rw-r--r--test/ELF/Inputs/shared3.s3
-rw-r--r--test/ELF/Inputs/tls-got.s14
-rw-r--r--test/ELF/Inputs/tls-mismatch.s4
-rw-r--r--test/ELF/Inputs/tls-opt-gdie.s20
-rw-r--r--test/ELF/Inputs/tls-opt-gdiele-i686.s20
-rw-r--r--test/ELF/Inputs/tls-opt-iele-i686-nopic.s15
-rw-r--r--test/ELF/Inputs/visibility.s13
-rw-r--r--test/ELF/Inputs/whole-archive.s2
-rw-r--r--test/ELF/aarch64-abs16.s27
-rw-r--r--test/ELF/aarch64-abs32.s27
-rw-r--r--test/ELF/aarch64-call26-error.s11
-rw-r--r--test/ELF/aarch64-copy.s93
-rw-r--r--test/ELF/aarch64-data-relocs.s23
-rw-r--r--test/ELF/aarch64-fpic-abs16.s7
-rw-r--r--test/ELF/aarch64-fpic-add_abs_lo12_nc.s10
-rw-r--r--test/ELF/aarch64-fpic-adr_prel_lo21.s10
-rw-r--r--test/ELF/aarch64-fpic-adr_prel_pg_hi21.s10
-rw-r--r--test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s10
-rw-r--r--test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s10
-rw-r--r--test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s10
-rw-r--r--test/ELF/aarch64-fpic-prel16.s7
-rw-r--r--test/ELF/aarch64-fpic-prel32.s7
-rw-r--r--test/ELF/aarch64-fpic-prel64.s7
-rw-r--r--test/ELF/aarch64-hi21-error.s10
-rw-r--r--test/ELF/aarch64-jump26-error.s11
-rw-r--r--test/ELF/aarch64-lo21-error.s10
-rw-r--r--test/ELF/aarch64-prel16.s31
-rw-r--r--test/ELF/aarch64-prel32.s31
-rw-r--r--test/ELF/aarch64-relocs.s122
-rw-r--r--test/ELF/allow-multiple-definition.s29
-rw-r--r--test/ELF/allow-shlib-undefined.s25
-rw-r--r--test/ELF/archive.s36
-rw-r--r--test/ELF/as-needed.s44
-rw-r--r--test/ELF/basic-aarch64.s193
-rw-r--r--test/ELF/basic-freebsd.s25
-rw-r--r--test/ELF/basic-mips.s272
-rw-r--r--test/ELF/basic.s216
-rw-r--r--test/ELF/basic32.s163
-rw-r--r--test/ELF/basic64be.s260
-rw-r--r--test/ELF/bss.s27
-rw-r--r--test/ELF/comdat.s72
-rw-r--r--test/ELF/common.s56
-rw-r--r--test/ELF/default-output.s16
-rw-r--r--test/ELF/discard-locals.s50
-rw-r--r--test/ELF/discard-merge-locals.s24
-rw-r--r--test/ELF/discard-merge-unnamed.s16
-rw-r--r--test/ELF/discard-none.s54
-rw-r--r--test/ELF/dt_flags.s21
-rw-r--r--test/ELF/duplicate-internal.s11
-rw-r--r--test/ELF/dynamic-reloc-index.s21
-rw-r--r--test/ELF/dynamic-reloc-weak.s33
-rw-r--r--test/ELF/dynamic-reloc.s64
-rw-r--r--test/ELF/eh-align-cie.s57
-rw-r--r--test/ELF/eh-frame-merge.s58
-rw-r--r--test/ELF/eh-frame-plt.s16
-rw-r--r--test/ELF/eh-frame-rel.s7
-rw-r--r--test/ELF/eh-frame-type.test16
-rw-r--r--test/ELF/ehframe-relocation.s29
-rw-r--r--test/ELF/empty-archive.s3
-rw-r--r--test/ELF/emulation.s177
-rw-r--r--test/ELF/end-preserve.s16
-rw-r--r--test/ELF/end-update.s29
-rw-r--r--test/ELF/end.s79
-rw-r--r--test/ELF/entry.s21
-rw-r--r--test/ELF/gc-sections-eh.s19
-rw-r--r--test/ELF/gc-sections-print.s23
-rw-r--r--test/ELF/gc-sections.s102
-rw-r--r--test/ELF/global_offset_table.s5
-rw-r--r--test/ELF/gnu-hash-table.s195
-rw-r--r--test/ELF/gnu-ifunc-i386.s130
-rw-r--r--test/ELF/gnu-ifunc-nosym-i386.s29
-rw-r--r--test/ELF/gnu-ifunc-nosym.s29
-rw-r--r--test/ELF/gnu-ifunc.s126
-rw-r--r--test/ELF/gnu-unique.s24
-rw-r--r--test/ELF/gnustack.s30
-rw-r--r--test/ELF/got-aarch64.s40
-rw-r--r--test/ELF/got-i386.s56
-rw-r--r--test/ELF/got.s45
-rw-r--r--test/ELF/incompatible-ar-first.s11
-rw-r--r--test/ELF/incompatible.s58
-rw-r--r--test/ELF/init-fini.s43
-rw-r--r--test/ELF/invalid-cie-length.s9
-rw-r--r--test/ELF/invalid-cie-length2.s9
-rw-r--r--test/ELF/invalid-cie-length3.s9
-rw-r--r--test/ELF/invalid-cie-length4.s10
-rw-r--r--test/ELF/invalid-cie-length5.s10
-rw-r--r--test/ELF/invalid-cie-reference.s32
-rw-r--r--test/ELF/invalid-elf.test34
-rw-r--r--test/ELF/invalid-fde-rel.s32
-rw-r--r--test/ELF/invalid-relocations.test22
-rw-r--r--test/ELF/libsearch.s83
-rw-r--r--test/ELF/linkerscript-ouputformat.s10
-rw-r--r--test/ELF/linkerscript-outputarch.s10
-rw-r--r--test/ELF/linkerscript-sections.s119
-rw-r--r--test/ELF/linkerscript.s114
-rw-r--r--test/ELF/linkerscript2.s11
-rw-r--r--test/ELF/lit.local.cfg2
-rw-r--r--test/ELF/local-dynamic.s83
-rw-r--r--test/ELF/local-got-shared.s35
-rw-r--r--test/ELF/local-got.s48
-rw-r--r--test/ELF/local.s82
-rw-r--r--test/ELF/many-sections.s116
-rw-r--r--test/ELF/merge-invalid-size.s7
-rw-r--r--test/ELF/merge-shared.s26
-rw-r--r--test/ELF/merge-string-align.s39
-rw-r--r--test/ELF/merge-string-error.s11
-rw-r--r--test/ELF/merge-string-no-null.s8
-rw-r--r--test/ELF/merge-string.s85
-rw-r--r--test/ELF/merge-sym.s21
-rw-r--r--test/ELF/merge.s109
-rw-r--r--test/ELF/mips-call16.s40
-rw-r--r--test/ELF/mips-dynamic.s91
-rw-r--r--test/ELF/mips-dynsym-sort.s43
-rw-r--r--test/ELF/mips-elf-flags.s27
-rw-r--r--test/ELF/mips-gnu-hash.s15
-rw-r--r--test/ELF/mips-got-relocs.s99
-rw-r--r--test/ELF/mips-gprel32-relocs.s31
-rw-r--r--test/ELF/mips-hilo-gp-disp.s42
-rw-r--r--test/ELF/mips-hilo-hi-only.s28
-rw-r--r--test/ELF/mips-hilo.s53
-rw-r--r--test/ELF/mips-jalr.test47
-rw-r--r--test/ELF/mips-pc-relocs.s38
-rw-r--r--test/ELF/mips-reginfo.s26
-rw-r--r--test/ELF/mips-relocs.s42
-rw-r--r--test/ELF/new-dtags.test15
-rw-r--r--test/ELF/no-inhibit-exec.s15
-rw-r--r--test/ELF/no-obj.s8
-rw-r--r--test/ELF/no-symtab.s4
-rw-r--r--test/ELF/no-undefined.s7
-rw-r--r--test/ELF/output-section.s34
-rw-r--r--test/ELF/plt-aarch64.s205
-rw-r--r--test/ELF/plt-i686.s158
-rw-r--r--test/ELF/plt.s119
-rw-r--r--test/ELF/ppc64-addr16-error.s7
-rw-r--r--test/ELF/ppc64-rel-calls.s42
-rw-r--r--test/ELF/ppc64-relocs.s130
-rw-r--r--test/ELF/ppc64-shared-rel-toc.s27
-rw-r--r--test/ELF/ppc64-toc-restore.s62
-rw-r--r--test/ELF/ppc64-weak-undef-call-shared.s16
-rw-r--r--test/ELF/ppc64-weak-undef-call.s27
-rw-r--r--test/ELF/pre_init_fini_array.s140
-rw-r--r--test/ELF/pre_init_fini_array_missing.s30
-rw-r--r--test/ELF/progname.s20
-rw-r--r--test/ELF/program-header-layout.s98
-rw-r--r--test/ELF/relative-dynamic-reloc-ppc64.s66
-rw-r--r--test/ELF/relative-dynamic-reloc.s69
-rw-r--r--test/ELF/relocatable.s9
-rw-r--r--test/ELF/relocation-absolute.s12
-rw-r--r--test/ELF/relocation-common.s14
-rw-r--r--test/ELF/relocation-copy-align.s31
-rw-r--r--test/ELF/relocation-copy-i686.s63
-rw-r--r--test/ELF/relocation-copy.s63
-rw-r--r--test/ELF/relocation-i686.s84
-rw-r--r--test/ELF/relocation-in-merge.s7
-rw-r--r--test/ELF/relocation-local.s38
-rw-r--r--test/ELF/relocation-past-merge-end.s7
-rw-r--r--test/ELF/relocation-size-shared.s78
-rw-r--r--test/ELF/relocation-size.s123
-rw-r--r--test/ELF/relocation-undefined-weak.s27
-rw-r--r--test/ELF/relocation.s117
-rw-r--r--test/ELF/relro.s242
-rw-r--r--test/ELF/resolution.s430
-rw-r--r--test/ELF/section-align-0.test19
-rw-r--r--test/ELF/section-layout.s54
-rw-r--r--test/ELF/section-name.s37
-rw-r--r--test/ELF/section-symbol.s29
-rw-r--r--test/ELF/shared-be.s35
-rw-r--r--test/ELF/shared.s294
-rw-r--r--test/ELF/soname.s11
-rw-r--r--test/ELF/soname2.s8
-rw-r--r--test/ELF/startstop-shared.s18
-rw-r--r--test/ELF/startstop.s61
-rw-r--r--test/ELF/string-table.s80
-rw-r--r--test/ELF/strip-all.s25
-rw-r--r--test/ELF/symbols.s182
-rw-r--r--test/ELF/sysroot.s36
-rw-r--r--test/ELF/tls-align.s21
-rw-r--r--test/ELF/tls-dynamic-i686.s92
-rw-r--r--test/ELF/tls-dynamic.s81
-rw-r--r--test/ELF/tls-error.s12
-rw-r--r--test/ELF/tls-got.s58
-rw-r--r--test/ELF/tls-i686.s69
-rw-r--r--test/ELF/tls-mismatch.s9
-rw-r--r--test/ELF/tls-opt-gdie.s55
-rw-r--r--test/ELF/tls-opt-gdiele-i686.s59
-rw-r--r--test/ELF/tls-opt-i686.s69
-rw-r--r--test/ELF/tls-opt-iele-i686-nopic.s159
-rw-r--r--test/ELF/tls-opt-local.s52
-rw-r--r--test/ELF/tls-opt.s93
-rw-r--r--test/ELF/tls-static.s13
-rw-r--r--test/ELF/tls.s170
-rw-r--r--test/ELF/undef-start.s4
-rw-r--r--test/ELF/undef.s8
-rw-r--r--test/ELF/undefined-opt.s55
-rw-r--r--test/ELF/valid-cie-length-dw64.s13
-rw-r--r--test/ELF/visibility.s108
-rw-r--r--test/ELF/whole-archive.s34
-rw-r--r--test/ELF/writable-merge.s6
-rw-r--r--test/ELF/x86-64-reloc-32-error.s8
-rw-r--r--test/ELF/x86-64-reloc-32S-error.s7
-rw-r--r--test/LinkerScript/phdrs-sections.test29
-rw-r--r--test/LinkerScript/sections.test6
-rw-r--r--test/Makefile71
-rw-r--r--test/core/Inputs/archive-basic.objtxt21
-rw-r--r--test/core/Inputs/archive-chain.objtxt24
-rw-r--r--test/core/Inputs/archive-chain2.objtxt21
-rw-r--r--test/core/Inputs/archive-tentdef-search.objtxt11
-rw-r--r--test/core/Inputs/associates.objtxt8
-rw-r--r--test/core/Inputs/auto-hide-coalesce.objtxt20
-rw-r--r--test/core/Inputs/code-model-attributes.objtxt4
-rw-r--r--test/core/Inputs/code-model-attributes2.objtxt4
-rw-r--r--test/core/Inputs/code-model-attributes3.objtxt4
-rw-r--r--test/core/Inputs/code-model-attributes4.objtxt4
-rw-r--r--test/core/Inputs/code-model-attributes5.objtxt4
-rw-r--r--test/core/Inputs/constants-coalesce.objtxt9
-rw-r--r--test/core/Inputs/constants-coalesce2.objtxt10
-rw-r--r--test/core/Inputs/cstring-coalesce.objtxt6
-rw-r--r--test/core/Inputs/cstring-coalesce2.objtxt6
-rw-r--r--test/core/Inputs/custom-section-coalesce.objtxt15
-rw-r--r--test/core/Inputs/custom-section-coalesce2.objtxt13
-rw-r--r--test/core/Inputs/dead-strip-attributes.objtxt4
-rw-r--r--test/core/Inputs/dead-strip-attributes2.objtxt4
-rw-r--r--test/core/Inputs/dead-strip-basic.objtxt9
-rw-r--r--test/core/Inputs/dead-strip-basic2.objtxt8
-rw-r--r--test/core/Inputs/dead-strip-globals.objtxt9
-rw-r--r--test/core/Inputs/dead-strip-globals2.objtxt8
-rw-r--r--test/core/Inputs/error-duplicate-absolutes.objtxt5
-rw-r--r--test/core/Inputs/gnulinkonce-rearrange-resolve.objtxt26
-rw-r--r--test/core/Inputs/gnulinkonce-remaining-undef.objtxt34
-rw-r--r--test/core/Inputs/gnulinkonce-remaining-undef2.objtxt4
-rw-r--r--test/core/Inputs/gnulinkonce-resolve.objtxt25
-rw-r--r--test/core/Inputs/gnulinkonce-simple.objtxt4
-rw-r--r--test/core/Inputs/inline-coalesce.objtxt6
-rw-r--r--test/core/Inputs/inline-coalesce2.objtxt6
-rw-r--r--test/core/Inputs/multiple-def-error.objtxt5
-rw-r--r--test/core/Inputs/sectiongroup-deadstrip.objtxt3
-rw-r--r--test/core/Inputs/sectiongroup-gnulinkonce-error.objtxt26
-rw-r--r--test/core/Inputs/sectiongroup-rearrange-resolve.objtxt25
-rw-r--r--test/core/Inputs/sectiongroup-remaining-undef.objtxt34
-rw-r--r--test/core/Inputs/sectiongroup-remaining-undef2.objtxt4
-rw-r--r--test/core/Inputs/sectiongroup-resolve.objtxt26
-rw-r--r--test/core/Inputs/sectiongroup-simple.objtxt4
-rw-r--r--test/core/Inputs/shared-library-coalesce.objtxt28
-rw-r--r--test/core/Inputs/tent-merge.objtxt6
-rw-r--r--test/core/Inputs/undef-coalesce-error.objtxt8
-rw-r--r--test/core/Inputs/undef-coalesce-error2.objtxt8
-rw-r--r--test/core/Inputs/undef-coalesce.objtxt8
-rw-r--r--test/core/Inputs/undef-coalesce2.objtxt8
-rw-r--r--test/core/Inputs/undef-fallback.objtxt7
-rw-r--r--test/core/Inputs/undef-weak-coalesce.objtxt20
-rw-r--r--test/core/Inputs/weak-coalesce.objtxt5
-rw-r--r--test/core/Inputs/weak-coalesce2.objtxt6
-rw-r--r--test/core/archive-basic.objtxt23
-rw-r--r--test/core/archive-chain.objtxt49
-rw-r--r--test/core/archive-tentdef-search.objtxt16
-rw-r--r--test/core/associates.objtxt11
-rw-r--r--test/core/auto-hide-coalesce.objtxt23
-rw-r--r--test/core/code-model-attributes.objtxt27
-rw-r--r--test/core/constants-coalesce.objtxt22
-rw-r--r--test/core/cstring-coalesce.objtxt12
-rw-r--r--test/core/custom-section-coalesce.objtxt32
-rw-r--r--test/core/dead-strip-attributes.objtxt11
-rw-r--r--test/core/dead-strip-basic.objtxt21
-rw-r--r--test/core/dead-strip-globals.objtxt21
-rw-r--r--test/core/error-duplicate-absolutes.objtxt7
-rw-r--r--test/core/gnulinkonce-rearrange-resolve.objtxt28
-rw-r--r--test/core/gnulinkonce-remaining-undef.objtxt41
-rw-r--r--test/core/gnulinkonce-resolve.objtxt28
-rw-r--r--test/core/gnulinkonce-simple.objtxt6
-rw-r--r--test/core/inline-coalesce.objtxt14
-rw-r--r--test/core/multiple-def-error.objtxt7
-rw-r--r--test/core/sectiongroup-deadstrip.objtxt6
-rw-r--r--test/core/sectiongroup-gnulinkonce-error.objtxt28
-rw-r--r--test/core/sectiongroup-rearrange-resolve.objtxt28
-rw-r--r--test/core/sectiongroup-remaining-undef.objtxt40
-rw-r--r--test/core/sectiongroup-resolve.objtxt26
-rw-r--r--test/core/sectiongroup-simple.objtxt4
-rw-r--r--test/core/shared-library-coalesce.objtxt31
-rw-r--r--test/core/tent-merge.objtxt8
-rw-r--r--test/core/undef-coalesce-error.objtxt20
-rw-r--r--test/core/undef-coalesce.objtxt18
-rw-r--r--test/core/undef-fallback.objtxt10
-rw-r--r--test/core/undef-weak-coalesce.objtxt22
-rw-r--r--test/core/weak-coalesce.objtxt18
-rw-r--r--test/darwin/Inputs/native-and-mach-o.objtxt17
-rw-r--r--test/darwin/Inputs/native-and-mach-o2.objtxt19
-rw-r--r--test/darwin/native-and-mach-o.objtxt44
-rw-r--r--test/elf/AArch64/defsym.test22
-rw-r--r--test/elf/AArch64/dontignorezerosize-sections.test9
-rw-r--r--test/elf/AArch64/dynlib-nointerp-section.test5
-rw-r--r--test/elf/AArch64/initfini.test23
-rw-r--r--test/elf/AArch64/rel-abs32-overflow.test53
-rw-r--r--test/elf/AArch64/rel-abs32.test59
-rw-r--r--test/elf/AArch64/rel-abs64.test59
-rw-r--r--test/elf/AArch64/rel-bad.test44
-rw-r--r--test/elf/ARM/arm-symbols.test52
-rw-r--r--test/elf/ARM/defsym.test51
-rw-r--r--test/elf/ARM/entry-point.test77
-rw-r--r--test/elf/ARM/missing-symbol.test39
-rw-r--r--test/elf/ARM/rel-abs32.test59
-rw-r--r--test/elf/ARM/rel-arm-call.test60
-rw-r--r--test/elf/ARM/rel-arm-jump24-veneer-b.test101
-rw-r--r--test/elf/ARM/rel-arm-jump24-veneer-bl.test100
-rw-r--r--test/elf/ARM/rel-arm-jump24.test58
-rw-r--r--test/elf/ARM/rel-arm-mov.test64
-rw-r--r--test/elf/ARM/rel-arm-prel31.test47
-rw-r--r--test/elf/ARM/rel-arm-thm-interwork.test123
-rw-r--r--test/elf/ARM/rel-rel32.test57
-rw-r--r--test/elf/ARM/rel-thm-call.test61
-rw-r--r--test/elf/ARM/rel-thm-jump11.test141
-rw-r--r--test/elf/ARM/rel-thm-jump24-veneer.test100
-rw-r--r--test/elf/ARM/rel-thm-jump24.test59
-rw-r--r--test/elf/ARM/rel-thm-mov.test70
-rw-r--r--test/elf/ARM/rel-tls-ie32.test109
-rw-r--r--test/elf/ARM/rel-tls-le32.test61
-rw-r--r--test/elf/ARM/thm-symbols.test52
-rw-r--r--test/elf/ARM/undef-lazy-symbol.test135
-rw-r--r--test/elf/Hexagon/dynlib-data.test9
-rw-r--r--test/elf/Hexagon/dynlib-gotoff.test128
-rw-r--r--test/elf/Hexagon/dynlib-hash.test9
-rw-r--r--test/elf/Hexagon/dynlib-rela.test9
-rw-r--r--test/elf/Hexagon/dynlib-syms.test7
-rw-r--r--test/elf/Hexagon/dynlib.test36
-rw-r--r--test/elf/Hexagon/hexagon-got-plt-order.test5
-rw-r--r--test/elf/Hexagon/hexagon-plt-setup.test12
-rw-r--r--test/elf/Hexagon/maxalignment.test8
-rw-r--r--test/elf/Hexagon/rela-order.test9
-rw-r--r--test/elf/Hexagon/sda-base.test4
-rw-r--r--test/elf/Hexagon/zerofillquick-sdata.test18
-rw-r--r--test/elf/Inputs/consecutive-weak-defs.o.yaml66
-rw-r--r--test/elf/Inputs/init_array.x86-64bin3440 -> 0 bytes
-rw-r--r--test/elf/Inputs/main-with-global-def.o.yaml56
-rw-r--r--test/elf/Inputs/undef2-so.o.yaml50
-rw-r--r--test/elf/Mips/base-address-64.test78
-rw-r--r--test/elf/Mips/base-address.test109
-rw-r--r--test/elf/Mips/ctors-order.test163
-rw-r--r--test/elf/Mips/dt-textrel-64.test74
-rw-r--r--test/elf/Mips/dt-textrel.test74
-rw-r--r--test/elf/Mips/dynlib-dynamic.test110
-rw-r--r--test/elf/Mips/dynlib-dynsym-micro.test208
-rw-r--r--test/elf/Mips/dynlib-dynsym.test202
-rw-r--r--test/elf/Mips/dynlib-fileheader-64.test72
-rw-r--r--test/elf/Mips/dynlib-fileheader-micro-64.test75
-rw-r--r--test/elf/Mips/dynlib-fileheader-micro.test82
-rw-r--r--test/elf/Mips/dynlib-fileheader.test80
-rw-r--r--test/elf/Mips/dynsym-table-1.test127
-rw-r--r--test/elf/Mips/dynsym-table-2.test105
-rw-r--r--test/elf/Mips/e-flags-merge-1-64.test30
-rw-r--r--test/elf/Mips/e-flags-merge-1.test56
-rw-r--r--test/elf/Mips/e-flags-merge-10.test43
-rw-r--r--test/elf/Mips/e-flags-merge-11.test43
-rw-r--r--test/elf/Mips/e-flags-merge-2-64.test33
-rw-r--r--test/elf/Mips/e-flags-merge-2.test35
-rw-r--r--test/elf/Mips/e-flags-merge-3-64.test130
-rw-r--r--test/elf/Mips/e-flags-merge-3.test134
-rw-r--r--test/elf/Mips/e-flags-merge-4-64.test64
-rw-r--r--test/elf/Mips/e-flags-merge-4.test65
-rw-r--r--test/elf/Mips/e-flags-merge-5-64.test42
-rw-r--r--test/elf/Mips/e-flags-merge-5.test42
-rw-r--r--test/elf/Mips/e-flags-merge-6-64.test79
-rw-r--r--test/elf/Mips/e-flags-merge-6.test80
-rw-r--r--test/elf/Mips/e-flags-merge-7-64.test42
-rw-r--r--test/elf/Mips/e-flags-merge-7.test42
-rw-r--r--test/elf/Mips/e-flags-merge-8.test65
-rw-r--r--test/elf/Mips/e-flags-merge-9.test43
-rw-r--r--test/elf/Mips/entry-name.test26
-rw-r--r--test/elf/Mips/exe-dynamic.test108
-rw-r--r--test/elf/Mips/exe-dynsym-micro.test94
-rw-r--r--test/elf/Mips/exe-dynsym.test91
-rw-r--r--test/elf/Mips/exe-fileheader-64.test66
-rw-r--r--test/elf/Mips/exe-fileheader-micro-64.test68
-rw-r--r--test/elf/Mips/exe-fileheader-micro.test69
-rw-r--r--test/elf/Mips/exe-fileheader.test105
-rw-r--r--test/elf/Mips/exe-got-micro.test115
-rw-r--r--test/elf/Mips/exe-got.test116
-rw-r--r--test/elf/Mips/got-page-32.test203
-rw-r--r--test/elf/Mips/got-page-64.test203
-rw-r--r--test/elf/Mips/got16-2.test73
-rw-r--r--test/elf/Mips/got16-micro.test165
-rw-r--r--test/elf/Mips/got16.test196
-rw-r--r--test/elf/Mips/gotsym.test43
-rw-r--r--test/elf/Mips/gp-sym-1-micro.test88
-rw-r--r--test/elf/Mips/gp-sym-1.test86
-rw-r--r--test/elf/Mips/gp-sym-2.test103
-rw-r--r--test/elf/Mips/hilo16-1.test44
-rw-r--r--test/elf/Mips/hilo16-2.test68
-rw-r--r--test/elf/Mips/hilo16-3.test45
-rw-r--r--test/elf/Mips/hilo16-4.test93
-rw-r--r--test/elf/Mips/hilo16-5.test103
-rw-r--r--test/elf/Mips/hilo16-8-micro.test81
-rw-r--r--test/elf/Mips/hilo16-9-micro.test68
-rw-r--r--test/elf/Mips/initfini-micro.test45
-rw-r--r--test/elf/Mips/interpreter-64.test26
-rw-r--r--test/elf/Mips/interpreter.test26
-rw-r--r--test/elf/Mips/invalid-reginfo.test28
-rw-r--r--test/elf/Mips/jalx-align-err.test46
-rw-r--r--test/elf/Mips/jump-fix-err.test45
-rw-r--r--test/elf/Mips/la25-stub-micro.test140
-rw-r--r--test/elf/Mips/la25-stub.test133
-rw-r--r--test/elf/Mips/mips-options-gp0.test78
-rw-r--r--test/elf/Mips/n64-rel-chain.test134
-rw-r--r--test/elf/Mips/opt-emulation.test41
-rw-r--r--test/elf/Mips/pc23-range.test56
-rw-r--r--test/elf/Mips/plt-entry-mixed-1.test114
-rw-r--r--test/elf/Mips/plt-entry-mixed-2.test93
-rw-r--r--test/elf/Mips/plt-entry-mixed-3.test98
-rw-r--r--test/elf/Mips/plt-entry-mixed-4.test85
-rw-r--r--test/elf/Mips/plt-entry-r6.test109
-rw-r--r--test/elf/Mips/plt-header-micro.test108
-rw-r--r--test/elf/Mips/plt-header-mixed.test105
-rw-r--r--test/elf/Mips/plt-header.test99
-rw-r--r--test/elf/Mips/r26-1-micro.test131
-rw-r--r--test/elf/Mips/r26-1.test132
-rw-r--r--test/elf/Mips/r26-2-micro.test88
-rw-r--r--test/elf/Mips/r26-2.test82
-rw-r--r--test/elf/Mips/rel-32.test59
-rw-r--r--test/elf/Mips/rel-64.test61
-rw-r--r--test/elf/Mips/rel-copy-micro.test159
-rw-r--r--test/elf/Mips/rel-copy-pc.test113
-rw-r--r--test/elf/Mips/rel-copy.test177
-rw-r--r--test/elf/Mips/rel-dynamic-01-micro.test201
-rw-r--r--test/elf/Mips/rel-dynamic-01.test237
-rw-r--r--test/elf/Mips/rel-dynamic-02.test82
-rw-r--r--test/elf/Mips/rel-dynamic-03-micro.test133
-rw-r--r--test/elf/Mips/rel-dynamic-03.test129
-rw-r--r--test/elf/Mips/rel-dynamic-04-micro.test211
-rw-r--r--test/elf/Mips/rel-dynamic-04.test206
-rw-r--r--test/elf/Mips/rel-dynamic-05-micro.test192
-rw-r--r--test/elf/Mips/rel-dynamic-05.test188
-rw-r--r--test/elf/Mips/rel-dynamic-06-64.test101
-rw-r--r--test/elf/Mips/rel-dynamic-06.test103
-rw-r--r--test/elf/Mips/rel-dynamic-07-64.test261
-rw-r--r--test/elf/Mips/rel-dynamic-07.test276
-rw-r--r--test/elf/Mips/rel-dynamic-08-64.test233
-rw-r--r--test/elf/Mips/rel-dynamic-08-micro.test236
-rw-r--r--test/elf/Mips/rel-dynamic-08.test233
-rw-r--r--test/elf/Mips/rel-dynamic-09-micro.test109
-rw-r--r--test/elf/Mips/rel-dynamic-09.test107
-rw-r--r--test/elf/Mips/rel-dynamic-10-micro.test166
-rw-r--r--test/elf/Mips/rel-dynamic-10.test160
-rw-r--r--test/elf/Mips/rel-dynamic-11.test110
-rw-r--r--test/elf/Mips/rel-dynamic-12.test213
-rw-r--r--test/elf/Mips/rel-gprel16.test104
-rw-r--r--test/elf/Mips/rel-gprel32-64.test70
-rw-r--r--test/elf/Mips/rel-gprel32.test84
-rw-r--r--test/elf/Mips/rel-pc-hilo.test70
-rw-r--r--test/elf/Mips/rel-pc18-s3.test54
-rw-r--r--test/elf/Mips/rel-pc19-s2.test54
-rw-r--r--test/elf/Mips/rel-pc21-s2.test54
-rw-r--r--test/elf/Mips/rel-pc26-s2.test54
-rw-r--r--test/elf/Mips/rel-pc32.test59
-rw-r--r--test/elf/Mips/rel-pc7-10-16-23.test86
-rw-r--r--test/elf/Mips/rel-sub.test61
-rw-r--r--test/elf/Mips/st-other.test90
-rw-r--r--test/elf/Mips/tls-1-micro.test65
-rw-r--r--test/elf/Mips/tls-1.test63
-rw-r--r--test/elf/Mips/tls-2-64.test69
-rw-r--r--test/elf/Mips/tls-2-micro.test70
-rw-r--r--test/elf/Mips/tls-2.test69
-rw-r--r--test/elf/Mips/tls-3-micro.test183
-rw-r--r--test/elf/Mips/tls-3.test180
-rw-r--r--test/elf/Mips/tls-4-micro.test126
-rw-r--r--test/elf/Mips/tls-4.test123
-rw-r--r--test/elf/Mips/tls-5-64.test71
-rw-r--r--test/elf/Mips/tls-5-micro.test70
-rw-r--r--test/elf/Mips/tls-5.test69
-rw-r--r--test/elf/X86_64/ExampleTarget/triple.test32
-rw-r--r--test/elf/X86_64/Inputs/generaltls-so.o.yaml68
-rw-r--r--test/elf/X86_64/alignoffset.test119
-rw-r--r--test/elf/X86_64/debug.test57
-rw-r--r--test/elf/X86_64/defsym.test22
-rw-r--r--test/elf/X86_64/demangle.test12
-rw-r--r--test/elf/X86_64/dontignorezerosize-sections.test9
-rw-r--r--test/elf/X86_64/dynamicvars.test124
-rw-r--r--test/elf/X86_64/dynlib-nointerp-section.test4
-rw-r--r--test/elf/X86_64/dynlib-search.test6
-rw-r--r--test/elf/X86_64/dynsym-weak.test118
-rw-r--r--test/elf/X86_64/extern-tls.test16
-rw-r--r--test/elf/X86_64/general-dynamic-tls.test129
-rw-r--r--test/elf/X86_64/imagebase.test94
-rw-r--r--test/elf/X86_64/initfini-order.test10
-rw-r--r--test/elf/X86_64/initfini.test23
-rw-r--r--test/elf/X86_64/largebss.test20
-rw-r--r--test/elf/X86_64/layoutpass-order.test14
-rw-r--r--test/elf/X86_64/maxpagesize.test113
-rw-r--r--test/elf/X86_64/mergesimilarstrings.test47
-rw-r--r--test/elf/X86_64/multi-weak-layout.test52
-rw-r--r--test/elf/X86_64/multi-weak-override.test16
-rw-r--r--test/elf/X86_64/multi-weak-syms-order.test13
-rw-r--r--test/elf/X86_64/nmagic.test91
-rw-r--r--test/elf/X86_64/noalignsegments.test95
-rw-r--r--test/elf/X86_64/note-sections-ro_plus_rw.test42
-rw-r--r--test/elf/X86_64/note-sections.test23
-rw-r--r--test/elf/X86_64/omagic.test237
-rw-r--r--test/elf/X86_64/outputsegments.test189
-rw-r--r--test/elf/X86_64/reloc_r_x86_64_16.test60
-rw-r--r--test/elf/X86_64/reloc_r_x86_64_pc16.test61
-rw-r--r--test/elf/X86_64/reloc_r_x86_64_pc64.test61
-rw-r--r--test/elf/X86_64/rodata.test9
-rw-r--r--test/elf/X86_64/sectionchoice.test7
-rw-r--r--test/elf/X86_64/sectionmap.test22
-rw-r--r--test/elf/X86_64/startGroupEndGroup.test48
-rw-r--r--test/elf/X86_64/startGroupEndGroupWithDynlib.test10
-rw-r--r--test/elf/X86_64/staticlib-search.test6
-rw-r--r--test/elf/X86_64/undef.test18
-rw-r--r--test/elf/X86_64/underscore-end.test81
-rw-r--r--test/elf/X86_64/weak-override.test45
-rw-r--r--test/elf/X86_64/weak-zero-sized.test26
-rw-r--r--test/elf/X86_64/weaksym.test78
-rw-r--r--test/elf/X86_64/yamlinput.test166
-rw-r--r--test/elf/abs-dup.objtxt19
-rw-r--r--test/elf/abs.test19
-rw-r--r--test/elf/allowduplicates.objtxt51
-rw-r--r--test/elf/archive-elf-forceload.test43
-rw-r--r--test/elf/archive-elf.test38
-rw-r--r--test/elf/as-needed.test15
-rw-r--r--test/elf/branch.test34
-rw-r--r--test/elf/check.test39
-rw-r--r--test/elf/checkrodata.test9
-rw-r--r--test/elf/common.test10
-rw-r--r--test/elf/consecutive-weak-sym-defs.test81
-rw-r--r--test/elf/defsym.objtxt28
-rw-r--r--test/elf/dynamic-segorder.test17
-rw-r--r--test/elf/dynamic-undef.test34
-rw-r--r--test/elf/dynamic.test80
-rw-r--r--test/elf/eh_frame_hdr.test30
-rw-r--r--test/elf/entry.objtxt58
-rw-r--r--test/elf/export-dynamic.test99
-rw-r--r--test/elf/filenotfound.test3
-rw-r--r--test/elf/gnulinkonce/gnulinkonce-report-discarded-reference.test147
-rw-r--r--test/elf/gnulinkonce/gnulinkonce-report-undef.test129
-rw-r--r--test/elf/gnulinkonce/gnulinkonce.test151
-rw-r--r--test/elf/gotpcrel.test21
-rw-r--r--test/elf/gottpoff.test120
-rw-r--r--test/elf/group-cmd-search.test134
-rw-r--r--test/elf/hexagon-quickdata-sort.test12
-rw-r--r--test/elf/hexagon-quickdata-sortcommon.test16
-rw-r--r--test/elf/ifunc.test69
-rw-r--r--test/elf/ignore-unknownoption.test5
-rw-r--r--test/elf/init_array-order.test67
-rw-r--r--test/elf/init_array.test6
-rw-r--r--test/elf/initfini-options.test-1.test33
-rw-r--r--test/elf/initfini-options.test-2.test47
-rw-r--r--test/elf/initfini-options.test-3.test53
-rw-r--r--test/elf/librarynotfound.test5
-rw-r--r--test/elf/linker-as-ld.test16
-rw-r--r--test/elf/linkerscript/Inputs/prog1.o.yaml88
-rw-r--r--test/elf/linkerscript/Inputs/prog2.o.yaml89
-rw-r--r--test/elf/linkerscript/Inputs/prog3.o.yaml52
-rw-r--r--test/elf/linkerscript/Inputs/simple.o.yaml52
-rw-r--r--test/elf/linkerscript/externs.objtxt21
-rw-r--r--test/elf/linkerscript/invalid-script-cli-1.test10
-rw-r--r--test/elf/linkerscript/invalid-script-cli-2.test6
-rw-r--r--test/elf/linkerscript/invalid.test5
-rw-r--r--test/elf/linkerscript/sections-order.test97
-rw-r--r--test/elf/linkerscript/sections-with-wildcards.test88
-rw-r--r--test/elf/linkerscript/symbol-definition.test54
-rw-r--r--test/elf/linkerscript/valid-script-cli.objtxt23
-rw-r--r--test/elf/loginputfiles.test28
-rw-r--r--test/elf/mergeatoms.test6
-rw-r--r--test/elf/mergeconstants.test20
-rw-r--r--test/elf/mergeglobalatoms.test11
-rw-r--r--test/elf/note.test49
-rw-r--r--test/elf/options/dynamic-linker.test17
-rw-r--r--test/elf/phdr.test99
-rw-r--r--test/elf/quickdata.test15
-rw-r--r--test/elf/reloc.test38
-rw-r--r--test/elf/responsefile.test6
-rw-r--r--test/elf/rodata.test5
-rw-r--r--test/elf/rosegment.test26
-rw-r--r--test/elf/sectionGroups/sectiongroup-new-members.test153
-rw-r--r--test/elf/sectionGroups/sectiongroup-simple.test146
-rw-r--r--test/elf/sectionGroups/sectiongroup-undef-member-other.test158
-rw-r--r--test/elf/sectionGroups/sectiongroup-undef-member.test144
-rw-r--r--test/elf/sectionGroups/sectiongroup-with-globalsymbols.test253
-rw-r--r--test/elf/sectionGroups/sectiongroup-with-undef-external-reference.test239
-rw-r--r--test/elf/sectionGroups/sectiongroup-with-undef-signature.test222
-rw-r--r--test/elf/sections.test142
-rw-r--r--test/elf/sh_addralign.test38
-rw-r--r--test/elf/soname.test6
-rw-r--r--test/elf/strip-all.test107
-rw-r--r--test/elf/stripped-empty.test4
-rw-r--r--test/elf/symbols.test33
-rw-r--r--test/elf/tls.test43
-rw-r--r--test/elf/tlsAddr.test7
-rw-r--r--test/elf/undef-from-dso-to-main.test52
-rw-r--r--test/elf/undef-from-main-dso.test43
-rw-r--r--test/elf/weaksym.test7
-rw-r--r--test/elf/wrap.test279
-rw-r--r--test/elf/x86-64-dynamic-relocs.test26
-rw-r--r--test/elf/x86-64-dynamic.test79
-rw-r--r--test/elf/x86.test38
-rw-r--r--test/elf/x86_64-kinds.test23
-rw-r--r--test/lit.cfg87
-rw-r--r--test/mach-o/Inputs/PIE.yaml6
-rw-r--r--test/mach-o/Inputs/arm-interworking.yaml83
-rw-r--r--test/mach-o/Inputs/arm-shims.yaml60
-rw-r--r--test/mach-o/Inputs/cstring-sections.yaml25
-rw-r--r--test/mach-o/Inputs/got-order.yaml53
-rw-r--r--test/mach-o/Inputs/got-order2.yaml11
-rw-r--r--test/mach-o/Inputs/hello-world-arm64.yaml8
-rw-r--r--test/mach-o/Inputs/hello-world-armv6.yaml7
-rw-r--r--test/mach-o/Inputs/hello-world-armv7.yaml7
-rw-r--r--test/mach-o/Inputs/hello-world-x86.yaml7
-rw-r--r--test/mach-o/Inputs/hello-world-x86_64.yaml8
-rw-r--r--test/mach-o/Inputs/hw.raw_bytes1
-rw-r--r--test/mach-o/Inputs/interposing-section.yaml6
-rw-r--r--test/mach-o/Inputs/lazy-bind-x86_64-2.yaml8
-rw-r--r--test/mach-o/Inputs/lazy-bind-x86_64-3.yaml8
-rw-r--r--test/mach-o/Inputs/lazy-bind-x86_64.yaml8
-rw-r--r--test/mach-o/Inputs/linker-as-ld.yaml6
-rw-r--r--test/mach-o/Inputs/re-exported-dylib-ordinal.yaml21
-rw-r--r--test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml18
-rw-r--r--test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml19
-rw-r--r--test/mach-o/Inputs/unwind-info-simple-arm64.yaml13
-rw-r--r--test/mach-o/Inputs/use-simple-dylib.yaml58
-rw-r--r--test/mach-o/Inputs/write-final-sections.yaml20
-rw-r--r--test/mach-o/Inputs/wrong-arch-error.yaml24
-rw-r--r--test/mach-o/PIE.yaml16
-rw-r--r--test/mach-o/align_text.yaml10
-rw-r--r--test/mach-o/arm-interworking-movw.yaml20
-rw-r--r--test/mach-o/arm-interworking.yaml160
-rw-r--r--test/mach-o/arm-shims.yaml83
-rw-r--r--test/mach-o/arm-subsections-via-symbols.yaml4
-rw-r--r--test/mach-o/arm64-reloc-negDelta32-fixup.yaml124
-rw-r--r--test/mach-o/arm64-relocs-errors-delta64-offset.yaml65
-rw-r--r--test/mach-o/cstring-sections.yaml26
-rw-r--r--test/mach-o/data-only-dylib.yaml2
-rw-r--r--test/mach-o/demangle.yaml2
-rw-r--r--test/mach-o/dylib-exports.yaml41
-rw-r--r--test/mach-o/executable-exports.yaml46
-rw-r--r--test/mach-o/exported_symbols_list-dylib.yaml2
-rw-r--r--test/mach-o/exported_symbols_list-obj.yaml2
-rw-r--r--test/mach-o/exported_symbols_list-undef.yaml2
-rw-r--r--test/mach-o/fat-archive.yaml8
-rw-r--r--test/mach-o/flat_namespace_undef_error.yaml17
-rw-r--r--test/mach-o/flat_namespace_undef_suppress.yaml17
-rw-r--r--test/mach-o/force_load-dylib.yaml4
-rw-r--r--test/mach-o/force_load-x86_64.yaml4
-rw-r--r--test/mach-o/framework-user-paths.yaml2
-rw-r--r--test/mach-o/gcc_except_tab-got-arm64.yaml53
-rw-r--r--test/mach-o/got-order.yaml85
-rw-r--r--test/mach-o/hello-world-arm64.yaml14
-rw-r--r--test/mach-o/hello-world-armv6.yaml10
-rw-r--r--test/mach-o/hello-world-armv7.yaml25
-rw-r--r--test/mach-o/hello-world-x86.yaml19
-rw-r--r--test/mach-o/hello-world-x86_64.yaml55
-rw-r--r--test/mach-o/image-base.yaml13
-rw-r--r--test/mach-o/infer-arch.yaml2
-rw-r--r--test/mach-o/interposing-section.yaml25
-rw-r--r--test/mach-o/keep_private_externs.yaml2
-rw-r--r--test/mach-o/lazy-bind-x86_64.yaml31
-rw-r--r--test/mach-o/library-order.yaml6
-rw-r--r--test/mach-o/library-rescan.yaml6
-rw-r--r--test/mach-o/linker-as-ld.yaml11
-rw-r--r--test/mach-o/objc_export_list.yaml18
-rw-r--r--test/mach-o/parse-aliases.yaml2
-rw-r--r--test/mach-o/parse-arm-relocs.yaml14
-rw-r--r--test/mach-o/parse-cfstring64.yaml8
-rw-r--r--test/mach-o/parse-data-in-code-armv7.yaml12
-rw-r--r--test/mach-o/parse-data-relocs-x86_64.yaml184
-rw-r--r--test/mach-o/parse-eh-frame-relocs-x86_64.yaml176
-rw-r--r--test/mach-o/parse-eh-frame-x86-anon.yaml50
-rw-r--r--test/mach-o/parse-eh-frame-x86-labeled.yaml58
-rw-r--r--test/mach-o/parse-function.yaml6
-rw-r--r--test/mach-o/parse-initializers64.yaml10
-rw-r--r--test/mach-o/parse-literals-error.yaml2
-rw-r--r--test/mach-o/parse-literals.yaml22
-rw-r--r--test/mach-o/parse-relocs-x86.yaml30
-rw-r--r--test/mach-o/parse-tentative-defs.yaml10
-rw-r--r--test/mach-o/parse-text-relocs-x86_64.yaml42
-rw-r--r--test/mach-o/parse-tlv-relocs-x86-64.yaml100
-rw-r--r--test/mach-o/re-exported-dylib-ordinal.yaml67
-rw-r--r--test/mach-o/rpath.yaml2
-rw-r--r--test/mach-o/run-tlv-pass-x86-64.yaml144
-rw-r--r--test/mach-o/sectalign.yaml4
-rw-r--r--test/mach-o/sectcreate.yaml12
-rw-r--r--test/mach-o/stack-size.yaml24
-rw-r--r--test/mach-o/twolevel_namespace_undef_dynamic_lookup.yaml17
-rw-r--r--test/mach-o/twolevel_namespace_undef_warning_suppress.yaml23
-rw-r--r--test/mach-o/unwind-info-simple-arm64.yaml89
-rw-r--r--test/mach-o/unwind-info-simple-x86_64.yaml23
-rw-r--r--test/mach-o/upward-dylib-load-command.yaml4
-rw-r--r--test/mach-o/use-simple-dylib.yaml62
-rw-r--r--test/mach-o/write-final-sections.yaml48
-rw-r--r--test/mach-o/wrong-arch-error.yaml25
-rw-r--r--test/old-elf/AArch64/Inputs/fn.c (renamed from test/elf/AArch64/Inputs/fn.c)0
-rw-r--r--test/old-elf/AArch64/Inputs/fn.o (renamed from test/elf/AArch64/Inputs/fn.o)bin899 -> 899 bytes
-rw-r--r--test/old-elf/AArch64/Inputs/general-dyn-tls-0.yaml64
-rw-r--r--test/old-elf/AArch64/Inputs/initfini-option.c (renamed from test/elf/AArch64/Inputs/initfini-option.c)0
-rw-r--r--test/old-elf/AArch64/Inputs/initfini-option.o (renamed from test/elf/AArch64/Inputs/initfini-option.o)bin1552 -> 1552 bytes
-rw-r--r--test/old-elf/AArch64/Inputs/initfini.c (renamed from test/elf/AArch64/Inputs/initfini.c)0
-rw-r--r--test/old-elf/AArch64/Inputs/initfini.o (renamed from test/elf/AArch64/Inputs/initfini.o)bin2056 -> 2056 bytes
-rw-r--r--test/old-elf/AArch64/Inputs/initial-exec-tls-1.yaml77
-rw-r--r--test/old-elf/AArch64/Inputs/main.c (renamed from test/elf/AArch64/Inputs/main.c)0
-rw-r--r--test/old-elf/AArch64/Inputs/main.o (renamed from test/elf/AArch64/Inputs/main.o)bin1064 -> 1064 bytes
-rw-r--r--test/old-elf/AArch64/Inputs/no-interp-section.c (renamed from test/elf/AArch64/Inputs/no-interp-section.c)0
-rw-r--r--test/old-elf/AArch64/Inputs/no-interp-section.o (renamed from test/elf/AArch64/Inputs/no-interp-section.o)bin903 -> 903 bytes
-rw-r--r--test/old-elf/AArch64/Inputs/zerosizedsection.o (renamed from test/elf/AArch64/Inputs/zerosizedsection.o)bin816 -> 816 bytes
-rw-r--r--test/old-elf/AArch64/Inputs/zerosizedsection.s (renamed from test/elf/AArch64/Inputs/zerosizedsection.s)0
-rw-r--r--test/old-elf/AArch64/defsym.test22
-rw-r--r--test/old-elf/AArch64/dontignorezerosize-sections.test9
-rw-r--r--test/old-elf/AArch64/dynamicvars.test113
-rw-r--r--test/old-elf/AArch64/dynlib-nointerp-section.test5
-rw-r--r--test/old-elf/AArch64/general-dyn-tls-0.test103
-rw-r--r--test/old-elf/AArch64/initfini.test23
-rw-r--r--test/old-elf/AArch64/initial-exec-tls-0.test146
-rw-r--r--test/old-elf/AArch64/local-tls.test184
-rw-r--r--test/old-elf/AArch64/rel-abs16-overflow.test44
-rw-r--r--test/old-elf/AArch64/rel-abs16.test53
-rw-r--r--test/old-elf/AArch64/rel-abs32-overflow.test53
-rw-r--r--test/old-elf/AArch64/rel-abs32.test59
-rw-r--r--test/old-elf/AArch64/rel-abs64.test59
-rw-r--r--test/old-elf/AArch64/rel-adr_prel_lo21-overflow.test45
-rw-r--r--test/old-elf/AArch64/rel-adr_prel_lo21.test51
-rw-r--r--test/old-elf/AArch64/rel-adr_prel_pg_hi21-overflow.test45
-rw-r--r--test/old-elf/AArch64/rel-adr_prel_pg_hi21.test52
-rw-r--r--test/old-elf/AArch64/rel-bad.test44
-rw-r--r--test/old-elf/AArch64/rel-prel16-overflow.test53
-rw-r--r--test/old-elf/AArch64/rel-prel16.test59
-rw-r--r--test/old-elf/AArch64/rel-prel32-overflow.test53
-rw-r--r--test/old-elf/AArch64/rel-prel32.test59
-rw-r--r--test/old-elf/AArch64/rel-prel64.test59
-rw-r--r--test/old-elf/AMDGPU/hsa.test53
-rw-r--r--test/old-elf/ARM/Inputs/fn.c1
-rwxr-xr-xtest/old-elf/ARM/Inputs/libfn.sobin0 -> 4972 bytes
-rwxr-xr-xtest/old-elf/ARM/Inputs/libobj.sobin0 -> 5067 bytes
-rw-r--r--test/old-elf/ARM/Inputs/obj.c4
-rw-r--r--test/old-elf/ARM/arm-symbols.test51
-rw-r--r--test/old-elf/ARM/defsym.test50
-rw-r--r--test/old-elf/ARM/dynamic-symbols.test83
-rw-r--r--test/old-elf/ARM/entry-point.test113
-rw-r--r--test/old-elf/ARM/exidx.test254
-rw-r--r--test/old-elf/ARM/header-flags.test57
-rw-r--r--test/old-elf/ARM/mapping-code-model.test160
-rw-r--r--test/old-elf/ARM/mapping-symbols.test122
-rw-r--r--test/old-elf/ARM/missing-symbol.test38
-rw-r--r--test/old-elf/ARM/plt-dynamic.test200
-rw-r--r--test/old-elf/ARM/plt-ifunc-interwork.test396
-rw-r--r--test/old-elf/ARM/plt-ifunc-mapping.test109
-rw-r--r--test/old-elf/ARM/rel-abs32.test58
-rw-r--r--test/old-elf/ARM/rel-arm-call.test112
-rw-r--r--test/old-elf/ARM/rel-arm-jump24-veneer-b.test122
-rw-r--r--test/old-elf/ARM/rel-arm-jump24-veneer-bl.test120
-rw-r--r--test/old-elf/ARM/rel-arm-jump24.test108
-rw-r--r--test/old-elf/ARM/rel-arm-mov.test64
-rw-r--r--test/old-elf/ARM/rel-arm-prel31.test90
-rw-r--r--test/old-elf/ARM/rel-arm-target1.test114
-rw-r--r--test/old-elf/ARM/rel-arm-thm-interwork.test121
-rw-r--r--test/old-elf/ARM/rel-base-prel.test61
-rw-r--r--test/old-elf/ARM/rel-copy.test60
-rw-r--r--test/old-elf/ARM/rel-glob-dat.test57
-rw-r--r--test/old-elf/ARM/rel-got-brel.test63
-rw-r--r--test/old-elf/ARM/rel-group-relocs.test71
-rw-r--r--test/old-elf/ARM/rel-ifunc.test101
-rw-r--r--test/old-elf/ARM/rel-jump-slot.test50
-rw-r--r--test/old-elf/ARM/rel-rel32.test56
-rw-r--r--test/old-elf/ARM/rel-thm-call.test114
-rw-r--r--test/old-elf/ARM/rel-thm-jump11.test209
-rw-r--r--test/old-elf/ARM/rel-thm-jump24-veneer.test120
-rw-r--r--test/old-elf/ARM/rel-thm-jump24.test110
-rw-r--r--test/old-elf/ARM/rel-thm-mov.test70
-rw-r--r--test/old-elf/ARM/rel-tls-ie32.test125
-rw-r--r--test/old-elf/ARM/rel-tls-le32.test73
-rw-r--r--test/old-elf/ARM/rel-v4bx.test72
-rw-r--r--test/old-elf/ARM/thm-symbols.test51
-rw-r--r--test/old-elf/ARM/two-got-for-symbol.test62
-rw-r--r--test/old-elf/ARM/undef-lazy-symbol.test133
-rw-r--r--test/old-elf/ARM/veneer-mapping.test92
-rw-r--r--test/old-elf/ARM/weak-branch.test221
-rw-r--r--test/old-elf/Hexagon/Inputs/dynobj-data.c (renamed from test/elf/Hexagon/Inputs/dynobj-data.c)0
-rw-r--r--test/old-elf/Hexagon/Inputs/dynobj-data.o (renamed from test/elf/Hexagon/Inputs/dynobj-data.o)bin916 -> 916 bytes
-rw-r--r--test/old-elf/Hexagon/Inputs/dynobj.c (renamed from test/elf/Hexagon/Inputs/dynobj.c)0
-rw-r--r--test/old-elf/Hexagon/Inputs/dynobj.o (renamed from test/elf/Hexagon/Inputs/dynobj.o)bin1288 -> 1288 bytes
-rw-r--r--test/old-elf/Hexagon/Inputs/got-plt-order.c (renamed from test/elf/Hexagon/Inputs/got-plt-order.c)0
-rw-r--r--test/old-elf/Hexagon/Inputs/got-plt-order.o (renamed from test/elf/Hexagon/Inputs/got-plt-order.o)bin964 -> 964 bytes
-rw-r--r--test/old-elf/Hexagon/Inputs/libMaxAlignment.a (renamed from test/elf/Hexagon/Inputs/libMaxAlignment.a)bin1010 -> 1010 bytes
-rw-r--r--test/old-elf/Hexagon/Inputs/sda-base.o (renamed from test/elf/Hexagon/Inputs/sda-base.o)bin1469 -> 1469 bytes
-rw-r--r--test/old-elf/Hexagon/Inputs/sdata1.c (renamed from test/elf/Hexagon/Inputs/sdata1.c)0
-rw-r--r--test/old-elf/Hexagon/Inputs/sdata1.o (renamed from test/elf/Hexagon/Inputs/sdata1.o)bin684 -> 684 bytes
-rw-r--r--test/old-elf/Hexagon/Inputs/sdata2.c (renamed from test/elf/Hexagon/Inputs/sdata2.c)0
-rw-r--r--test/old-elf/Hexagon/Inputs/sdata2.o (renamed from test/elf/Hexagon/Inputs/sdata2.o)bin829 -> 829 bytes
-rw-r--r--test/old-elf/Hexagon/Inputs/use-shared.hexagon (renamed from test/elf/Hexagon/Inputs/use-shared.hexagon)bin872 -> 872 bytes
-rw-r--r--test/old-elf/Hexagon/dynlib-data.test9
-rw-r--r--test/old-elf/Hexagon/dynlib-gotoff.test128
-rw-r--r--test/old-elf/Hexagon/dynlib-hash.test9
-rw-r--r--test/old-elf/Hexagon/dynlib-rela.test9
-rw-r--r--test/old-elf/Hexagon/dynlib-syms.test7
-rw-r--r--test/old-elf/Hexagon/dynlib.test36
-rw-r--r--test/old-elf/Hexagon/hexagon-got-plt-order.test5
-rw-r--r--test/old-elf/Hexagon/hexagon-plt-setup.test12
-rw-r--r--test/old-elf/Hexagon/maxalignment.test8
-rw-r--r--test/old-elf/Hexagon/rela-order.test9
-rw-r--r--test/old-elf/Hexagon/sda-base.test4
-rw-r--r--test/old-elf/Hexagon/zerofillquick-sdata.test18
-rw-r--r--test/old-elf/Inputs/abs-test.i386 (renamed from test/elf/Inputs/abs-test.i386)bin504 -> 504 bytes
-rw-r--r--test/old-elf/Inputs/allowduplicates.objtxt12
-rw-r--r--test/old-elf/Inputs/bar.o.x86-64 (renamed from test/elf/Inputs/bar.o.x86-64)bin1240 -> 1240 bytes
-rw-r--r--test/old-elf/Inputs/branch-test.hexagon (renamed from test/elf/Inputs/branch-test.hexagon)bin700 -> 700 bytes
-rw-r--r--test/old-elf/Inputs/branch-test.ppc (renamed from test/elf/Inputs/branch-test.ppc)bin852 -> 852 bytes
-rw-r--r--test/old-elf/Inputs/consecutive-weak-defs.o.yaml65
-rw-r--r--test/old-elf/Inputs/constants-merge.x86-64 (renamed from test/elf/Inputs/constants-merge.x86-64)bin1232 -> 1232 bytes
-rw-r--r--test/old-elf/Inputs/constdata.x86-64 (renamed from test/elf/Inputs/constdata.x86-64)bin1688 -> 1688 bytes
-rw-r--r--test/old-elf/Inputs/foo.o.x86-64 (renamed from test/elf/Inputs/foo.o.x86-64)bin1240 -> 1240 bytes
-rw-r--r--test/old-elf/Inputs/globalconst.c (renamed from test/elf/Inputs/globalconst.c)0
-rw-r--r--test/old-elf/Inputs/globalconst.o.x86-64 (renamed from test/elf/Inputs/globalconst.o.x86-64)bin1072 -> 1072 bytes
-rw-r--r--test/old-elf/Inputs/gotpcrel.S (renamed from test/elf/Inputs/gotpcrel.S)0
-rw-r--r--test/old-elf/Inputs/gotpcrel.x86-64 (renamed from test/elf/Inputs/gotpcrel.x86-64)bin904 -> 904 bytes
-rw-r--r--test/old-elf/Inputs/group-cmd-search-1.ls (renamed from test/elf/Inputs/group-cmd-search-1.ls)0
-rw-r--r--test/old-elf/Inputs/group-cmd-search-2.ls (renamed from test/elf/Inputs/group-cmd-search-2.ls)0
-rw-r--r--test/old-elf/Inputs/group-cmd-search-3.ls (renamed from test/elf/Inputs/group-cmd-search-3.ls)0
-rw-r--r--test/old-elf/Inputs/ifunc.S (renamed from test/elf/Inputs/ifunc.S)0
-rw-r--r--test/old-elf/Inputs/ifunc.cpp (renamed from test/elf/Inputs/ifunc.cpp)0
-rw-r--r--test/old-elf/Inputs/ifunc.cpp.x86-64 (renamed from test/elf/Inputs/ifunc.cpp.x86-64)bin1224 -> 1224 bytes
-rw-r--r--test/old-elf/Inputs/ifunc.x86-64 (renamed from test/elf/Inputs/ifunc.x86-64)bin912 -> 912 bytes
-rw-r--r--test/old-elf/Inputs/libfnarchive.a (renamed from test/elf/Inputs/libfnarchive.a)bin2656 -> 2656 bytes
-rw-r--r--test/old-elf/Inputs/libifunc.x86-64.so (renamed from test/elf/Inputs/libifunc.x86-64.so)bin2512 -> 2512 bytes
-rw-r--r--test/old-elf/Inputs/libundef.so (renamed from test/elf/Inputs/libundef.so)bin11128 -> 11128 bytes
-rwxr-xr-xtest/old-elf/Inputs/libweaksym.so (renamed from test/elf/Inputs/libweaksym.so)bin2160 -> 2160 bytes
-rw-r--r--test/old-elf/Inputs/main-with-global-def.o.yaml55
-rw-r--r--test/old-elf/Inputs/mainobj.x86_64 (renamed from test/elf/Inputs/mainobj.x86_64)bin1360 -> 1360 bytes
-rw-r--r--test/old-elf/Inputs/no-unique-section-names.x86-64bin0 -> 2128 bytes
-rw-r--r--test/old-elf/Inputs/object-test.elf-hexagon (renamed from test/elf/Inputs/object-test.elf-hexagon)bin1532 -> 1532 bytes
-rw-r--r--test/old-elf/Inputs/object-test.elf-i386 (renamed from test/elf/Inputs/object-test.elf-i386)bin1784 -> 1784 bytes
-rw-r--r--test/old-elf/Inputs/phdr.i386 (renamed from test/elf/Inputs/phdr.i386)bin17536 -> 17536 bytes
-rw-r--r--test/old-elf/Inputs/quickdata-sort-test.o.elf-hexagon (renamed from test/elf/Inputs/quickdata-sort-test.o.elf-hexagon)bin1385 -> 1385 bytes
-rw-r--r--test/old-elf/Inputs/quickdata-sortcommon-test.o.elf-hexagon (renamed from test/elf/Inputs/quickdata-sortcommon-test.o.elf-hexagon)bin1469 -> 1469 bytes
-rw-r--r--test/old-elf/Inputs/quickdata-test.elf-hexagon (renamed from test/elf/Inputs/quickdata-test.elf-hexagon)bin891 -> 891 bytes
-rw-r--r--test/old-elf/Inputs/reloc-test.elf-i386 (renamed from test/elf/Inputs/reloc-test.elf-i386)bin1076 -> 1076 bytes
-rw-r--r--test/old-elf/Inputs/reloc-xb.x86 (renamed from test/elf/Inputs/reloc-xb.x86)bin568 -> 568 bytes
-rw-r--r--test/old-elf/Inputs/reloc-xt.x86 (renamed from test/elf/Inputs/reloc-xt.x86)bin548 -> 548 bytes
-rw-r--r--test/old-elf/Inputs/relocs-dynamic.x86-64 (renamed from test/elf/Inputs/relocs-dynamic.x86-64)bin864 -> 864 bytes
-rw-r--r--test/old-elf/Inputs/relocs.x86-64 (renamed from test/elf/Inputs/relocs.x86-64)bin1536 -> 1536 bytes
-rw-r--r--test/old-elf/Inputs/responsefile (renamed from test/elf/Inputs/responsefile)0
-rw-r--r--test/old-elf/Inputs/rodata-test.hexagon (renamed from test/elf/Inputs/rodata-test.hexagon)bin669 -> 669 bytes
-rw-r--r--test/old-elf/Inputs/rodata-test.i386 (renamed from test/elf/Inputs/rodata-test.i386)bin537 -> 537 bytes
-rw-r--r--test/old-elf/Inputs/rodata.c (renamed from test/elf/Inputs/rodata.c)0
-rw-r--r--test/old-elf/Inputs/rodata.o (renamed from test/elf/Inputs/rodata.o)bin1568 -> 1568 bytes
-rw-r--r--test/old-elf/Inputs/section-test.i386 (renamed from test/elf/Inputs/section-test.i386)bin717 -> 717 bytes
-rw-r--r--test/old-elf/Inputs/shared.c (renamed from test/elf/Inputs/shared.c)0
-rw-r--r--test/old-elf/Inputs/shared.so-x86-64 (renamed from test/elf/Inputs/shared.so-x86-64)bin7536 -> 7536 bytes
-rw-r--r--test/old-elf/Inputs/shndx.o-x86_64bin0 -> 624 bytes
-rw-r--r--test/old-elf/Inputs/stripped-empty.x86_64bin0 -> 416 bytes
-rw-r--r--test/old-elf/Inputs/target-test.hexagon (renamed from test/elf/Inputs/target-test.hexagon)bin676 -> 676 bytes
-rw-r--r--test/old-elf/Inputs/target-test.ppc (renamed from test/elf/Inputs/target-test.ppc)bin552 -> 552 bytes
-rw-r--r--test/old-elf/Inputs/tls-tbss-size.yaml59
-rw-r--r--test/old-elf/Inputs/tls.S (renamed from test/elf/Inputs/tls.S)0
-rw-r--r--test/old-elf/Inputs/tls.c (renamed from test/elf/Inputs/tls.c)0
-rw-r--r--test/old-elf/Inputs/tls.x86-64 (renamed from test/elf/Inputs/tls.x86-64)bin1424 -> 1424 bytes
-rw-r--r--test/old-elf/Inputs/tlsAddr.x86-64 (renamed from test/elf/Inputs/tlsAddr.x86-64)bin1752 -> 1752 bytes
-rw-r--r--test/old-elf/Inputs/tlsaddr.c (renamed from test/elf/Inputs/tlsaddr.c)0
-rw-r--r--test/old-elf/Inputs/undef-from-main-so.c (renamed from test/elf/Inputs/undef-from-main-so.c)0
-rw-r--r--test/old-elf/Inputs/undef-from-main.c (renamed from test/elf/Inputs/undef-from-main.c)0
-rw-r--r--test/old-elf/Inputs/undef-pc32.o (renamed from test/elf/Inputs/undef-pc32.o)bin1248 -> 1248 bytes
-rw-r--r--test/old-elf/Inputs/undef.o (renamed from test/elf/Inputs/undef.o)bin1264 -> 1264 bytes
-rw-r--r--test/old-elf/Inputs/undef2-so.o.yaml49
-rw-r--r--test/old-elf/Inputs/use-shared-32s.c (renamed from test/elf/Inputs/use-shared-32s.c)0
-rw-r--r--test/old-elf/Inputs/use-shared-32s.x86-64 (renamed from test/elf/Inputs/use-shared-32s.x86-64)bin1336 -> 1336 bytes
-rw-r--r--test/old-elf/Inputs/use-shared.c (renamed from test/elf/Inputs/use-shared.c)0
-rw-r--r--test/old-elf/Inputs/use-shared.x86-64 (renamed from test/elf/Inputs/use-shared.x86-64)bin1376 -> 1376 bytes
-rw-r--r--test/old-elf/Inputs/weaksym.o (renamed from test/elf/Inputs/weaksym.o)bin840 -> 840 bytes
-rw-r--r--test/old-elf/Inputs/writersyms.o (renamed from test/elf/Inputs/writersyms.o)bin868 -> 868 bytes
-rw-r--r--test/old-elf/Inputs/x86-64-relocs.S (renamed from test/elf/Inputs/x86-64-relocs.S)0
-rw-r--r--test/old-elf/Mips/abi-flags-01.test35
-rw-r--r--test/old-elf/Mips/abi-flags-02.test92
-rw-r--r--test/old-elf/Mips/abi-flags-03.test149
-rw-r--r--test/old-elf/Mips/abi-flags-04.test125
-rw-r--r--test/old-elf/Mips/abi-flags-05.test186
-rw-r--r--test/old-elf/Mips/abi-flags-06.test79
-rw-r--r--test/old-elf/Mips/abi-flags-07.test60
-rw-r--r--test/old-elf/Mips/abi-flags-08.test71
-rw-r--r--test/old-elf/Mips/abi-flags-09.test67
-rw-r--r--test/old-elf/Mips/abi-flags-10.test60
-rw-r--r--test/old-elf/Mips/abi-flags-11.test59
-rw-r--r--test/old-elf/Mips/base-address-64.test80
-rw-r--r--test/old-elf/Mips/base-address.test95
-rw-r--r--test/old-elf/Mips/ctors-order.test164
-rw-r--r--test/old-elf/Mips/driver-hash-style.test15
-rw-r--r--test/old-elf/Mips/dt-textrel-64.test74
-rw-r--r--test/old-elf/Mips/dt-textrel.test74
-rw-r--r--test/old-elf/Mips/dynamic-linking.test22
-rw-r--r--test/old-elf/Mips/dynamic-sym.test41
-rw-r--r--test/old-elf/Mips/dynlib-dynamic.test110
-rw-r--r--test/old-elf/Mips/dynlib-dynsym-micro.test208
-rw-r--r--test/old-elf/Mips/dynlib-dynsym.test202
-rw-r--r--test/old-elf/Mips/dynlib-fileheader-64.test72
-rw-r--r--test/old-elf/Mips/dynlib-fileheader-micro-64.test75
-rw-r--r--test/old-elf/Mips/dynlib-fileheader-micro.test79
-rw-r--r--test/old-elf/Mips/dynlib-fileheader.test76
-rw-r--r--test/old-elf/Mips/dynsym-table-1.test127
-rw-r--r--test/old-elf/Mips/dynsym-table-2.test105
-rw-r--r--test/old-elf/Mips/e-flags-merge-1-64.test30
-rw-r--r--test/old-elf/Mips/e-flags-merge-1.test56
-rw-r--r--test/old-elf/Mips/e-flags-merge-10.test43
-rw-r--r--test/old-elf/Mips/e-flags-merge-11.test43
-rw-r--r--test/old-elf/Mips/e-flags-merge-12.test44
-rw-r--r--test/old-elf/Mips/e-flags-merge-2-64.test33
-rw-r--r--test/old-elf/Mips/e-flags-merge-2.test35
-rw-r--r--test/old-elf/Mips/e-flags-merge-3-64.test130
-rw-r--r--test/old-elf/Mips/e-flags-merge-3.test134
-rw-r--r--test/old-elf/Mips/e-flags-merge-4-64.test64
-rw-r--r--test/old-elf/Mips/e-flags-merge-4.test65
-rw-r--r--test/old-elf/Mips/e-flags-merge-5-64.test42
-rw-r--r--test/old-elf/Mips/e-flags-merge-5.test42
-rw-r--r--test/old-elf/Mips/e-flags-merge-6-64.test79
-rw-r--r--test/old-elf/Mips/e-flags-merge-6.test80
-rw-r--r--test/old-elf/Mips/e-flags-merge-7-64.test42
-rw-r--r--test/old-elf/Mips/e-flags-merge-7.test42
-rw-r--r--test/old-elf/Mips/e-flags-merge-8.test65
-rw-r--r--test/old-elf/Mips/e-flags-merge-9.test43
-rw-r--r--test/old-elf/Mips/entry-name.test26
-rw-r--r--test/old-elf/Mips/exe-dynamic.test110
-rw-r--r--test/old-elf/Mips/exe-dynsym-micro.test94
-rw-r--r--test/old-elf/Mips/exe-dynsym.test91
-rw-r--r--test/old-elf/Mips/exe-fileheader-02.test62
-rw-r--r--test/old-elf/Mips/exe-fileheader-03.test72
-rw-r--r--test/old-elf/Mips/exe-fileheader-64.test66
-rw-r--r--test/old-elf/Mips/exe-fileheader-be-64.test60
-rw-r--r--test/old-elf/Mips/exe-fileheader-be.test60
-rw-r--r--test/old-elf/Mips/exe-fileheader-micro-64.test68
-rw-r--r--test/old-elf/Mips/exe-fileheader-micro.test69
-rw-r--r--test/old-elf/Mips/exe-fileheader-n32.test65
-rw-r--r--test/old-elf/Mips/exe-fileheader.test105
-rw-r--r--test/old-elf/Mips/exe-got-micro.test115
-rw-r--r--test/old-elf/Mips/exe-got.test116
-rw-r--r--test/old-elf/Mips/got-page-32-micro.test251
-rw-r--r--test/old-elf/Mips/got-page-32.test244
-rw-r--r--test/old-elf/Mips/got-page-64-micro.test210
-rw-r--r--test/old-elf/Mips/got-page-64.test203
-rw-r--r--test/old-elf/Mips/got16-2.test73
-rw-r--r--test/old-elf/Mips/got16-micro.test165
-rw-r--r--test/old-elf/Mips/got16.test196
-rw-r--r--test/old-elf/Mips/gotsym.test43
-rw-r--r--test/old-elf/Mips/gp-sym-1-micro.test88
-rw-r--r--test/old-elf/Mips/gp-sym-1.test86
-rw-r--r--test/old-elf/Mips/gp-sym-2.test103
-rw-r--r--test/old-elf/Mips/hilo16-1.test40
-rw-r--r--test/old-elf/Mips/hilo16-2.test70
-rw-r--r--test/old-elf/Mips/hilo16-3-overflow.test44
-rw-r--r--test/old-elf/Mips/hilo16-3.test74
-rw-r--r--test/old-elf/Mips/hilo16-4.test93
-rw-r--r--test/old-elf/Mips/hilo16-5.test103
-rw-r--r--test/old-elf/Mips/hilo16-8-micro.test81
-rw-r--r--test/old-elf/Mips/hilo16-9-micro.test142
-rw-r--r--test/old-elf/Mips/initfini-micro.test45
-rw-r--r--test/old-elf/Mips/interpreter-64.test26
-rw-r--r--test/old-elf/Mips/interpreter-n32.test27
-rw-r--r--test/old-elf/Mips/interpreter.test26
-rw-r--r--test/old-elf/Mips/invalid-reginfo.test28
-rw-r--r--test/old-elf/Mips/jalx-align-err.test46
-rw-r--r--test/old-elf/Mips/jalx-jalr.test47
-rw-r--r--test/old-elf/Mips/jalx.test71
-rw-r--r--test/old-elf/Mips/jump-fix-err.test45
-rw-r--r--test/old-elf/Mips/la25-stub-be.test113
-rw-r--r--test/old-elf/Mips/la25-stub-micro-be.test121
-rw-r--r--test/old-elf/Mips/la25-stub-micro.test136
-rw-r--r--test/old-elf/Mips/la25-stub-npic-01.test153
-rw-r--r--test/old-elf/Mips/la25-stub-npic-02.test123
-rw-r--r--test/old-elf/Mips/la25-stub-npic-shared.test152
-rw-r--r--test/old-elf/Mips/la25-stub-pic.test144
-rw-r--r--test/old-elf/Mips/la25-stub.test133
-rw-r--r--test/old-elf/Mips/mips-options-01.test34
-rw-r--r--test/old-elf/Mips/mips-options-02.test104
-rw-r--r--test/old-elf/Mips/mips-options-03.test41
-rw-r--r--test/old-elf/Mips/mips-options-04.test77
-rw-r--r--test/old-elf/Mips/mips-options-05.test119
-rw-r--r--test/old-elf/Mips/mips-options-gp0.test77
-rw-r--r--test/old-elf/Mips/n32-rela-chain.test68
-rw-r--r--test/old-elf/Mips/n64-rel-chain.test204
-rw-r--r--test/old-elf/Mips/n64-rel-shift.test48
-rw-r--r--test/old-elf/Mips/opt-emulation.test43
-rw-r--r--test/old-elf/Mips/pc23-range.test54
-rw-r--r--test/old-elf/Mips/plt-entry-mixed-1.test114
-rw-r--r--test/old-elf/Mips/plt-entry-mixed-2.test93
-rw-r--r--test/old-elf/Mips/plt-entry-mixed-3.test98
-rw-r--r--test/old-elf/Mips/plt-entry-mixed-4.test85
-rw-r--r--test/old-elf/Mips/plt-entry-r6-be.test109
-rw-r--r--test/old-elf/Mips/plt-entry-r6.test109
-rw-r--r--test/old-elf/Mips/plt-header-be.test104
-rw-r--r--test/old-elf/Mips/plt-header-micro-be.test105
-rw-r--r--test/old-elf/Mips/plt-header-micro.test108
-rw-r--r--test/old-elf/Mips/plt-header-mixed.test105
-rw-r--r--test/old-elf/Mips/plt-header.test99
-rw-r--r--test/old-elf/Mips/r26-1-micro.test131
-rw-r--r--test/old-elf/Mips/r26-1.test132
-rw-r--r--test/old-elf/Mips/r26-2-micro.test31
-rw-r--r--test/old-elf/Mips/r26-2.test31
-rw-r--r--test/old-elf/Mips/reginfo-01.test30
-rw-r--r--test/old-elf/Mips/reginfo-02.test107
-rw-r--r--test/old-elf/Mips/reginfo-03.test45
-rw-r--r--test/old-elf/Mips/reginfo-04.test81
-rw-r--r--test/old-elf/Mips/reginfo-05.test123
-rw-r--r--test/old-elf/Mips/rel-16-overflow.test45
-rw-r--r--test/old-elf/Mips/rel-16.test51
-rw-r--r--test/old-elf/Mips/rel-32-be.test60
-rw-r--r--test/old-elf/Mips/rel-32.test59
-rw-r--r--test/old-elf/Mips/rel-64.test61
-rw-r--r--test/old-elf/Mips/rel-call-hilo-01.test109
-rw-r--r--test/old-elf/Mips/rel-call-hilo-micro.test154
-rw-r--r--test/old-elf/Mips/rel-copy-micro.test159
-rw-r--r--test/old-elf/Mips/rel-copy-pc.test113
-rw-r--r--test/old-elf/Mips/rel-copy.test177
-rw-r--r--test/old-elf/Mips/rel-dynamic-01-micro.test201
-rw-r--r--test/old-elf/Mips/rel-dynamic-01.test261
-rw-r--r--test/old-elf/Mips/rel-dynamic-02.test101
-rw-r--r--test/old-elf/Mips/rel-dynamic-03-micro.test133
-rw-r--r--test/old-elf/Mips/rel-dynamic-03.test129
-rw-r--r--test/old-elf/Mips/rel-dynamic-04-micro.test226
-rw-r--r--test/old-elf/Mips/rel-dynamic-04.test221
-rw-r--r--test/old-elf/Mips/rel-dynamic-05-micro.test192
-rw-r--r--test/old-elf/Mips/rel-dynamic-05.test188
-rw-r--r--test/old-elf/Mips/rel-dynamic-06-64.test114
-rw-r--r--test/old-elf/Mips/rel-dynamic-06.test115
-rw-r--r--test/old-elf/Mips/rel-dynamic-07-64.test348
-rw-r--r--test/old-elf/Mips/rel-dynamic-07.test363
-rw-r--r--test/old-elf/Mips/rel-dynamic-08-64.test275
-rw-r--r--test/old-elf/Mips/rel-dynamic-08-micro.test278
-rw-r--r--test/old-elf/Mips/rel-dynamic-08.test275
-rw-r--r--test/old-elf/Mips/rel-dynamic-09-micro.test109
-rw-r--r--test/old-elf/Mips/rel-dynamic-09.test107
-rw-r--r--test/old-elf/Mips/rel-dynamic-10-micro.test166
-rw-r--r--test/old-elf/Mips/rel-dynamic-10.test160
-rw-r--r--test/old-elf/Mips/rel-dynamic-11.test110
-rw-r--r--test/old-elf/Mips/rel-dynamic-12.test237
-rw-r--r--test/old-elf/Mips/rel-dynamic-13.test94
-rw-r--r--test/old-elf/Mips/rel-dynamic-14.test94
-rw-r--r--test/old-elf/Mips/rel-dynamic-15.test81
-rw-r--r--test/old-elf/Mips/rel-eh-01.test186
-rw-r--r--test/old-elf/Mips/rel-eh-02.test130
-rw-r--r--test/old-elf/Mips/rel-eh-03.test128
-rw-r--r--test/old-elf/Mips/rel-got-hilo-01.test109
-rw-r--r--test/old-elf/Mips/rel-got-hilo-micro.test154
-rw-r--r--test/old-elf/Mips/rel-gprel16-micro-overflow.test57
-rw-r--r--test/old-elf/Mips/rel-gprel16-micro.test78
-rw-r--r--test/old-elf/Mips/rel-gprel16-overflow.test48
-rw-r--r--test/old-elf/Mips/rel-gprel16.test104
-rw-r--r--test/old-elf/Mips/rel-gprel32-64.test84
-rw-r--r--test/old-elf/Mips/rel-gprel32.test84
-rw-r--r--test/old-elf/Mips/rel-gprel7-micro-overflow.test48
-rw-r--r--test/old-elf/Mips/rel-gprel7-micro.test65
-rw-r--r--test/old-elf/Mips/rel-hi0-lo16-micro.test58
-rw-r--r--test/old-elf/Mips/rel-high-01.test25
-rw-r--r--test/old-elf/Mips/rel-high-02.test25
-rw-r--r--test/old-elf/Mips/rel-jalr-01.test101
-rw-r--r--test/old-elf/Mips/rel-jalr-02.test68
-rw-r--r--test/old-elf/Mips/rel-lit-micro.test59
-rw-r--r--test/old-elf/Mips/rel-lit.test57
-rw-r--r--test/old-elf/Mips/rel-pc-hilo.test70
-rw-r--r--test/old-elf/Mips/rel-pc16-align.test43
-rw-r--r--test/old-elf/Mips/rel-pc16-overflow.test45
-rw-r--r--test/old-elf/Mips/rel-pc16.test53
-rw-r--r--test/old-elf/Mips/rel-pc18-s3-align.test44
-rw-r--r--test/old-elf/Mips/rel-pc18-s3-micro.test56
-rw-r--r--test/old-elf/Mips/rel-pc18-s3.test54
-rw-r--r--test/old-elf/Mips/rel-pc19-s2-align.test44
-rw-r--r--test/old-elf/Mips/rel-pc19-s2-micro.test56
-rw-r--r--test/old-elf/Mips/rel-pc19-s2.test54
-rw-r--r--test/old-elf/Mips/rel-pc21-s2-align.test44
-rw-r--r--test/old-elf/Mips/rel-pc21-s2-micro.test56
-rw-r--r--test/old-elf/Mips/rel-pc21-s2-overflow.test45
-rw-r--r--test/old-elf/Mips/rel-pc21-s2.test54
-rw-r--r--test/old-elf/Mips/rel-pc26-s2-align.test44
-rw-r--r--test/old-elf/Mips/rel-pc26-s2-micro.test56
-rw-r--r--test/old-elf/Mips/rel-pc26-s2.test54
-rw-r--r--test/old-elf/Mips/rel-pc32.test59
-rw-r--r--test/old-elf/Mips/rel-pc7-10-16-23.test86
-rw-r--r--test/old-elf/Mips/rel-sub-micro.test62
-rw-r--r--test/old-elf/Mips/rel-sub.test61
-rw-r--r--test/old-elf/Mips/rld_map.test42
-rw-r--r--test/old-elf/Mips/sign-rela.test54
-rw-r--r--test/old-elf/Mips/st-other.test90
-rw-r--r--test/old-elf/Mips/static-01.test119
-rw-r--r--test/old-elf/Mips/tls-1-micro.test65
-rw-r--r--test/old-elf/Mips/tls-1.test63
-rw-r--r--test/old-elf/Mips/tls-2-64-static.test71
-rw-r--r--test/old-elf/Mips/tls-2-64.test69
-rw-r--r--test/old-elf/Mips/tls-2-micro.test70
-rw-r--r--test/old-elf/Mips/tls-2-static.test125
-rw-r--r--test/old-elf/Mips/tls-2.test69
-rw-r--r--test/old-elf/Mips/tls-3-64-static.test70
-rw-r--r--test/old-elf/Mips/tls-3-micro.test183
-rw-r--r--test/old-elf/Mips/tls-3-static.test67
-rw-r--r--test/old-elf/Mips/tls-3.test180
-rw-r--r--test/old-elf/Mips/tls-4-64-static.test71
-rw-r--r--test/old-elf/Mips/tls-4-micro.test126
-rw-r--r--test/old-elf/Mips/tls-4-static.test68
-rw-r--r--test/old-elf/Mips/tls-4.test123
-rw-r--r--test/old-elf/Mips/tls-5-64.test71
-rw-r--r--test/old-elf/Mips/tls-5-micro.test70
-rw-r--r--test/old-elf/Mips/tls-5.test69
-rw-r--r--test/old-elf/Mips/validate-rel-01.test82
-rw-r--r--test/old-elf/Mips/validate-rel-03.test56
-rw-r--r--test/old-elf/X86_64/ExampleTarget/triple.test32
-rw-r--r--test/old-elf/X86_64/Inputs/constint.c (renamed from test/elf/X86_64/Inputs/constint.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/constint.o (renamed from test/elf/X86_64/Inputs/constint.o)bin1062 -> 1062 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/debug0.c (renamed from test/elf/X86_64/Inputs/debug0.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/debug0.x86-64 (renamed from test/elf/X86_64/Inputs/debug0.x86-64)bin2704 -> 2704 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/debug1.c (renamed from test/elf/X86_64/Inputs/debug1.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/debug1.x86-64 (renamed from test/elf/X86_64/Inputs/debug1.x86-64)bin2584 -> 2584 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/externtls.c (renamed from test/elf/X86_64/Inputs/externtls.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/externtls.x86-64 (renamed from test/elf/X86_64/Inputs/externtls.x86-64)bin1424 -> 1424 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/fn.c (renamed from test/elf/X86_64/Inputs/fn.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/fn.o (renamed from test/elf/X86_64/Inputs/fn.o)bin1072 -> 1072 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/generaltls-so.o.yaml67
-rw-r--r--test/old-elf/X86_64/Inputs/group/1.c (renamed from test/elf/X86_64/Inputs/group/1.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/group/1.o (renamed from test/elf/X86_64/Inputs/group/1.o)bin1456 -> 1456 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/group/fn.c (renamed from test/elf/X86_64/Inputs/group/fn.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/group/fn.o (renamed from test/elf/X86_64/Inputs/group/fn.o)bin1360 -> 1360 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/group/fn1.c (renamed from test/elf/X86_64/Inputs/group/fn1.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/group/fn1.o (renamed from test/elf/X86_64/Inputs/group/fn1.o)bin1352 -> 1352 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/group/fn2.c (renamed from test/elf/X86_64/Inputs/group/fn2.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/group/fn2.o (renamed from test/elf/X86_64/Inputs/group/fn2.o)bin1224 -> 1224 bytes
-rwxr-xr-xtest/old-elf/X86_64/Inputs/group/group.sh (renamed from test/elf/X86_64/Inputs/group/group.sh)0
-rw-r--r--test/old-elf/X86_64/Inputs/group/libfn.a (renamed from test/elf/X86_64/Inputs/group/libfn.a)bin2792 -> 2792 bytes
-rwxr-xr-xtest/old-elf/X86_64/Inputs/group/libfn.so (renamed from test/elf/X86_64/Inputs/group/libfn.so)bin2516 -> 2516 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/group/libfn1.a (renamed from test/elf/X86_64/Inputs/group/libfn1.a)bin1492 -> 1492 bytes
-rwxr-xr-xtest/old-elf/X86_64/Inputs/group/libfn2.so (renamed from test/elf/X86_64/Inputs/group/libfn2.so)bin9624 -> 9624 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/initfini-option.c (renamed from test/elf/X86_64/Inputs/initfini-option.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/initfini-option.o (renamed from test/elf/X86_64/Inputs/initfini-option.o)bin1824 -> 1824 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/initfini.c (renamed from test/elf/X86_64/Inputs/initfini.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/initfini.o (renamed from test/elf/X86_64/Inputs/initfini.o)bin2256 -> 2256 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/largebss.c (renamed from test/elf/X86_64/Inputs/largebss.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/largebss.o (renamed from test/elf/X86_64/Inputs/largebss.o)bin1131 -> 1131 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/layoutpass/1.c (renamed from test/elf/X86_64/Inputs/layoutpass/1.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/layoutpass/1.o (renamed from test/elf/X86_64/Inputs/layoutpass/1.o)bin1448 -> 1448 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/layoutpass/2.c (renamed from test/elf/X86_64/Inputs/layoutpass/2.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/layoutpass/2.o (renamed from test/elf/X86_64/Inputs/layoutpass/2.o)bin1320 -> 1320 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/layoutpass/3.c (renamed from test/elf/X86_64/Inputs/layoutpass/3.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/layoutpass/3.o (renamed from test/elf/X86_64/Inputs/layoutpass/3.o)bin1216 -> 1216 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/layoutpass/lib2.a (renamed from test/elf/X86_64/Inputs/layoutpass/lib2.a)bin1464 -> 1464 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/libfn.a (renamed from test/elf/X86_64/Inputs/libfn.a)bin1364 -> 1364 bytes
-rwxr-xr-xtest/old-elf/X86_64/Inputs/libfn.so (renamed from test/elf/X86_64/Inputs/libfn.so)bin2008 -> 2008 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/main.c (renamed from test/elf/X86_64/Inputs/main.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/main.o (renamed from test/elf/X86_64/Inputs/main.o)bin1360 -> 1360 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/multi-ovrd.c (renamed from test/elf/X86_64/Inputs/multi-ovrd.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/multi-ovrd.o (renamed from test/elf/X86_64/Inputs/multi-ovrd.o)bin1648 -> 1648 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/multi-weak.c (renamed from test/elf/X86_64/Inputs/multi-weak.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/multi-weak.o (renamed from test/elf/X86_64/Inputs/multi-weak.o)bin1856 -> 1856 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/multiweaksyms.o (renamed from test/elf/X86_64/Inputs/multiweaksyms.o)bin928 -> 928 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/nmagic.c (renamed from test/elf/X86_64/Inputs/nmagic.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/nmagic.o (renamed from test/elf/X86_64/Inputs/nmagic.o)bin1528 -> 1528 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/no-interp-section.c (renamed from test/elf/X86_64/Inputs/no-interp-section.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/no-interp-section.o (renamed from test/elf/X86_64/Inputs/no-interp-section.o)bin975 -> 975 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/note.o (renamed from test/elf/X86_64/Inputs/note.o)bin785 -> 785 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/note.s (renamed from test/elf/X86_64/Inputs/note.s)0
-rw-r--r--test/old-elf/X86_64/Inputs/note_ro_rw.o (renamed from test/elf/X86_64/Inputs/note_ro_rw.o)bin905 -> 905 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/note_ro_rw.s (renamed from test/elf/X86_64/Inputs/note_ro_rw.s)0
-rw-r--r--test/old-elf/X86_64/Inputs/ovrd.c (renamed from test/elf/X86_64/Inputs/ovrd.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/ovrd.o (renamed from test/elf/X86_64/Inputs/ovrd.o)bin1488 -> 1488 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/rodata.c (renamed from test/elf/X86_64/Inputs/rodata.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/rodata.o (renamed from test/elf/X86_64/Inputs/rodata.o)bin1584 -> 1584 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/rodata.s (renamed from test/elf/X86_64/Inputs/rodata.s)0
-rw-r--r--test/old-elf/X86_64/Inputs/rwint.c (renamed from test/elf/X86_64/Inputs/rwint.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/rwint.o (renamed from test/elf/X86_64/Inputs/rwint.o)bin963 -> 963 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/sectionmap.c (renamed from test/elf/X86_64/Inputs/sectionmap.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/sectionmap.o (renamed from test/elf/X86_64/Inputs/sectionmap.o)bin1478 -> 1478 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/undefcpp.c (renamed from test/elf/X86_64/Inputs/undefcpp.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/undefcpp.o (renamed from test/elf/X86_64/Inputs/undefcpp.o)bin1344 -> 1344 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/weak-zero-sized.o (renamed from test/elf/X86_64/Inputs/weak-zero-sized.o)bin688 -> 688 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/weak.c (renamed from test/elf/X86_64/Inputs/weak.c)0
-rw-r--r--test/old-elf/X86_64/Inputs/weak.o (renamed from test/elf/X86_64/Inputs/weak.o)bin1712 -> 1712 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/weak.s (renamed from test/elf/X86_64/Inputs/weak.s)0
-rw-r--r--test/old-elf/X86_64/Inputs/zerosizedsection.o (renamed from test/elf/X86_64/Inputs/zerosizedsection.o)bin760 -> 760 bytes
-rw-r--r--test/old-elf/X86_64/Inputs/zerosizedsection.s (renamed from test/elf/X86_64/Inputs/zerosizedsection.s)0
-rw-r--r--test/old-elf/X86_64/alignoffset.test118
-rw-r--r--test/old-elf/X86_64/debug.test57
-rw-r--r--test/old-elf/X86_64/defsym.test22
-rw-r--r--test/old-elf/X86_64/demangle.test12
-rw-r--r--test/old-elf/X86_64/dontignorezerosize-sections.test9
-rw-r--r--test/old-elf/X86_64/dynamicvars.test123
-rw-r--r--test/old-elf/X86_64/dynlib-nointerp-section.test4
-rw-r--r--test/old-elf/X86_64/dynlib-search.test6
-rw-r--r--test/old-elf/X86_64/dynsym-weak.test118
-rw-r--r--test/old-elf/X86_64/extern-tls.test16
-rw-r--r--test/old-elf/X86_64/general-dynamic-tls.test128
-rw-r--r--test/old-elf/X86_64/imagebase.test94
-rw-r--r--test/old-elf/X86_64/initfini-order.test10
-rw-r--r--test/old-elf/X86_64/initfini.test23
-rw-r--r--test/old-elf/X86_64/largebss.test20
-rw-r--r--test/old-elf/X86_64/layoutpass-order.test14
-rw-r--r--test/old-elf/X86_64/maxpagesize.test113
-rw-r--r--test/old-elf/X86_64/mergesimilarstrings.test47
-rw-r--r--test/old-elf/X86_64/multi-weak-layout.test52
-rw-r--r--test/old-elf/X86_64/multi-weak-override.test16
-rw-r--r--test/old-elf/X86_64/multi-weak-syms-order.test13
-rw-r--r--test/old-elf/X86_64/nmagic.test91
-rw-r--r--test/old-elf/X86_64/noalignsegments.test95
-rw-r--r--test/old-elf/X86_64/note-sections-ro_plus_rw.test42
-rw-r--r--test/old-elf/X86_64/note-sections.test23
-rw-r--r--test/old-elf/X86_64/omagic.test237
-rw-r--r--test/old-elf/X86_64/outputsegments.test188
-rw-r--r--test/old-elf/X86_64/reloc_r_x86_64_16.test59
-rw-r--r--test/old-elf/X86_64/reloc_r_x86_64_pc16.test60
-rw-r--r--test/old-elf/X86_64/reloc_r_x86_64_pc64.test60
-rw-r--r--test/old-elf/X86_64/rodata.test9
-rw-r--r--test/old-elf/X86_64/sectionchoice.test7
-rw-r--r--test/old-elf/X86_64/sectionmap.test22
-rw-r--r--test/old-elf/X86_64/startGroupEndGroup.test48
-rw-r--r--test/old-elf/X86_64/startGroupEndGroupWithDynlib.test10
-rw-r--r--test/old-elf/X86_64/staticlib-search.test6
-rw-r--r--test/old-elf/X86_64/undef.test18
-rw-r--r--test/old-elf/X86_64/underscore-end.test81
-rw-r--r--test/old-elf/X86_64/weak-override.test45
-rw-r--r--test/old-elf/X86_64/weak-zero-sized.test26
-rw-r--r--test/old-elf/X86_64/weaksym.test77
-rw-r--r--test/old-elf/X86_64/yamlinput.test166
-rw-r--r--test/old-elf/abs-dup.objtxt19
-rw-r--r--test/old-elf/abs.test19
-rw-r--r--test/old-elf/allowduplicates.objtxt41
-rw-r--r--test/old-elf/archive-elf-forceload.test43
-rw-r--r--test/old-elf/archive-elf.test38
-rw-r--r--test/old-elf/as-needed.test15
-rw-r--r--test/old-elf/branch.test34
-rw-r--r--test/old-elf/check.test39
-rw-r--r--test/old-elf/checkrodata.test9
-rw-r--r--test/old-elf/common.test10
-rw-r--r--test/old-elf/consecutive-weak-sym-defs.test81
-rw-r--r--test/old-elf/defsym.objtxt31
-rw-r--r--test/old-elf/discard-all.test88
-rw-r--r--test/old-elf/discard-locals.test65
-rw-r--r--test/old-elf/dynamic-segorder.test17
-rw-r--r--test/old-elf/dynamic-undef.test38
-rw-r--r--test/old-elf/dynamic.test80
-rw-r--r--test/old-elf/eh_frame_hdr.test30
-rw-r--r--test/old-elf/entry.objtxt58
-rw-r--r--test/old-elf/export-dynamic.test98
-rw-r--r--test/old-elf/filenotfound.test3
-rw-r--r--test/old-elf/gnulinkonce/gnulinkonce-report-discarded-reference.test145
-rw-r--r--test/old-elf/gnulinkonce/gnulinkonce-report-undef.test127
-rw-r--r--test/old-elf/gnulinkonce/gnulinkonce.test149
-rw-r--r--test/old-elf/gotpcrel.test21
-rw-r--r--test/old-elf/gottpoff.test119
-rw-r--r--test/old-elf/group-cmd-search.test134
-rw-r--r--test/old-elf/hexagon-quickdata-sort.test12
-rw-r--r--test/old-elf/hexagon-quickdata-sortcommon.test16
-rw-r--r--test/old-elf/ifunc.test69
-rw-r--r--test/old-elf/ignore-unknownoption.test5
-rw-r--r--test/old-elf/init_array-order.test67
-rw-r--r--test/old-elf/init_array.test127
-rw-r--r--test/old-elf/initfini-options.test-1.test33
-rw-r--r--test/old-elf/initfini-options.test-2.test47
-rw-r--r--test/old-elf/initfini-options.test-3.test53
-rw-r--r--test/old-elf/librarynotfound.test5
-rw-r--r--test/old-elf/linker-as-ld.test16
-rw-r--r--test/old-elf/linkerscript/Inputs/externs.ls (renamed from test/elf/linkerscript/Inputs/externs.ls)0
-rw-r--r--test/old-elf/linkerscript/Inputs/invalid.ls (renamed from test/elf/linkerscript/Inputs/invalid.ls)0
-rw-r--r--test/old-elf/linkerscript/Inputs/prog1.o.yaml87
-rw-r--r--test/old-elf/linkerscript/Inputs/prog2.o.yaml88
-rw-r--r--test/old-elf/linkerscript/Inputs/prog3.o.yaml51
-rw-r--r--test/old-elf/linkerscript/Inputs/simple-pic.o.yaml32
-rw-r--r--test/old-elf/linkerscript/Inputs/simple.o.yaml51
-rw-r--r--test/old-elf/linkerscript/Inputs/valid.ls (renamed from test/elf/linkerscript/Inputs/valid.ls)0
-rw-r--r--test/old-elf/linkerscript/externs.objtxt21
-rw-r--r--test/old-elf/linkerscript/filename-with-wildcards.test49
-rw-r--r--test/old-elf/linkerscript/invalid-script-cli-1.test10
-rw-r--r--test/old-elf/linkerscript/invalid-script-cli-2.test6
-rw-r--r--test/old-elf/linkerscript/invalid.test5
-rw-r--r--test/old-elf/linkerscript/phdrs-all-none.test26
-rw-r--r--test/old-elf/linkerscript/phdrs-custom-none.test36
-rw-r--r--test/old-elf/linkerscript/phdrs-default.test82
-rw-r--r--test/old-elf/linkerscript/phdrs-different.test45
-rw-r--r--test/old-elf/linkerscript/phdrs-extra-program.test27
-rw-r--r--test/old-elf/linkerscript/phdrs-flags.test46
-rw-r--r--test/old-elf/linkerscript/phdrs-has-program.test33
-rw-r--r--test/old-elf/linkerscript/phdrs-invalid.test63
-rw-r--r--test/old-elf/linkerscript/phdrs-misplaced-program.test26
-rw-r--r--test/old-elf/linkerscript/phdrs-no-program.test25
-rw-r--r--test/old-elf/linkerscript/phdrs-one-none.test36
-rw-r--r--test/old-elf/linkerscript/phdrs-program-flags.test33
-rw-r--r--test/old-elf/linkerscript/phdrs-program-good-phdrs.test34
-rw-r--r--test/old-elf/linkerscript/phdrs-program-no-phdrs.test26
-rw-r--r--test/old-elf/linkerscript/phdrs-program-wrong-phdrs.test26
-rw-r--r--test/old-elf/linkerscript/phdrs-same-flags.test35
-rw-r--r--test/old-elf/linkerscript/phdrs-same.test36
-rw-r--r--test/old-elf/linkerscript/phdrs/sections-empty-phdrs.script11
-rw-r--r--test/old-elf/linkerscript/phdrs/sections-no-phdrs.script7
-rw-r--r--test/old-elf/linkerscript/phdrs/sections-none-phdrs.script11
-rw-r--r--test/old-elf/linkerscript/phdrs/undef-empty-phdrs.script11
-rw-r--r--test/old-elf/linkerscript/phdrs/undef-id-phdrs.script12
-rw-r--r--test/old-elf/linkerscript/phdrs/undef-no-phdrs.script7
-rw-r--r--test/old-elf/linkerscript/sections-order.test113
-rw-r--r--test/old-elf/linkerscript/sections-with-wildcards.test88
-rw-r--r--test/old-elf/linkerscript/symbol-definition-so.test32
-rw-r--r--test/old-elf/linkerscript/symbol-definition.test54
-rw-r--r--test/old-elf/linkerscript/valid-script-cli.objtxt23
-rw-r--r--test/old-elf/loginputfiles.test28
-rw-r--r--test/old-elf/mergeatoms.test6
-rw-r--r--test/old-elf/mergeconstants.test20
-rw-r--r--test/old-elf/mergeglobalatoms.test11
-rw-r--r--test/old-elf/no-unique-section-names.test19
-rw-r--r--test/old-elf/note.test50
-rw-r--r--test/old-elf/options/dynamic-linker.test17
-rw-r--r--test/old-elf/options/target-specific-args.test5
-rw-r--r--test/old-elf/phdr.test99
-rw-r--r--test/old-elf/quickdata.test15
-rw-r--r--test/old-elf/reloc.test38
-rw-r--r--test/old-elf/responsefile.test6
-rw-r--r--test/old-elf/rodata.test5
-rw-r--r--test/old-elf/rosegment.test26
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-new-members.test151
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-simple.test144
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-undef-member-other.test156
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-undef-member.test142
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-with-globalsymbols.test250
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-with-undef-external-reference.test236
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-with-undef-signature.test219
-rw-r--r--test/old-elf/sections.test142
-rw-r--r--test/old-elf/sh_addralign.test37
-rw-r--r--test/old-elf/shndx.test18
-rw-r--r--test/old-elf/soname.test6
-rw-r--r--test/old-elf/start-stop-sym.test108
-rw-r--r--test/old-elf/strip-all.test108
-rw-r--r--test/old-elf/stripped-empty.test4
-rw-r--r--test/old-elf/symbols.test33
-rw-r--r--test/old-elf/tls-tbss-size.test176
-rw-r--r--test/old-elf/tls.test43
-rw-r--r--test/old-elf/tlsAddr.test7
-rw-r--r--test/old-elf/undef-from-dso-to-main.test52
-rw-r--r--test/old-elf/undef-from-main-dso.test43
-rw-r--r--test/old-elf/weaksym.test7
-rw-r--r--test/old-elf/wrap.test276
-rw-r--r--test/old-elf/x86-64-dynamic-relocs.test26
-rw-r--r--test/old-elf/x86-64-dynamic.test79
-rw-r--r--test/old-elf/x86.test38
-rw-r--r--test/old-elf/x86_64-kinds.test23
-rw-r--r--test/old-elf/zoption_dtflags.test89
-rw-r--r--test/pecoff/Inputs/abs.obj.yaml11
-rw-r--r--test/pecoff/Inputs/alignment.obj.yaml103
-rw-r--r--test/pecoff/Inputs/alternatename1.obj.yaml23
-rw-r--r--test/pecoff/Inputs/alternatename2.obj.yaml23
-rw-r--r--test/pecoff/Inputs/alternatename3.obj.yaml39
-rw-r--r--test/pecoff/Inputs/armnt-ImageBase.obj.yaml39
-rw-r--r--test/pecoff/Inputs/armnt-ImageBase.s16
-rw-r--r--test/pecoff/Inputs/armnt-addr32-exec.obj.yaml55
-rw-r--r--test/pecoff/Inputs/armnt-addr32-exec.s24
-rw-r--r--test/pecoff/Inputs/armnt-addr32.obj.yaml39
-rw-r--r--test/pecoff/Inputs/armnt-addr32.s18
-rw-r--r--test/pecoff/Inputs/armnt-blx23t.obj.yaml39
-rw-r--r--test/pecoff/Inputs/armnt-blx23t.s33
-rw-r--r--test/pecoff/Inputs/armnt-branch24t.obj.yaml39
-rw-r--r--test/pecoff/Inputs/armnt-branch24t.s26
-rw-r--r--test/pecoff/Inputs/armnt-exports.def4
-rw-r--r--test/pecoff/Inputs/armnt-exports.obj.yaml35
-rw-r--r--test/pecoff/Inputs/armnt-import.obj.yaml39
-rw-r--r--test/pecoff/Inputs/armnt-import.s21
-rw-r--r--test/pecoff/Inputs/armnt-mov32t-exec.obj.yaml39
-rw-r--r--test/pecoff/Inputs/armnt-mov32t-exec.s30
-rw-r--r--test/pecoff/Inputs/armnt-mov32t.obj.yaml55
-rw-r--r--test/pecoff/Inputs/armnt-mov32t.s24
-rw-r--r--test/pecoff/Inputs/armnt-obj.s12
-rw-r--r--test/pecoff/Inputs/armnt-obj.yaml29
-rw-r--r--test/pecoff/Inputs/associative1.obj.yaml53
-rw-r--r--test/pecoff/Inputs/associative3.obj.yaml33
-rw-r--r--test/pecoff/Inputs/basereloc.obj.yaml164
-rw-r--r--test/pecoff/Inputs/bss.asm20
-rw-r--r--test/pecoff/Inputs/bss.objbin683 -> 0 bytes
-rw-r--r--test/pecoff/Inputs/comdat.obj.yaml53
-rw-r--r--test/pecoff/Inputs/common-symbol.obj.yaml85
-rw-r--r--test/pecoff/Inputs/drectve.obj.yaml79
-rw-r--r--test/pecoff/Inputs/drectve2.obj.yaml45
-rw-r--r--test/pecoff/Inputs/drectve3.libbin462 -> 0 bytes
-rw-r--r--test/pecoff/Inputs/entry.obj.yaml40
-rw-r--r--test/pecoff/Inputs/executable.obj.yaml29
-rw-r--r--test/pecoff/Inputs/executable.s17
-rw-r--r--test/pecoff/Inputs/export.obj.yaml69
-rw-r--r--test/pecoff/Inputs/exports.def6
-rw-r--r--test/pecoff/Inputs/exports2.def6
-rw-r--r--test/pecoff/Inputs/grouped-sections.asm18
-rw-r--r--test/pecoff/Inputs/grouped-sections.obj.yaml83
-rw-r--r--test/pecoff/Inputs/hello.asm24
-rw-r--r--test/pecoff/Inputs/hello.obj.yaml111
-rw-r--r--test/pecoff/Inputs/hello64.asm22
-rw-r--r--test/pecoff/Inputs/hello64.obj.yaml110
-rw-r--r--test/pecoff/Inputs/hello64lib.asm14
-rw-r--r--test/pecoff/Inputs/hello64lib.libbin1938 -> 0 bytes
-rw-r--r--test/pecoff/Inputs/imagebase.obj.yaml55
-rw-r--r--test/pecoff/Inputs/machine-type-unknown.obj.yaml38
-rw-r--r--test/pecoff/Inputs/main.obj.yaml70
-rw-r--r--test/pecoff/Inputs/merge-largest1.obj.yaml30
-rw-r--r--test/pecoff/Inputs/merge-largest2.obj.yaml30
-rw-r--r--test/pecoff/Inputs/merge-same-size1.obj.yaml30
-rw-r--r--test/pecoff/Inputs/merge-same-size2.obj.yaml30
-rw-r--r--test/pecoff/Inputs/merge-same-size3.obj.yaml30
-rw-r--r--test/pecoff/Inputs/nonstandard-sections.obj.yaml53
-rw-r--r--test/pecoff/Inputs/nop.asm9
-rw-r--r--test/pecoff/Inputs/nop.obj.yaml51
-rw-r--r--test/pecoff/Inputs/nop64.obj.yaml67
-rw-r--r--test/pecoff/Inputs/reloc.obj.yaml82
-rw-r--r--test/pecoff/Inputs/reloc64.obj.yaml63
-rw-r--r--test/pecoff/Inputs/resource.rc4
-rw-r--r--test/pecoff/Inputs/responsefile.txt1
-rw-r--r--test/pecoff/Inputs/secrel1.obj.yaml69
-rw-r--r--test/pecoff/Inputs/secrel2.obj.yaml47
-rw-r--r--test/pecoff/Inputs/seh.c13
-rw-r--r--test/pecoff/Inputs/seh.obj.yaml387
-rw-r--r--test/pecoff/Inputs/static-data1.obj.yaml67
-rw-r--r--test/pecoff/Inputs/static-data2.obj.yaml67
-rw-r--r--test/pecoff/Inputs/static.libbin1120 -> 0 bytes
-rw-r--r--test/pecoff/Inputs/subsystem.main.yaml35
-rw-r--r--test/pecoff/Inputs/subsystem.winmain.yaml35
-rw-r--r--test/pecoff/Inputs/tlsused.obj.yaml29
-rw-r--r--test/pecoff/Inputs/unknown-drectve.obj.yaml42
-rw-r--r--test/pecoff/Inputs/unwind.obj.yaml129
-rw-r--r--test/pecoff/Inputs/vars-main-x64.obj.yaml63
-rw-r--r--test/pecoff/Inputs/vars-main-x86.obj.yaml69
-rw-r--r--test/pecoff/Inputs/vars-main.c7
-rw-r--r--test/pecoff/Inputs/vars.c20
-rw-r--r--test/pecoff/Inputs/vars.dll.yaml19
-rw-r--r--test/pecoff/Inputs/vars.libbin1994 -> 0 bytes
-rw-r--r--test/pecoff/Inputs/vars64.libbin2016 -> 0 bytes
-rw-r--r--test/pecoff/Inputs/weak-externals.asm25
-rw-r--r--test/pecoff/Inputs/weak-externals.obj.yaml91
-rw-r--r--test/pecoff/alignment.test22
-rw-r--r--test/pecoff/alternatename.test44
-rw-r--r--test/pecoff/armnt-ImageBase.test14
-rw-r--r--test/pecoff/armnt-addr32-exec.test11
-rw-r--r--test/pecoff/armnt-addr32.test11
-rw-r--r--test/pecoff/armnt-address-of-entry-point.test6
-rw-r--r--test/pecoff/armnt-blx23t.test27
-rw-r--r--test/pecoff/armnt-branch24t.test20
-rw-r--r--test/pecoff/armnt-exports.s28
-rw-r--r--test/pecoff/armnt-exports.test10
-rw-r--r--test/pecoff/armnt-imports.test11
-rw-r--r--test/pecoff/armnt-mov32t-exec.test21
-rw-r--r--test/pecoff/armnt-movt32t.test17
-rw-r--r--test/pecoff/armnt.test6
-rw-r--r--test/pecoff/associative.test10
-rw-r--r--test/pecoff/base-reloc.test78
-rw-r--r--test/pecoff/baseaddr.test18
-rw-r--r--test/pecoff/bss-section.test21
-rw-r--r--test/pecoff/comdat.test12
-rw-r--r--test/pecoff/common-symbol.test14
-rw-r--r--test/pecoff/conflicting-machine.test6
-rw-r--r--test/pecoff/delayimport.test54
-rw-r--r--test/pecoff/dll.test7
-rw-r--r--test/pecoff/dosstub.test11
-rw-r--r--test/pecoff/drectve.test39
-rw-r--r--test/pecoff/dynamic.test11
-rw-r--r--test/pecoff/dynamicbase.test24
-rw-r--r--test/pecoff/entry.test41
-rw-r--r--test/pecoff/export-warning.test19
-rw-r--r--test/pecoff/export.test90
-rw-r--r--test/pecoff/exportlib.test32
-rw-r--r--test/pecoff/exportlib2.test21
-rw-r--r--test/pecoff/grouped-sections.test17
-rw-r--r--test/pecoff/hello.test51
-rw-r--r--test/pecoff/hello64.test22
-rw-r--r--test/pecoff/help.test4
-rw-r--r--test/pecoff/imagebase.test15
-rw-r--r--test/pecoff/importlib.test55
-rw-r--r--test/pecoff/include.test8
-rw-r--r--test/pecoff/lib.test15
-rw-r--r--test/pecoff/libarg.test9
-rw-r--r--test/pecoff/localyimported.test15
-rw-r--r--test/pecoff/long-section-name.test7
-rw-r--r--test/pecoff/machinetype.test13
-rw-r--r--test/pecoff/manifest.test63
-rw-r--r--test/pecoff/merge-largest.test24
-rw-r--r--test/pecoff/merge-same-size.test32
-rw-r--r--test/pecoff/multi.test17
-rw-r--r--test/pecoff/noentry.test10
-rw-r--r--test/pecoff/nonstandard-sections.test75
-rw-r--r--test/pecoff/options.test40
-rw-r--r--test/pecoff/pe32plus.test87
-rw-r--r--test/pecoff/reloc.test16
-rw-r--r--test/pecoff/reloc64.test20
-rw-r--r--test/pecoff/resource.test16
-rw-r--r--test/pecoff/responsefile.test7
-rw-r--r--test/pecoff/safeseh.test9
-rw-r--r--test/pecoff/secrel.test16
-rw-r--r--test/pecoff/section-attribute.test45
-rw-r--r--test/pecoff/section-renaming.test61
-rw-r--r--test/pecoff/seh.test31
-rw-r--r--test/pecoff/seh64.test57
-rw-r--r--test/pecoff/subsystem.test12
-rw-r--r--test/pecoff/tls.test14
-rw-r--r--test/pecoff/trivial.test103
-rw-r--r--test/pecoff/unknown-drectve.test6
-rw-r--r--test/pecoff/weak-external.test9
-rw-r--r--tools/Makefile17
-rw-r--r--tools/linker-script-test/Makefile24
-rw-r--r--tools/lld/CMakeLists.txt22
-rw-r--r--tools/lld/Makefile30
-rw-r--r--tools/lld/lld.cpp5
-rw-r--r--unittests/CoreTests/Makefile14
-rw-r--r--unittests/DriverTests/CMakeLists.txt4
-rw-r--r--unittests/DriverTests/DarwinLdDriverTest.cpp6
-rw-r--r--unittests/DriverTests/DriverTest.h2
-rw-r--r--unittests/DriverTests/GnuLdDriverTest.cpp21
-rw-r--r--unittests/DriverTests/Makefile20
-rw-r--r--unittests/DriverTests/UniversalDriverTest.cpp4
-rw-r--r--unittests/DriverTests/WinLinkDriverTest.cpp728
-rw-r--r--unittests/DriverTests/WinLinkModuleDefTest.cpp155
-rw-r--r--unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp16
-rw-r--r--unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp17
-rw-r--r--unittests/MachOTests/MachONormalizedFileToAtomsTests.cpp2
-rw-r--r--unittests/MachOTests/MachONormalizedFileYAMLTests.cpp36
-rw-r--r--unittests/Makefile31
-rw-r--r--utils/astyle-options7
1988 files changed, 86158 insertions, 53349 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30ef47a692d2..6b64301d1ad8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -89,10 +89,11 @@ endif()
add_subdirectory(lib)
add_subdirectory(tools)
-add_subdirectory(test)
-
if (LLVM_INCLUDE_TESTS)
+ add_subdirectory(test)
add_subdirectory(unittests)
endif()
add_subdirectory(docs)
+add_subdirectory(COFF)
+add_subdirectory(ELF)
diff --git a/CODE_OWNERS.TXT b/CODE_OWNERS.TXT
new file mode 100644
index 000000000000..292967e588f0
--- /dev/null
+++ b/CODE_OWNERS.TXT
@@ -0,0 +1,19 @@
+This file is a list of the people responsible for ensuring that patches for a
+particular part of LLD are reviewed, either by themself or by someone else.
+They are also the gatekeepers for their part of LLD, with the final word on
+what goes in or not.
+
+The list is sorted by surname and formatted to allow easy grepping and
+beautification by scripts. The fields are: name (N), email (E), web-address
+(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
+(S). Each entry should contain at least the (N), (E) and (D) fields.
+
+
+N: Rui Ueyama
+E: ruiu@google.com
+D: COFF, ELF backends (COFF/* ELF/*)
+
+N: Lang Hames, Nick Kledzik
+E: lhames@gmail.com, kledzik@apple.com
+D: Mach-O backend
+
diff --git a/COFF/CMakeLists.txt b/COFF/CMakeLists.txt
new file mode 100644
index 000000000000..78dc34eff96e
--- /dev/null
+++ b/COFF/CMakeLists.txt
@@ -0,0 +1,33 @@
+set(LLVM_TARGET_DEFINITIONS Options.td)
+tablegen(LLVM Options.inc -gen-opt-parser-defs)
+add_public_tablegen_target(COFFOptionsTableGen)
+
+add_llvm_library(lldCOFF
+ Chunks.cpp
+ DLL.cpp
+ Driver.cpp
+ DriverUtils.cpp
+ Error.cpp
+ ICF.cpp
+ InputFiles.cpp
+ MarkLive.cpp
+ ModuleDef.cpp
+ PDB.cpp
+ SymbolTable.cpp
+ Symbols.cpp
+ Writer.cpp
+
+ LINK_COMPONENTS
+ ${LLVM_TARGETS_TO_BUILD}
+ Core
+ LTO
+ LibDriver
+ Object
+ MC
+ MCDisassembler
+ Target
+ Option
+ Support
+ )
+
+add_dependencies(lldCOFF COFFOptionsTableGen)
diff --git a/COFF/Chunks.cpp b/COFF/Chunks.cpp
new file mode 100644
index 000000000000..50bf55be269b
--- /dev/null
+++ b/COFF/Chunks.cpp
@@ -0,0 +1,340 @@
+//===- Chunks.cpp ---------------------------------------------------------===//
+//
+// The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Chunks.h"
+#include "Error.h"
+#include "InputFiles.h"
+#include "Symbols.h"
+#include "llvm/Object/COFF.h"
+#include "llvm/Support/COFF.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+
+using namespace llvm;
+using namespace llvm::object;
+using namespace llvm::support::endian;
+using namespace llvm::COFF;
+using llvm::support::ulittle32_t;
+
+namespace lld {
+namespace coff {
+
+SectionChunk::SectionChunk(ObjectFile *F, const coff_section *H)
+ : Chunk(SectionKind), Repl(this), File(F), Header(H),
+ Relocs(File->getCOFFObj()->getRelocations(Header)),
+ NumRelocs(std::distance(Relocs.begin(), Relocs.end())) {
+ // Initialize SectionName.
+ File->getCOFFObj()->getSectionName(Header, SectionName);
+
+ // Bit [20:24] contains section alignment. Both 0 and 1 mean alignment 1.
+ unsigned Shift = (Header->Characteristics >> 20) & 0xF;
+ if (Shift > 0)
+ Align = uint32_t(1) << (Shift - 1);
+
+ // Only COMDAT sections are subject of dead-stripping.
+ Live = !isCOMDAT();
+}
+
+static void add16(uint8_t *P, int16_t V) { write16le(P, read16le(P) + V); }
+static void add32(uint8_t *P, int32_t V) { write32le(P, read32le(P) + V); }
+static void add64(uint8_t *P, int64_t V) { write64le(P, read64le(P) + V); }
+static void or16(uint8_t *P, uint16_t V) { write16le(P, read16le(P) | V); }
+
+void SectionChunk::applyRelX64(uint8_t *Off, uint16_t Type, Defined *Sym,
+ uint64_t P) const {
+ uint64_t S = Sym->getRVA();
+ switch (Type) {
+ case IMAGE_REL_AMD64_ADDR32: add32(Off, S + Config->ImageBase); break;
+ case IMAGE_REL_AMD64_ADDR64: add64(Off, S + Config->ImageBase); break;
+ case IMAGE_REL_AMD64_ADDR32NB: add32(Off, S); break;
+ case IMAGE_REL_AMD64_REL32: add32(Off, S - P - 4); break;
+ case IMAGE_REL_AMD64_REL32_1: add32(Off, S - P - 5); break;
+ case IMAGE_REL_AMD64_REL32_2: add32(Off, S - P - 6); break;
+ case IMAGE_REL_AMD64_REL32_3: add32(Off, S - P - 7); break;
+ case IMAGE_REL_AMD64_REL32_4: add32(Off, S - P - 8); break;
+ case IMAGE_REL_AMD64_REL32_5: add32(Off, S - P - 9); break;
+ case IMAGE_REL_AMD64_SECTION: add16(Off, Sym->getSectionIndex()); break;
+ case IMAGE_REL_AMD64_SECREL: add32(Off, Sym->getSecrel()); break;
+ default:
+ error("Unsupported relocation type");
+ }
+}
+
+void SectionChunk::applyRelX86(uint8_t *Off, uint16_t Type, Defined *Sym,
+ uint64_t P) const {
+ uint64_t S = Sym->getRVA();
+ switch (Type) {
+ case IMAGE_REL_I386_ABSOLUTE: break;
+ case IMAGE_REL_I386_DIR32: add32(Off, S + Config->ImageBase); break;
+ case IMAGE_REL_I386_DIR32NB: add32(Off, S); break;
+ case IMAGE_REL_I386_REL32: add32(Off, S - P - 4); break;
+ case IMAGE_REL_I386_SECTION: add16(Off, Sym->getSectionIndex()); break;
+ case IMAGE_REL_I386_SECREL: add32(Off, Sym->getSecrel()); break;
+ default:
+ error("Unsupported relocation type");
+ }
+}
+
+static void applyMOV(uint8_t *Off, uint16_t V) {
+ or16(Off, ((V & 0x800) >> 1) | ((V >> 12) & 0xf));
+ or16(Off + 2, ((V & 0x700) << 4) | (V & 0xff));
+}
+
+static void applyMOV32T(uint8_t *Off, uint32_t V) {
+ applyMOV(Off, V); // set MOVW operand
+ applyMOV(Off + 4, V >> 16); // set MOVT operand
+}
+
+static void applyBranch20T(uint8_t *Off, int32_t V) {
+ uint32_t S = V < 0 ? 1 : 0;
+ uint32_t J1 = (V >> 19) & 1;
+ uint32_t J2 = (V >> 18) & 1;
+ or16(Off, (S << 10) | ((V >> 12) & 0x3f));
+ or16(Off + 2, (J1 << 13) | (J2 << 11) | ((V >> 1) & 0x7ff));
+}
+
+static void applyBranch24T(uint8_t *Off, int32_t V) {
+ uint32_t S = V < 0 ? 1 : 0;
+ uint32_t J1 = ((~V >> 23) & 1) ^ S;
+ uint32_t J2 = ((~V >> 22) & 1) ^ S;
+ or16(Off, (S << 10) | ((V >> 12) & 0x3ff));
+ or16(Off + 2, (J1 << 13) | (J2 << 11) | ((V >> 1) & 0x7ff));
+}
+
+void SectionChunk::applyRelARM(uint8_t *Off, uint16_t Type, Defined *Sym,
+ uint64_t P) const {
+ uint64_t S = Sym->getRVA();
+ // Pointer to thumb code must have the LSB set.
+ if (Sym->isExecutable())
+ S |= 1;
+ switch (Type) {
+ case IMAGE_REL_ARM_ADDR32: add32(Off, S + Config->ImageBase); break;
+ case IMAGE_REL_ARM_ADDR32NB: add32(Off, S); break;
+ case IMAGE_REL_ARM_MOV32T: applyMOV32T(Off, S + Config->ImageBase); break;
+ case IMAGE_REL_ARM_BRANCH20T: applyBranch20T(Off, S - P - 4); break;
+ case IMAGE_REL_ARM_BRANCH24T: applyBranch24T(Off, S - P - 4); break;
+ case IMAGE_REL_ARM_BLX23T: applyBranch24T(Off, S - P - 4); break;
+ default:
+ error("Unsupported relocation type");
+ }
+}
+
+void SectionChunk::writeTo(uint8_t *Buf) const {
+ if (!hasData())
+ return;
+ // Copy section contents from source object file to output file.
+ ArrayRef<uint8_t> A = getContents();
+ memcpy(Buf + OutputSectionOff, A.data(), A.size());
+
+ // Apply relocations.
+ for (const coff_relocation &Rel : Relocs) {
+ uint8_t *Off = Buf + OutputSectionOff + Rel.VirtualAddress;
+ SymbolBody *Body = File->getSymbolBody(Rel.SymbolTableIndex)->repl();
+ Defined *Sym = cast<Defined>(Body);
+ uint64_t P = RVA + Rel.VirtualAddress;
+ switch (Config->Machine) {
+ case AMD64:
+ applyRelX64(Off, Rel.Type, Sym, P);
+ break;
+ case I386:
+ applyRelX86(Off, Rel.Type, Sym, P);
+ break;
+ case ARMNT:
+ applyRelARM(Off, Rel.Type, Sym, P);
+ break;
+ default:
+ llvm_unreachable("unknown machine type");
+ }
+ }
+}
+
+void SectionChunk::addAssociative(SectionChunk *Child) {
+ AssocChildren.push_back(Child);
+}
+
+static uint8_t getBaserelType(const coff_relocation &Rel) {
+ switch (Config->Machine) {
+ case AMD64:
+ if (Rel.Type == IMAGE_REL_AMD64_ADDR64)
+ return IMAGE_REL_BASED_DIR64;
+ return IMAGE_REL_BASED_ABSOLUTE;
+ case I386:
+ if (Rel.Type == IMAGE_REL_I386_DIR32)
+ return IMAGE_REL_BASED_HIGHLOW;
+ return IMAGE_REL_BASED_ABSOLUTE;
+ case ARMNT:
+ if (Rel.Type == IMAGE_REL_ARM_ADDR32)
+ return IMAGE_REL_BASED_HIGHLOW;
+ if (Rel.Type == IMAGE_REL_ARM_MOV32T)
+ return IMAGE_REL_BASED_ARM_MOV32T;
+ return IMAGE_REL_BASED_ABSOLUTE;
+ default:
+ llvm_unreachable("unknown machine type");
+ }
+}
+
+// Windows-specific.
+// Collect all locations that contain absolute addresses, which need to be
+// fixed by the loader if load-time relocation is needed.
+// Only called when base relocation is enabled.
+void SectionChunk::getBaserels(std::vector<Baserel> *Res) {
+ for (const coff_relocation &Rel : Relocs) {
+ uint8_t Ty = getBaserelType(Rel);
+ if (Ty == IMAGE_REL_BASED_ABSOLUTE)
+ continue;
+ SymbolBody *Body = File->getSymbolBody(Rel.SymbolTableIndex)->repl();
+ if (isa<DefinedAbsolute>(Body))
+ continue;
+ Res->emplace_back(RVA + Rel.VirtualAddress, Ty);
+ }
+}
+
+bool SectionChunk::hasData() const {
+ return !(Header->Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA);
+}
+
+uint32_t SectionChunk::getPermissions() const {
+ return Header->Characteristics & PermMask;
+}
+
+bool SectionChunk::isCOMDAT() const {
+ return Header->Characteristics & IMAGE_SCN_LNK_COMDAT;
+}
+
+void SectionChunk::printDiscardedMessage() const {
+ // Removed by dead-stripping. If it's removed by ICF, ICF already
+ // printed out the name, so don't repeat that here.
+ if (Sym && this == Repl)
+ llvm::outs() << "Discarded " << Sym->getName() << "\n";
+}
+
+StringRef SectionChunk::getDebugName() {
+ if (Sym)
+ return Sym->getName();
+ return "";
+}
+
+ArrayRef<uint8_t> SectionChunk::getContents() const {
+ ArrayRef<uint8_t> A;
+ File->getCOFFObj()->getSectionContents(Header, A);
+ return A;
+}
+
+void SectionChunk::replace(SectionChunk *Other) {
+ Other->Repl = Repl;
+ Other->Live = false;
+}
+
+CommonChunk::CommonChunk(const COFFSymbolRef S) : Sym(S) {
+ // Common symbols are aligned on natural boundaries up to 32 bytes.
+ // This is what MSVC link.exe does.
+ Align = std::min(uint64_t(32), NextPowerOf2(Sym.getValue()));
+}
+
+uint32_t CommonChunk::getPermissions() const {
+ return IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_MEM_READ |
+ IMAGE_SCN_MEM_WRITE;
+}
+
+void StringChunk::writeTo(uint8_t *Buf) const {
+ memcpy(Buf + OutputSectionOff, Str.data(), Str.size());
+}
+
+ImportThunkChunkX64::ImportThunkChunkX64(Defined *S) : ImpSymbol(S) {
+ // Intel Optimization Manual says that all branch targets
+ // should be 16-byte aligned. MSVC linker does this too.
+ Align = 16;
+}
+
+void ImportThunkChunkX64::writeTo(uint8_t *Buf) const {
+ memcpy(Buf + OutputSectionOff, ImportThunkX86, sizeof(ImportThunkX86));
+ // The first two bytes is a JMP instruction. Fill its operand.
+ write32le(Buf + OutputSectionOff + 2, ImpSymbol->getRVA() - RVA - getSize());
+}
+
+void ImportThunkChunkX86::getBaserels(std::vector<Baserel> *Res) {
+ Res->emplace_back(getRVA() + 2);
+}
+
+void ImportThunkChunkX86::writeTo(uint8_t *Buf) const {
+ memcpy(Buf + OutputSectionOff, ImportThunkX86, sizeof(ImportThunkX86));
+ // The first two bytes is a JMP instruction. Fill its operand.
+ write32le(Buf + OutputSectionOff + 2,
+ ImpSymbol->getRVA() + Config->ImageBase);
+}
+
+void ImportThunkChunkARM::getBaserels(std::vector<Baserel> *Res) {
+ Res->emplace_back(getRVA(), IMAGE_REL_BASED_ARM_MOV32T);
+}
+
+void ImportThunkChunkARM::writeTo(uint8_t *Buf) const {
+ memcpy(Buf + OutputSectionOff, ImportThunkARM, sizeof(ImportThunkARM));
+ // Fix mov.w and mov.t operands.
+ applyMOV32T(Buf + OutputSectionOff, ImpSymbol->getRVA() + Config->ImageBase);
+}
+
+void LocalImportChunk::getBaserels(std::vector<Baserel> *Res) {
+ Res->emplace_back(getRVA());
+}
+
+size_t LocalImportChunk::getSize() const {
+ return Config->is64() ? 8 : 4;
+}
+
+void LocalImportChunk::writeTo(uint8_t *Buf) const {
+ if (Config->is64()) {
+ write64le(Buf + OutputSectionOff, Sym->getRVA() + Config->ImageBase);
+ } else {
+ write32le(Buf + OutputSectionOff, Sym->getRVA() + Config->ImageBase);
+ }
+}
+
+void SEHTableChunk::writeTo(uint8_t *Buf) const {
+ ulittle32_t *Begin = reinterpret_cast<ulittle32_t *>(Buf + OutputSectionOff);
+ size_t Cnt = 0;
+ for (Defined *D : Syms)
+ Begin[Cnt++] = D->getRVA();
+ std::sort(Begin, Begin + Cnt);
+}
+
+// Windows-specific.
+// This class represents a block in .reloc section.
+BaserelChunk::BaserelChunk(uint32_t Page, Baserel *Begin, Baserel *End) {
+ // Block header consists of 4 byte page RVA and 4 byte block size.
+ // Each entry is 2 byte. Last entry may be padding.
+ Data.resize(RoundUpToAlignment((End - Begin) * 2 + 8, 4));
+ uint8_t *P = Data.data();
+ write32le(P, Page);
+ write32le(P + 4, Data.size());
+ P += 8;
+ for (Baserel *I = Begin; I != End; ++I) {
+ write16le(P, (I->Type << 12) | (I->RVA - Page));
+ P += 2;
+ }
+}
+
+void BaserelChunk::writeTo(uint8_t *Buf) const {
+ memcpy(Buf + OutputSectionOff, Data.data(), Data.size());
+}
+
+uint8_t Baserel::getDefaultType() {
+ switch (Config->Machine) {
+ case AMD64:
+ return IMAGE_REL_BASED_DIR64;
+ case I386:
+ return IMAGE_REL_BASED_HIGHLOW;
+ default:
+ llvm_unreachable("unknown machine type");
+ }
+}
+
+} // namespace coff
+} // namespace lld
diff --git a/COFF/Chunks.h b/COFF/Chunks.h
new file mode 100644
index 000000000000..60b8e76f8230
--- /dev/null
+++ b/COFF/Chunks.h
@@ -0,0 +1,332 @@
+//===- Chunks.h -------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_COFF_CHUNKS_H
+#define LLD_COFF_CHUNKS_H
+
+#include "Config.h"
+#include "InputFiles.h"
+#include "lld/Core/LLVM.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/iterator.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/Object/COFF.h"
+#include <atomic>
+#include <vector>
+
+namespace lld {
+namespace coff {
+
+using llvm::COFF::ImportDirectoryTableEntry;
+using llvm::object::COFFSymbolRef;
+using llvm::object::SectionRef;
+using llvm::object::coff_relocation;
+using llvm::object::coff_section;
+using llvm::sys::fs::file_magic;
+
+class Baserel;
+class Defined;
+class DefinedImportData;
+class DefinedRegular;
+class ObjectFile;
+class OutputSection;
+class SymbolBody;
+
+// Mask for section types (code, data, bss, disacardable, etc.)
+// and permissions (writable, readable or executable).
+const uint32_t PermMask = 0xFF0000F0;
+
+// A Chunk represents a chunk of data that will occupy space in the
+// output (if the resolver chose that). It may or may not be backed by
+// a section of an input file. It could be linker-created data, or
+// doesn't even have actual data (if common or bss).
+class Chunk {
+public:
+ enum Kind { SectionKind, OtherKind };
+ Kind kind() const { return ChunkKind; }
+ virtual ~Chunk() = default;
+
+ // Returns the size of this chunk (even if this is a common or BSS.)
+ virtual size_t getSize() const = 0;
+
+ // Write this chunk to a mmap'ed file, assuming Buf is pointing to
+ // beginning of the file. Because this function may use RVA values
+ // of other chunks for relocations, you need to set them properly
+ // before calling this function.
+ virtual void writeTo(uint8_t *Buf) const {}
+
+ // The writer sets and uses the addresses.
+ uint64_t getRVA() const { return RVA; }
+ uint32_t getAlign() const { return Align; }
+ void setRVA(uint64_t V) { RVA = V; }
+ void setOutputSectionOff(uint64_t V) { OutputSectionOff = V; }
+
+ // Returns true if this has non-zero data. BSS chunks return
+ // false. If false is returned, the space occupied by this chunk
+ // will be filled with zeros.
+ virtual bool hasData() const { return true; }
+
+ // Returns readable/writable/executable bits.
+ virtual uint32_t getPermissions() const { return 0; }
+
+ // Returns the section name if this is a section chunk.
+ // It is illegal to call this function on non-section chunks.
+ virtual StringRef getSectionName() const {
+ llvm_unreachable("unimplemented getSectionName");
+ }
+
+ // An output section has pointers to chunks in the section, and each
+ // chunk has a back pointer to an output section.
+ void setOutputSection(OutputSection *O) { Out = O; }
+ OutputSection *getOutputSection() { return Out; }
+
+ // Windows-specific.
+ // Collect all locations that contain absolute addresses for base relocations.
+ virtual void getBaserels(std::vector<Baserel> *Res) {}
+
+ // Returns a human-readable name of this chunk. Chunks are unnamed chunks of
+ // bytes, so this is used only for logging or debugging.
+ virtual StringRef getDebugName() { return ""; }
+
+protected:
+ Chunk(Kind K = OtherKind) : ChunkKind(K) {}
+ const Kind ChunkKind;
+
+ // The RVA of this chunk in the output. The writer sets a value.
+ uint64_t RVA = 0;
+
+ // The offset from beginning of the output section. The writer sets a value.
+ uint64_t OutputSectionOff = 0;
+
+ // The output section for this chunk.
+ OutputSection *Out = nullptr;
+
+ // The alignment of this chunk. The writer uses the value.
+ uint32_t Align = 1;
+};
+
+// A chunk corresponding a section of an input file.
+class SectionChunk : public Chunk {
+ // Identical COMDAT Folding feature accesses section internal data.
+ friend class ICF;
+
+public:
+ class symbol_iterator : public llvm::iterator_adaptor_base<
+ symbol_iterator, const coff_relocation *,
+ std::random_access_iterator_tag, SymbolBody *> {
+ friend SectionChunk;
+
+ ObjectFile *File;
+
+ symbol_iterator(ObjectFile *File, const coff_relocation *I)
+ : symbol_iterator::iterator_adaptor_base(I), File(File) {}
+
+ public:
+ symbol_iterator() = default;
+
+ SymbolBody *operator*() const {
+ return File->getSymbolBody(I->SymbolTableIndex);
+ }
+ };
+
+ SectionChunk(ObjectFile *File, const coff_section *Header);
+ static bool classof(const Chunk *C) { return C->kind() == SectionKind; }
+ size_t getSize() const override { return Header->SizeOfRawData; }
+ void writeTo(uint8_t *Buf) const override;
+ bool hasData() const override;
+ uint32_t getPermissions() const override;
+ StringRef getSectionName() const override { return SectionName; }
+ void getBaserels(std::vector<Baserel> *Res) override;
+ bool isCOMDAT() const;
+ void applyRelX64(uint8_t *Off, uint16_t Type, Defined *Sym, uint64_t P) const;
+ void applyRelX86(uint8_t *Off, uint16_t Type, Defined *Sym, uint64_t P) const;
+ void applyRelARM(uint8_t *Off, uint16_t Type, Defined *Sym, uint64_t P) const;
+
+ // Called if the garbage collector decides to not include this chunk
+ // in a final output. It's supposed to print out a log message to stdout.
+ void printDiscardedMessage() const;
+
+ // Adds COMDAT associative sections to this COMDAT section. A chunk
+ // and its children are treated as a group by the garbage collector.
+ void addAssociative(SectionChunk *Child);
+
+ StringRef getDebugName() override;
+ void setSymbol(DefinedRegular *S) { if (!Sym) Sym = S; }
+
+ // Used by the garbage collector.
+ bool isLive() { return !Config->DoGC || Live; }
+ void markLive() {
+ assert(!isLive() && "Cannot mark an already live section!");
+ Live = true;
+ }
+
+ // Allow iteration over the bodies of this chunk's relocated symbols.
+ llvm::iterator_range<symbol_iterator> symbols() const {
+ return llvm::make_range(symbol_iterator(File, Relocs.begin()),
+ symbol_iterator(File, Relocs.end()));
+ }
+
+ // Allow iteration over the associated child chunks for this section.
+ ArrayRef<SectionChunk *> children() const { return AssocChildren; }
+
+ // A pointer pointing to a replacement for this chunk.
+ // Initially it points to "this" object. If this chunk is merged
+ // with other chunk by ICF, it points to another chunk,
+ // and this chunk is considrered as dead.
+ SectionChunk *Repl;
+
+ // The CRC of the contents as described in the COFF spec 4.5.5.
+ // Auxiliary Format 5: Section Definitions. Used for ICF.
+ uint32_t Checksum = 0;
+
+private:
+ ArrayRef<uint8_t> getContents() const;
+
+ // A file this chunk was created from.
+ ObjectFile *File;
+
+ const coff_section *Header;
+ StringRef SectionName;
+ std::vector<SectionChunk *> AssocChildren;
+ llvm::iterator_range<const coff_relocation *> Relocs;
+ size_t NumRelocs;
+
+ // Used by the garbage collector.
+ bool Live;
+
+ // Used for ICF (Identical COMDAT Folding)
+ void replace(SectionChunk *Other);
+ std::atomic<uint64_t> GroupID = { 0 };
+
+ // Sym points to a section symbol if this is a COMDAT chunk.
+ DefinedRegular *Sym = nullptr;
+};
+
+// A chunk for common symbols. Common chunks don't have actual data.
+class CommonChunk : public Chunk {
+public:
+ CommonChunk(const COFFSymbolRef Sym);
+ size_t getSize() const override { return Sym.getValue(); }
+ bool hasData() const override { return false; }
+ uint32_t getPermissions() const override;
+ StringRef getSectionName() const override { return ".bss"; }
+
+private:
+ const COFFSymbolRef Sym;
+};
+
+// A chunk for linker-created strings.
+class StringChunk : public Chunk {
+public:
+ explicit StringChunk(StringRef S) : Str(S) {}
+ size_t getSize() const override { return Str.size() + 1; }
+ void writeTo(uint8_t *Buf) const override;
+
+private:
+ StringRef Str;
+};
+
+static const uint8_t ImportThunkX86[] = {
+ 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // JMP *0x0
+};
+
+static const uint8_t ImportThunkARM[] = {
+ 0x40, 0xf2, 0x00, 0x0c, // mov.w ip, #0
+ 0xc0, 0xf2, 0x00, 0x0c, // mov.t ip, #0
+ 0xdc, 0xf8, 0x00, 0xf0, // ldr.w pc, [ip]
+};
+
+// Windows-specific.
+// A chunk for DLL import jump table entry. In a final output, it's
+// contents will be a JMP instruction to some __imp_ symbol.
+class ImportThunkChunkX64 : public Chunk {
+public:
+ explicit ImportThunkChunkX64(Defined *S);
+ size_t getSize() const override { return sizeof(ImportThunkX86); }
+ void writeTo(uint8_t *Buf) const override;
+
+private:
+ Defined *ImpSymbol;
+};
+
+class ImportThunkChunkX86 : public Chunk {
+public:
+ explicit ImportThunkChunkX86(Defined *S) : ImpSymbol(S) {}
+ size_t getSize() const override { return sizeof(ImportThunkX86); }
+ void getBaserels(std::vector<Baserel> *Res) override;
+ void writeTo(uint8_t *Buf) const override;
+
+private:
+ Defined *ImpSymbol;
+};
+
+class ImportThunkChunkARM : public Chunk {
+public:
+ explicit ImportThunkChunkARM(Defined *S) : ImpSymbol(S) {}
+ size_t getSize() const override { return sizeof(ImportThunkARM); }
+ void getBaserels(std::vector<Baserel> *Res) override;
+ void writeTo(uint8_t *Buf) const override;
+
+private:
+ Defined *ImpSymbol;
+};
+
+// Windows-specific.
+// See comments for DefinedLocalImport class.
+class LocalImportChunk : public Chunk {
+public:
+ explicit LocalImportChunk(Defined *S) : Sym(S) {}
+ size_t getSize() const override;
+ void getBaserels(std::vector<Baserel> *Res) override;
+ void writeTo(uint8_t *Buf) const override;
+
+private:
+ Defined *Sym;
+};
+
+// Windows-specific.
+// A chunk for SEH table which contains RVAs of safe exception handler
+// functions. x86-only.
+class SEHTableChunk : public Chunk {
+public:
+ explicit SEHTableChunk(std::set<Defined *> S) : Syms(S) {}
+ size_t getSize() const override { return Syms.size() * 4; }
+ void writeTo(uint8_t *Buf) const override;
+
+private:
+ std::set<Defined *> Syms;
+};
+
+// Windows-specific.
+// This class represents a block in .reloc section.
+// See the PE/COFF spec 5.6 for details.
+class BaserelChunk : public Chunk {
+public:
+ BaserelChunk(uint32_t Page, Baserel *Begin, Baserel *End);
+ size_t getSize() const override { return Data.size(); }
+ void writeTo(uint8_t *Buf) const override;
+
+private:
+ std::vector<uint8_t> Data;
+};
+
+class Baserel {
+public:
+ Baserel(uint32_t V, uint8_t Ty) : RVA(V), Type(Ty) {}
+ explicit Baserel(uint32_t V) : Baserel(V, getDefaultType()) {}
+ uint8_t getDefaultType();
+
+ uint32_t RVA;
+ uint8_t Type;
+};
+
+} // namespace coff
+} // namespace lld
+
+#endif
diff --git a/COFF/Config.h b/COFF/Config.h
new file mode 100644
index 000000000000..409ede648636
--- /dev/null
+++ b/COFF/Config.h
@@ -0,0 +1,140 @@
+//===- Config.h -------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_COFF_CONFIG_H
+#define LLD_COFF_CONFIG_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Object/COFF.h"
+#include <cstdint>
+#include <map>
+#include <set>
+#include <string>
+
+namespace lld {
+namespace coff {
+
+using llvm::COFF::IMAGE_FILE_MACHINE_UNKNOWN;
+using llvm::COFF::WindowsSubsystem;
+using llvm::StringRef;
+class DefinedAbsolute;
+class DefinedRelative;
+class Undefined;
+
+// Short aliases.
+static const auto AMD64 = llvm::COFF::IMAGE_FILE_MACHINE_AMD64;
+static const auto ARMNT = llvm::COFF::IMAGE_FILE_MACHINE_ARMNT;
+static const auto I386 = llvm::COFF::IMAGE_FILE_MACHINE_I386;
+
+// Represents an /export option.
+struct Export {
+ StringRef Name; // N in /export:N or /export:E=N
+ StringRef ExtName; // E in /export:E=N
+ Undefined *Sym = nullptr;
+ uint16_t Ordinal = 0;
+ bool Noname = false;
+ bool Data = false;
+ bool Private = false;
+
+ // True if this /export option was in .drectves section.
+ bool Directives = false;
+ StringRef SymbolName;
+ StringRef ExportName; // Name in DLL
+
+ bool operator==(const Export &E) {
+ return (Name == E.Name && ExtName == E.ExtName &&
+ Ordinal == E.Ordinal && Noname == E.Noname &&
+ Data == E.Data && Private == E.Private);
+ }
+};
+
+// Global configuration.
+struct Configuration {
+ enum ManifestKind { SideBySide, Embed, No };
+ bool is64() { return Machine == AMD64; }
+
+ llvm::COFF::MachineTypes Machine = IMAGE_FILE_MACHINE_UNKNOWN;
+ bool Verbose = false;
+ WindowsSubsystem Subsystem = llvm::COFF::IMAGE_SUBSYSTEM_UNKNOWN;
+ Undefined *Entry = nullptr;
+ bool NoEntry = false;
+ std::string OutputFile;
+ bool DoGC = true;
+ bool DoICF = true;
+ bool Relocatable = true;
+ bool Force = false;
+ bool Debug = false;
+ bool WriteSymtab = true;
+
+ // Symbols in this set are considered as live by the garbage collector.
+ std::set<Undefined *> GCRoot;
+
+ std::set<StringRef> NoDefaultLibs;
+ bool NoDefaultLibAll = false;
+
+ // True if we are creating a DLL.
+ bool DLL = false;
+ StringRef Implib;
+ std::vector<Export> Exports;
+ std::set<std::string> DelayLoads;
+ std::map<std::string, int> DLLOrder;
+ Undefined *DelayLoadHelper = nullptr;
+
+ // Used for SafeSEH.
+ DefinedRelative *SEHTable = nullptr;
+ DefinedAbsolute *SEHCount = nullptr;
+
+ // Used for /opt:lldlto=N
+ unsigned LTOOptLevel = 2;
+
+ // Used for /opt:lldltojobs=N
+ unsigned LTOJobs = 1;
+
+ // Used for /merge:from=to (e.g. /merge:.rdata=.text)
+ std::map<StringRef, StringRef> Merge;
+
+ // Options for manifest files.
+ ManifestKind Manifest = SideBySide;
+ int ManifestID = 1;
+ StringRef ManifestDependency;
+ bool ManifestUAC = true;
+ StringRef ManifestLevel = "'asInvoker'";
+ StringRef ManifestUIAccess = "'false'";
+ StringRef ManifestFile;
+
+ // Used for /failifmismatch.
+ std::map<StringRef, StringRef> MustMatch;
+
+ // Used for /alternatename.
+ std::map<StringRef, StringRef> AlternateNames;
+
+ uint64_t ImageBase = -1;
+ uint64_t StackReserve = 1024 * 1024;
+ uint64_t StackCommit = 4096;
+ uint64_t HeapReserve = 1024 * 1024;
+ uint64_t HeapCommit = 4096;
+ uint32_t MajorImageVersion = 0;
+ uint32_t MinorImageVersion = 0;
+ uint32_t MajorOSVersion = 6;
+ uint32_t MinorOSVersion = 0;
+ bool DynamicBase = true;
+ bool AllowBind = true;
+ bool NxCompat = true;
+ bool AllowIsolation = true;
+ bool TerminalServerAware = true;
+ bool LargeAddressAware = false;
+ bool HighEntropyVA = false;
+};
+
+extern Configuration *Config;
+
+} // namespace coff
+} // namespace lld
+
+#endif
diff --git a/COFF/DLL.cpp b/COFF/DLL.cpp
new file mode 100644
index 000000000000..40ca5cf61dc2
--- /dev/null
+++ b/COFF/DLL.cpp
@@ -0,0 +1,556 @@
+//===- DLL.cpp ------------------------------------------------------------===//
+//
+// The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines various types of chunks for the DLL import or export
+// descriptor tables. They are inherently Windows-specific.
+// You need to read Microsoft PE/COFF spec to understand details
+// about the data structures.
+//
+// If you are not particularly interested in linking against Windows
+// DLL, you can skip this file, and you should still be able to
+// understand the rest of the linker.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Chunks.h"
+#include "DLL.h"
+#include "llvm/Object/COFF.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/Path.h"
+
+using namespace llvm;
+using namespace llvm::object;
+using namespace llvm::support::endian;
+using namespace llvm::COFF;
+
+namespace lld {
+namespace coff {
+namespace {
+
+// Import table
+
+static int ptrSize() { return Config->is64() ? 8 : 4; }
+
+// A chunk for the import descriptor table.
+class HintNameChunk : public Chunk {
+public:
+ HintNameChunk(StringRef N, uint16_t H) : Name(N), Hint(H) {}
+
+ size_t getSize() const override {
+ // Starts with 2 byte Hint field, followed by a null-terminated string,
+ // ends with 0 or 1 byte padding.
+ return RoundUpToAlignment(Name.size() + 3, 2);
+ }
+
+ void writeTo(uint8_t *Buf) const override {
+ write16le(Buf + OutputSectionOff, Hint);
+ memcpy(Buf + OutputSectionOff + 2, Name.data(), Name.size());
+ }
+
+private:
+ StringRef Name;
+ uint16_t Hint;
+};
+
+// A chunk for the import descriptor table.
+class LookupChunk : public Chunk {
+public:
+ explicit LookupChunk(Chunk *C) : HintName(C) {}
+ size_t getSize() const override { return ptrSize(); }
+
+ void writeTo(uint8_t *Buf) const override {
+ write32le(Buf + OutputSectionOff, HintName->getRVA());
+ }
+
+ Chunk *HintName;
+};
+
+// A chunk for the import descriptor table.
+// This chunk represent import-by-ordinal symbols.
+// See Microsoft PE/COFF spec 7.1. Import Header for details.
+class OrdinalOnlyChunk : public Chunk {
+public:
+ explicit OrdinalOnlyChunk(uint16_t V) : Ordinal(V) {}
+ size_t getSize() const override { return ptrSize(); }
+
+ void writeTo(uint8_t *Buf) const override {
+ // An import-by-ordinal slot has MSB 1 to indicate that
+ // this is import-by-ordinal (and not import-by-name).
+ if (Config->is64()) {
+ write64le(Buf + OutputSectionOff, (1ULL << 63) | Ordinal);
+ } else {
+ write32le(Buf + OutputSectionOff, (1ULL << 31) | Ordinal);
+ }
+ }
+
+ uint16_t Ordinal;
+};
+
+// A chunk for the import descriptor table.
+class ImportDirectoryChunk : public Chunk {
+public:
+ explicit ImportDirectoryChunk(Chunk *N) : DLLName(N) {}
+ size_t getSize() const override { return sizeof(ImportDirectoryTableEntry); }
+
+ void writeTo(uint8_t *Buf) const override {
+ auto *E = (coff_import_directory_table_entry *)(Buf + OutputSectionOff);
+ E->ImportLookupTableRVA = LookupTab->getRVA();
+ E->NameRVA = DLLName->getRVA();
+ E->ImportAddressTableRVA = AddressTab->getRVA();
+ }
+
+ Chunk *DLLName;
+ Chunk *LookupTab;
+ Chunk *AddressTab;
+};
+
+// A chunk representing null terminator in the import table.
+// Contents of this chunk is always null bytes.
+class NullChunk : public Chunk {
+public:
+ explicit NullChunk(size_t N) : Size(N) {}
+ bool hasData() const override { return false; }
+ size_t getSize() const override { return Size; }
+ void setAlign(size_t N) { Align = N; }
+
+private:
+ size_t Size;
+};
+
+static std::vector<std::vector<DefinedImportData *>>
+binImports(const std::vector<DefinedImportData *> &Imports) {
+ // Group DLL-imported symbols by DLL name because that's how
+ // symbols are layed out in the import descriptor table.
+ auto Less = [](const std::string &A, const std::string &B) {
+ return Config->DLLOrder[A] < Config->DLLOrder[B];
+ };
+ std::map<std::string, std::vector<DefinedImportData *>,
+ bool(*)(const std::string &, const std::string &)> M(Less);
+ for (DefinedImportData *Sym : Imports)
+ M[Sym->getDLLName().lower()].push_back(Sym);
+
+ std::vector<std::vector<DefinedImportData *>> V;
+ for (auto &P : M) {
+ // Sort symbols by name for each group.
+ std::vector<DefinedImportData *> &Syms = P.second;
+ std::sort(Syms.begin(), Syms.end(),
+ [](DefinedImportData *A, DefinedImportData *B) {
+ return A->getName() < B->getName();
+ });
+ V.push_back(std::move(Syms));
+ }
+ return V;
+}
+
+// Export table
+// See Microsoft PE/COFF spec 4.3 for details.
+
+// A chunk for the delay import descriptor table etnry.
+class DelayDirectoryChunk : public Chunk {
+public:
+ explicit DelayDirectoryChunk(Chunk *N) : DLLName(N) {}
+
+ size_t getSize() const override {
+ return sizeof(delay_import_directory_table_entry);
+ }
+
+ void writeTo(uint8_t *Buf) const override {
+ auto *E = (delay_import_directory_table_entry *)(Buf + OutputSectionOff);
+ E->Attributes = 1;
+ E->Name = DLLName->getRVA();
+ E->ModuleHandle = ModuleHandle->getRVA();
+ E->DelayImportAddressTable = AddressTab->getRVA();
+ E->DelayImportNameTable = NameTab->getRVA();
+ }
+
+ Chunk *DLLName;
+ Chunk *ModuleHandle;
+ Chunk *AddressTab;
+ Chunk *NameTab;
+};
+
+// Initial contents for delay-loaded functions.
+// This code calls __delayLoadHelper2 function to resolve a symbol
+// and then overwrites its jump table slot with the result
+// for subsequent function calls.
+static const uint8_t ThunkX64[] = {
+ 0x51, // push rcx
+ 0x52, // push rdx
+ 0x41, 0x50, // push r8
+ 0x41, 0x51, // push r9
+ 0x48, 0x83, 0xEC, 0x48, // sub rsp, 48h
+ 0x66, 0x0F, 0x7F, 0x04, 0x24, // movdqa xmmword ptr [rsp], xmm0
+ 0x66, 0x0F, 0x7F, 0x4C, 0x24, 0x10, // movdqa xmmword ptr [rsp+10h], xmm1
+ 0x66, 0x0F, 0x7F, 0x54, 0x24, 0x20, // movdqa xmmword ptr [rsp+20h], xmm2
+ 0x66, 0x0F, 0x7F, 0x5C, 0x24, 0x30, // movdqa xmmword ptr [rsp+30h], xmm3
+ 0x48, 0x8D, 0x15, 0, 0, 0, 0, // lea rdx, [__imp_<FUNCNAME>]
+ 0x48, 0x8D, 0x0D, 0, 0, 0, 0, // lea rcx, [___DELAY_IMPORT_...]
+ 0xE8, 0, 0, 0, 0, // call __delayLoadHelper2
+ 0x66, 0x0F, 0x6F, 0x04, 0x24, // movdqa xmm0, xmmword ptr [rsp]
+ 0x66, 0x0F, 0x6F, 0x4C, 0x24, 0x10, // movdqa xmm1, xmmword ptr [rsp+10h]
+ 0x66, 0x0F, 0x6F, 0x54, 0x24, 0x20, // movdqa xmm2, xmmword ptr [rsp+20h]
+ 0x66, 0x0F, 0x6F, 0x5C, 0x24, 0x30, // movdqa xmm3, xmmword ptr [rsp+30h]
+ 0x48, 0x83, 0xC4, 0x48, // add rsp, 48h
+ 0x41, 0x59, // pop r9
+ 0x41, 0x58, // pop r8
+ 0x5A, // pop rdx
+ 0x59, // pop rcx
+ 0xFF, 0xE0, // jmp rax
+};
+
+static const uint8_t ThunkX86[] = {
+ 0x51, // push ecx
+ 0x52, // push edx
+ 0x68, 0, 0, 0, 0, // push offset ___imp__<FUNCNAME>
+ 0x68, 0, 0, 0, 0, // push offset ___DELAY_IMPORT_DESCRIPTOR_<DLLNAME>_dll
+ 0xE8, 0, 0, 0, 0, // call ___delayLoadHelper2@8
+ 0x5A, // pop edx
+ 0x59, // pop ecx
+ 0xFF, 0xE0, // jmp eax
+};
+
+// A chunk for the delay import thunk.
+class ThunkChunkX64 : public Chunk {
+public:
+ ThunkChunkX64(Defined *I, Chunk *D, Defined *H)
+ : Imp(I), Desc(D), Helper(H) {}
+
+ size_t getSize() const override { return sizeof(ThunkX64); }
+
+ void writeTo(uint8_t *Buf) const override {
+ memcpy(Buf + OutputSectionOff, ThunkX64, sizeof(ThunkX64));
+ write32le(Buf + OutputSectionOff + 36, Imp->getRVA() - RVA - 40);
+ write32le(Buf + OutputSectionOff + 43, Desc->getRVA() - RVA - 47);
+ write32le(Buf + OutputSectionOff + 48, Helper->getRVA() - RVA - 52);
+ }
+
+ Defined *Imp = nullptr;
+ Chunk *Desc = nullptr;
+ Defined *Helper = nullptr;
+};
+
+class ThunkChunkX86 : public Chunk {
+public:
+ ThunkChunkX86(Defined *I, Chunk *D, Defined *H)
+ : Imp(I), Desc(D), Helper(H) {}
+
+ size_t getSize() const override { return sizeof(ThunkX86); }
+
+ void writeTo(uint8_t *Buf) const override {
+ memcpy(Buf + OutputSectionOff, ThunkX86, sizeof(ThunkX86));
+ write32le(Buf + OutputSectionOff + 3, Imp->getRVA() + Config->ImageBase);
+ write32le(Buf + OutputSectionOff + 8, Desc->getRVA() + Config->ImageBase);
+ write32le(Buf + OutputSectionOff + 13, Helper->getRVA() - RVA - 17);
+ }
+
+ void getBaserels(std::vector<Baserel> *Res) override {
+ Res->emplace_back(RVA + 3);
+ Res->emplace_back(RVA + 8);
+ }
+
+ Defined *Imp = nullptr;
+ Chunk *Desc = nullptr;
+ Defined *Helper = nullptr;
+};
+
+// A chunk for the import descriptor table.
+class DelayAddressChunk : public Chunk {
+public:
+ explicit DelayAddressChunk(Chunk *C) : Thunk(C) {}
+ size_t getSize() const override { return ptrSize(); }
+
+ void writeTo(uint8_t *Buf) const override {
+ if (Config->is64()) {
+ write64le(Buf + OutputSectionOff, Thunk->getRVA() + Config->ImageBase);
+ } else {
+ write32le(Buf + OutputSectionOff, Thunk->getRVA() + Config->ImageBase);
+ }
+ }
+
+ void getBaserels(std::vector<Baserel> *Res) override {
+ Res->emplace_back(RVA);
+ }
+
+ Chunk *Thunk;
+};
+
+// Export table
+// Read Microsoft PE/COFF spec 5.3 for details.
+
+// A chunk for the export descriptor table.
+class ExportDirectoryChunk : public Chunk {
+public:
+ ExportDirectoryChunk(int I, int J, Chunk *D, Chunk *A, Chunk *N, Chunk *O)
+ : MaxOrdinal(I), NameTabSize(J), DLLName(D), AddressTab(A), NameTab(N),
+ OrdinalTab(O) {}
+
+ size_t getSize() const override {
+ return sizeof(export_directory_table_entry);
+ }
+
+ void writeTo(uint8_t *Buf) const override {
+ auto *E = (export_directory_table_entry *)(Buf + OutputSectionOff);
+ E->NameRVA = DLLName->getRVA();
+ E->OrdinalBase = 0;
+ E->AddressTableEntries = MaxOrdinal + 1;
+ E->NumberOfNamePointers = NameTabSize;
+ E->ExportAddressTableRVA = AddressTab->getRVA();
+ E->NamePointerRVA = NameTab->getRVA();
+ E->OrdinalTableRVA = OrdinalTab->getRVA();
+ }
+
+ uint16_t MaxOrdinal;
+ uint16_t NameTabSize;
+ Chunk *DLLName;
+ Chunk *AddressTab;
+ Chunk *NameTab;
+ Chunk *OrdinalTab;
+};
+
+class AddressTableChunk : public Chunk {
+public:
+ explicit AddressTableChunk(size_t MaxOrdinal) : Size(MaxOrdinal + 1) {}
+ size_t getSize() const override { return Size * 4; }
+
+ void writeTo(uint8_t *Buf) const override {
+ for (Export &E : Config->Exports) {
+ auto *D = cast<Defined>(E.Sym->repl());
+ write32le(Buf + OutputSectionOff + E.Ordinal * 4, D->getRVA());
+ }
+ }
+
+private:
+ size_t Size;
+};
+
+class NamePointersChunk : public Chunk {
+public:
+ explicit NamePointersChunk(std::vector<Chunk *> &V) : Chunks(V) {}
+ size_t getSize() const override { return Chunks.size() * 4; }
+
+ void writeTo(uint8_t *Buf) const override {
+ uint8_t *P = Buf + OutputSectionOff;
+ for (Chunk *C : Chunks) {
+ write32le(P, C->getRVA());
+ P += 4;
+ }
+ }
+
+private:
+ std::vector<Chunk *> Chunks;
+};
+
+class ExportOrdinalChunk : public Chunk {
+public:
+ explicit ExportOrdinalChunk(size_t I) : Size(I) {}
+ size_t getSize() const override { return Size * 2; }
+
+ void writeTo(uint8_t *Buf) const override {
+ uint8_t *P = Buf + OutputSectionOff;
+ for (Export &E : Config->Exports) {
+ if (E.Noname)
+ continue;
+ write16le(P, E.Ordinal);
+ P += 2;
+ }
+ }
+
+private:
+ size_t Size;
+};
+
+} // anonymous namespace
+
+uint64_t IdataContents::getDirSize() {
+ return Dirs.size() * sizeof(ImportDirectoryTableEntry);
+}
+
+uint64_t IdataContents::getIATSize() {
+ return Addresses.size() * ptrSize();
+}
+
+// Returns a list of .idata contents.
+// See Microsoft PE/COFF spec 5.4 for details.
+std::vector<Chunk *> IdataContents::getChunks() {
+ create();
+ std::vector<Chunk *> V;
+ // The loader assumes a specific order of data.
+ // Add each type in the correct order.
+ for (std::unique_ptr<Chunk> &C : Dirs)
+ V.push_back(C.get());
+ for (std::unique_ptr<Chunk> &C : Lookups)
+ V.push_back(C.get());
+ for (std::unique_ptr<Chunk> &C : Addresses)
+ V.push_back(C.get());
+ for (std::unique_ptr<Chunk> &C : Hints)
+ V.push_back(C.get());
+ for (auto &P : DLLNames) {
+ std::unique_ptr<Chunk> &C = P.second;
+ V.push_back(C.get());
+ }
+ return V;
+}
+
+void IdataContents::create() {
+ std::vector<std::vector<DefinedImportData *>> V = binImports(Imports);
+
+ // Create .idata contents for each DLL.
+ for (std::vector<DefinedImportData *> &Syms : V) {
+ StringRef Name = Syms[0]->getDLLName();
+
+ // Create lookup and address tables. If they have external names,
+ // we need to create HintName chunks to store the names.
+ // If they don't (if they are import-by-ordinals), we store only
+ // ordinal values to the table.
+ size_t Base = Lookups.size();
+ for (DefinedImportData *S : Syms) {
+ uint16_t Ord = S->getOrdinal();
+ if (S->getExternalName().empty()) {
+ Lookups.push_back(make_unique<OrdinalOnlyChunk>(Ord));
+ Addresses.push_back(make_unique<OrdinalOnlyChunk>(Ord));
+ continue;
+ }
+ auto C = make_unique<HintNameChunk>(S->getExternalName(), Ord);
+ Lookups.push_back(make_unique<LookupChunk>(C.get()));
+ Addresses.push_back(make_unique<LookupChunk>(C.get()));
+ Hints.push_back(std::move(C));
+ }
+ // Terminate with null values.
+ Lookups.push_back(make_unique<NullChunk>(ptrSize()));
+ Addresses.push_back(make_unique<NullChunk>(ptrSize()));
+
+ for (int I = 0, E = Syms.size(); I < E; ++I)
+ Syms[I]->setLocation(Addresses[Base + I].get());
+
+ // Create the import table header.
+ if (!DLLNames.count(Name))
+ DLLNames[Name] = make_unique<StringChunk>(Name);
+ auto Dir = make_unique<ImportDirectoryChunk>(DLLNames[Name].get());
+ Dir->LookupTab = Lookups[Base].get();
+ Dir->AddressTab = Addresses[Base].get();
+ Dirs.push_back(std::move(Dir));
+ }
+ // Add null terminator.
+ Dirs.push_back(make_unique<NullChunk>(sizeof(ImportDirectoryTableEntry)));
+}
+
+std::vector<Chunk *> DelayLoadContents::getChunks() {
+ std::vector<Chunk *> V;
+ for (std::unique_ptr<Chunk> &C : Dirs)
+ V.push_back(C.get());
+ for (std::unique_ptr<Chunk> &C : Names)
+ V.push_back(C.get());
+ for (std::unique_ptr<Chunk> &C : HintNames)
+ V.push_back(C.get());
+ for (auto &P : DLLNames) {
+ std::unique_ptr<Chunk> &C = P.second;
+ V.push_back(C.get());
+ }
+ return V;
+}
+
+std::vector<Chunk *> DelayLoadContents::getDataChunks() {
+ std::vector<Chunk *> V;
+ for (std::unique_ptr<Chunk> &C : ModuleHandles)
+ V.push_back(C.get());
+ for (std::unique_ptr<Chunk> &C : Addresses)
+ V.push_back(C.get());
+ return V;
+}
+
+uint64_t DelayLoadContents::getDirSize() {
+ return Dirs.size() * sizeof(delay_import_directory_table_entry);
+}
+
+void DelayLoadContents::create(Defined *H) {
+ Helper = H;
+ std::vector<std::vector<DefinedImportData *>> V = binImports(Imports);
+
+ // Create .didat contents for each DLL.
+ for (std::vector<DefinedImportData *> &Syms : V) {
+ StringRef Name = Syms[0]->getDLLName();
+
+ // Create the delay import table header.
+ if (!DLLNames.count(Name))
+ DLLNames[Name] = make_unique<StringChunk>(Name);
+ auto Dir = make_unique<DelayDirectoryChunk>(DLLNames[Name].get());
+
+ size_t Base = Addresses.size();
+ for (DefinedImportData *S : Syms) {
+ Chunk *T = newThunkChunk(S, Dir.get());
+ auto A = make_unique<DelayAddressChunk>(T);
+ Addresses.push_back(std::move(A));
+ Thunks.push_back(std::unique_ptr<Chunk>(T));
+ StringRef ExtName = S->getExternalName();
+ if (ExtName.empty()) {
+ Names.push_back(make_unique<OrdinalOnlyChunk>(S->getOrdinal()));
+ } else {
+ auto C = make_unique<HintNameChunk>(ExtName, 0);
+ Names.push_back(make_unique<LookupChunk>(C.get()));
+ HintNames.push_back(std::move(C));
+ }
+ }
+ // Terminate with null values.
+ Addresses.push_back(make_unique<NullChunk>(8));
+ Names.push_back(make_unique<NullChunk>(8));
+
+ for (int I = 0, E = Syms.size(); I < E; ++I)
+ Syms[I]->setLocation(Addresses[Base + I].get());
+ auto *MH = new NullChunk(8);
+ MH->setAlign(8);
+ ModuleHandles.push_back(std::unique_ptr<Chunk>(MH));
+
+ // Fill the delay import table header fields.
+ Dir->ModuleHandle = MH;
+ Dir->AddressTab = Addresses[Base].get();
+ Dir->NameTab = Names[Base].get();
+ Dirs.push_back(std::move(Dir));
+ }
+ // Add null terminator.
+ Dirs.push_back(
+ make_unique<NullChunk>(sizeof(delay_import_directory_table_entry)));
+}
+
+Chunk *DelayLoadContents::newThunkChunk(DefinedImportData *S, Chunk *Dir) {
+ switch (Config->Machine) {
+ case AMD64:
+ return new ThunkChunkX64(S, Dir, Helper);
+ case I386:
+ return new ThunkChunkX86(S, Dir, Helper);
+ default:
+ llvm_unreachable("unsupported machine type");
+ }
+}
+
+EdataContents::EdataContents() {
+ uint16_t MaxOrdinal = 0;
+ for (Export &E : Config->Exports)
+ MaxOrdinal = std::max(MaxOrdinal, E.Ordinal);
+
+ auto *DLLName = new StringChunk(sys::path::filename(Config->OutputFile));
+ auto *AddressTab = new AddressTableChunk(MaxOrdinal);
+ std::vector<Chunk *> Names;
+ for (Export &E : Config->Exports)
+ if (!E.Noname)
+ Names.push_back(new StringChunk(E.ExportName));
+ auto *NameTab = new NamePointersChunk(Names);
+ auto *OrdinalTab = new ExportOrdinalChunk(Names.size());
+ auto *Dir = new ExportDirectoryChunk(MaxOrdinal, Names.size(), DLLName,
+ AddressTab, NameTab, OrdinalTab);
+ Chunks.push_back(std::unique_ptr<Chunk>(Dir));
+ Chunks.push_back(std::unique_ptr<Chunk>(DLLName));
+ Chunks.push_back(std::unique_ptr<Chunk>(AddressTab));
+ Chunks.push_back(std::unique_ptr<Chunk>(NameTab));
+ Chunks.push_back(std::unique_ptr<Chunk>(OrdinalTab));
+ for (Chunk *C : Names)
+ Chunks.push_back(std::unique_ptr<Chunk>(C));
+}
+
+} // namespace coff
+} // namespace lld
diff --git a/COFF/DLL.h b/COFF/DLL.h
new file mode 100644
index 000000000000..83a12df185c2
--- /dev/null
+++ b/COFF/DLL.h
@@ -0,0 +1,84 @@
+//===- DLL.h ----------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_COFF_DLL_H
+#define LLD_COFF_DLL_H
+
+#include "Chunks.h"
+#include "Symbols.h"
+
+namespace lld {
+namespace coff {
+
+// Windows-specific.
+// IdataContents creates all chunks for the DLL import table.
+// You are supposed to call add() to add symbols and then
+// call getChunks() to get a list of chunks.
+class IdataContents {
+public:
+ void add(DefinedImportData *Sym) { Imports.push_back(Sym); }
+ bool empty() { return Imports.empty(); }
+ std::vector<Chunk *> getChunks();
+
+ uint64_t getDirRVA() { return Dirs[0]->getRVA(); }
+ uint64_t getDirSize();
+ uint64_t getIATRVA() { return Addresses[0]->getRVA(); }
+ uint64_t getIATSize();
+
+private:
+ void create();
+
+ std::vector<DefinedImportData *> Imports;
+ std::vector<std::unique_ptr<Chunk>> Dirs;
+ std::vector<std::unique_ptr<Chunk>> Lookups;
+ std::vector<std::unique_ptr<Chunk>> Addresses;
+ std::vector<std::unique_ptr<Chunk>> Hints;
+ std::map<StringRef, std::unique_ptr<Chunk>> DLLNames;
+};
+
+// Windows-specific.
+// DelayLoadContents creates all chunks for the delay-load DLL import table.
+class DelayLoadContents {
+public:
+ void add(DefinedImportData *Sym) { Imports.push_back(Sym); }
+ bool empty() { return Imports.empty(); }
+ void create(Defined *Helper);
+ std::vector<Chunk *> getChunks();
+ std::vector<Chunk *> getDataChunks();
+ std::vector<std::unique_ptr<Chunk>> &getCodeChunks() { return Thunks; }
+
+ uint64_t getDirRVA() { return Dirs[0]->getRVA(); }
+ uint64_t getDirSize();
+
+private:
+ Chunk *newThunkChunk(DefinedImportData *S, Chunk *Dir);
+
+ Defined *Helper;
+ std::vector<DefinedImportData *> Imports;
+ std::vector<std::unique_ptr<Chunk>> Dirs;
+ std::vector<std::unique_ptr<Chunk>> ModuleHandles;
+ std::vector<std::unique_ptr<Chunk>> Addresses;
+ std::vector<std::unique_ptr<Chunk>> Names;
+ std::vector<std::unique_ptr<Chunk>> HintNames;
+ std::vector<std::unique_ptr<Chunk>> Thunks;
+ std::map<StringRef, std::unique_ptr<Chunk>> DLLNames;
+};
+
+// Windows-specific.
+// EdataContents creates all chunks for the DLL export table.
+class EdataContents {
+public:
+ EdataContents();
+ std::vector<std::unique_ptr<Chunk>> Chunks;
+};
+
+} // namespace coff
+} // namespace lld
+
+#endif
diff --git a/COFF/Driver.cpp b/COFF/Driver.cpp
new file mode 100644
index 000000000000..f528dafd9857
--- /dev/null
+++ b/COFF/Driver.cpp
@@ -0,0 +1,677 @@
+//===- Driver.cpp ---------------------------------------------------------===//
+//
+// The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Config.h"
+#include "Driver.h"
+#include "Error.h"
+#include "InputFiles.h"
+#include "SymbolTable.h"
+#include "Symbols.h"
+#include "Writer.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/LibDriver/LibDriver.h"
+#include "llvm/Option/Arg.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Option/Option.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Process.h"
+#include "llvm/Support/TargetSelect.h"
+#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <memory>
+
+using namespace llvm;
+using namespace llvm::COFF;
+using llvm::sys::Process;
+using llvm::sys::fs::OpenFlags;
+using llvm::sys::fs::file_magic;
+using llvm::sys::fs::identify_magic;
+
+namespace lld {
+namespace coff {
+
+Configuration *Config;
+LinkerDriver *Driver;
+
+void link(llvm::ArrayRef<const char *> Args) {
+ Configuration C;
+ LinkerDriver D;
+ Config = &C;
+ Driver = &D;
+ return Driver->link(Args);
+}
+
+// Drop directory components and replace extension with ".exe".
+static std::string getOutputPath(StringRef Path) {
+ auto P = Path.find_last_of("\\/");
+ StringRef S = (P == StringRef::npos) ? Path : Path.substr(P + 1);
+ return (S.substr(0, S.rfind('.')) + ".exe").str();
+}
+
+// Opens a file. Path has to be resolved already.
+// Newly created memory buffers are owned by this driver.
+MemoryBufferRef LinkerDriver::openFile(StringRef Path) {
+ auto MBOrErr = MemoryBuffer::getFile(Path);
+ error(MBOrErr, Twine("Could not open ") + Path);
+ std::unique_ptr<MemoryBuffer> &MB = *MBOrErr;
+ MemoryBufferRef MBRef = MB->getMemBufferRef();
+ OwningMBs.push_back(std::move(MB)); // take ownership
+ return MBRef;
+}
+
+static std::unique_ptr<InputFile> createFile(MemoryBufferRef MB) {
+ // File type is detected by contents, not by file extension.
+ file_magic Magic = identify_magic(MB.getBuffer());
+ if (Magic == file_magic::archive)
+ return std::unique_ptr<InputFile>(new ArchiveFile(MB));
+ if (Magic == file_magic::bitcode)
+ return std::unique_ptr<InputFile>(new BitcodeFile(MB));
+ if (Config->OutputFile == "")
+ Config->OutputFile = getOutputPath(MB.getBufferIdentifier());
+ return std::unique_ptr<InputFile>(new ObjectFile(MB));
+}
+
+static bool isDecorated(StringRef Sym) {
+ return Sym.startswith("_") || Sym.startswith("@") || Sym.startswith("?");
+}
+
+// Parses .drectve section contents and returns a list of files
+// specified by /defaultlib.
+void LinkerDriver::parseDirectives(StringRef S) {
+ llvm::opt::InputArgList Args = Parser.parse(S);
+
+ for (auto *Arg : Args) {
+ switch (Arg->getOption().getID()) {
+ case OPT_alternatename:
+ parseAlternateName(Arg->getValue());
+ break;
+ case OPT_defaultlib:
+ if (Optional<StringRef> Path = findLib(Arg->getValue())) {
+ MemoryBufferRef MB = openFile(*Path);
+ Symtab.addFile(createFile(MB));
+ }
+ break;
+ case OPT_export: {
+ Export E = parseExport(Arg->getValue());
+ E.Directives = true;
+ Config->Exports.push_back(E);
+ break;
+ }
+ case OPT_failifmismatch:
+ checkFailIfMismatch(Arg->getValue());
+ break;
+ case OPT_incl:
+ addUndefined(Arg->getValue());
+ break;
+ case OPT_merge:
+ parseMerge(Arg->getValue());
+ break;
+ case OPT_nodefaultlib:
+ Config->NoDefaultLibs.insert(doFindLib(Arg->getValue()));
+ break;
+ case OPT_editandcontinue:
+ case OPT_guardsym:
+ case OPT_throwingnew:
+ break;
+ default:
+ error(Twine(Arg->getSpelling()) + " is not allowed in .drectve");
+ }
+ }
+}
+
+// Find file from search paths. You can omit ".obj", this function takes
+// care of that. Note that the returned path is not guaranteed to exist.
+StringRef LinkerDriver::doFindFile(StringRef Filename) {
+ bool hasPathSep = (Filename.find_first_of("/\\") != StringRef::npos);
+ if (hasPathSep)
+ return Filename;
+ bool hasExt = (Filename.find('.') != StringRef::npos);
+ for (StringRef Dir : SearchPaths) {
+ SmallString<128> Path = Dir;
+ llvm::sys::path::append(Path, Filename);
+ if (llvm::sys::fs::exists(Path.str()))
+ return Alloc.save(Path.str());
+ if (!hasExt) {
+ Path.append(".obj");
+ if (llvm::sys::fs::exists(Path.str()))
+ return Alloc.save(Path.str());
+ }
+ }
+ return Filename;
+}
+
+// Resolves a file path. This never returns the same path
+// (in that case, it returns None).
+Optional<StringRef> LinkerDriver::findFile(StringRef Filename) {
+ StringRef Path = doFindFile(Filename);
+ bool Seen = !VisitedFiles.insert(Path.lower()).second;
+ if (Seen)
+ return None;
+ return Path;
+}
+
+// Find library file from search path.
+StringRef LinkerDriver::doFindLib(StringRef Filename) {
+ // Add ".lib" to Filename if that has no file extension.
+ bool hasExt = (Filename.find('.') != StringRef::npos);
+ if (!hasExt)
+ Filename = Alloc.save(Filename + ".lib");
+ return doFindFile(Filename);
+}
+
+// Resolves a library path. /nodefaultlib options are taken into
+// consideration. This never returns the same path (in that case,
+// it returns None).
+Optional<StringRef> LinkerDriver::findLib(StringRef Filename) {
+ if (Config->NoDefaultLibAll)
+ return None;
+ StringRef Path = doFindLib(Filename);
+ if (Config->NoDefaultLibs.count(Path))
+ return None;
+ bool Seen = !VisitedFiles.insert(Path.lower()).second;
+ if (Seen)
+ return None;
+ return Path;
+}
+
+// Parses LIB environment which contains a list of search paths.
+void LinkerDriver::addLibSearchPaths() {
+ Optional<std::string> EnvOpt = Process::GetEnv("LIB");
+ if (!EnvOpt.hasValue())
+ return;
+ StringRef Env = Alloc.save(*EnvOpt);
+ while (!Env.empty()) {
+ StringRef Path;
+ std::tie(Path, Env) = Env.split(';');
+ SearchPaths.push_back(Path);
+ }
+}
+
+Undefined *LinkerDriver::addUndefined(StringRef Name) {
+ Undefined *U = Symtab.addUndefined(Name);
+ Config->GCRoot.insert(U);
+ return U;
+}
+
+// Symbol names are mangled by appending "_" prefix on x86.
+StringRef LinkerDriver::mangle(StringRef Sym) {
+ assert(Config->Machine != IMAGE_FILE_MACHINE_UNKNOWN);
+ if (Config->Machine == I386)
+ return Alloc.save("_" + Sym);
+ return Sym;
+}
+
+// Windows specific -- find default entry point name.
+StringRef LinkerDriver::findDefaultEntry() {
+ // User-defined main functions and their corresponding entry points.
+ static const char *Entries[][2] = {
+ {"main", "mainCRTStartup"},
+ {"wmain", "wmainCRTStartup"},
+ {"WinMain", "WinMainCRTStartup"},
+ {"wWinMain", "wWinMainCRTStartup"},
+ };
+ for (auto E : Entries) {
+ StringRef Entry = Symtab.findMangle(mangle(E[0]));
+ if (!Entry.empty() && !isa<Undefined>(Symtab.find(Entry)->Body))
+ return mangle(E[1]);
+ }
+ return "";
+}
+
+WindowsSubsystem LinkerDriver::inferSubsystem() {
+ if (Config->DLL)
+ return IMAGE_SUBSYSTEM_WINDOWS_GUI;
+ if (Symtab.findUnderscore("main") || Symtab.findUnderscore("wmain"))
+ return IMAGE_SUBSYSTEM_WINDOWS_CUI;
+ if (Symtab.findUnderscore("WinMain") || Symtab.findUnderscore("wWinMain"))
+ return IMAGE_SUBSYSTEM_WINDOWS_GUI;
+ return IMAGE_SUBSYSTEM_UNKNOWN;
+}
+
+static uint64_t getDefaultImageBase() {
+ if (Config->is64())
+ return Config->DLL ? 0x180000000 : 0x140000000;
+ return Config->DLL ? 0x10000000 : 0x400000;
+}
+
+void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
+ // If the first command line argument is "/lib", link.exe acts like lib.exe.
+ // We call our own implementation of lib.exe that understands bitcode files.
+ if (ArgsArr.size() > 1 && StringRef(ArgsArr[1]).equals_lower("/lib")) {
+ if (llvm::libDriverMain(ArgsArr.slice(1)) != 0)
+ error("lib failed");
+ return;
+ }
+
+ // Needed for LTO.
+ llvm::InitializeAllTargetInfos();
+ llvm::InitializeAllTargets();
+ llvm::InitializeAllTargetMCs();
+ llvm::InitializeAllAsmParsers();
+ llvm::InitializeAllAsmPrinters();
+ llvm::InitializeAllDisassemblers();
+
+ // Parse command line options.
+ llvm::opt::InputArgList Args = Parser.parseLINK(ArgsArr.slice(1));
+
+ // Handle /help
+ if (Args.hasArg(OPT_help)) {
+ printHelp(ArgsArr[0]);
+ return;
+ }
+
+ if (Args.filtered_begin(OPT_INPUT) == Args.filtered_end())
+ error("no input files.");
+
+ // Construct search path list.
+ SearchPaths.push_back("");
+ for (auto *Arg : Args.filtered(OPT_libpath))
+ SearchPaths.push_back(Arg->getValue());
+ addLibSearchPaths();
+
+ // Handle /out
+ if (auto *Arg = Args.getLastArg(OPT_out))
+ Config->OutputFile = Arg->getValue();
+
+ // Handle /verbose
+ if (Args.hasArg(OPT_verbose))
+ Config->Verbose = true;
+
+ // Handle /force or /force:unresolved
+ if (Args.hasArg(OPT_force) || Args.hasArg(OPT_force_unresolved))
+ Config->Force = true;
+
+ // Handle /debug
+ if (Args.hasArg(OPT_debug))
+ Config->Debug = true;
+
+ // Handle /noentry
+ if (Args.hasArg(OPT_noentry)) {
+ if (!Args.hasArg(OPT_dll))
+ error("/noentry must be specified with /dll");
+ Config->NoEntry = true;
+ }
+
+ // Handle /dll
+ if (Args.hasArg(OPT_dll)) {
+ Config->DLL = true;
+ Config->ManifestID = 2;
+ }
+
+ // Handle /fixed
+ if (Args.hasArg(OPT_fixed)) {
+ if (Args.hasArg(OPT_dynamicbase))
+ error("/fixed must not be specified with /dynamicbase");
+ Config->Relocatable = false;
+ Config->DynamicBase = false;
+ }
+
+ // Handle /machine
+ if (auto *Arg = Args.getLastArg(OPT_machine))
+ Config->Machine = getMachineType(Arg->getValue());
+
+ // Handle /nodefaultlib:<filename>
+ for (auto *Arg : Args.filtered(OPT_nodefaultlib))
+ Config->NoDefaultLibs.insert(doFindLib(Arg->getValue()));
+
+ // Handle /nodefaultlib
+ if (Args.hasArg(OPT_nodefaultlib_all))
+ Config->NoDefaultLibAll = true;
+
+ // Handle /base
+ if (auto *Arg = Args.getLastArg(OPT_base))
+ parseNumbers(Arg->getValue(), &Config->ImageBase);
+
+ // Handle /stack
+ if (auto *Arg = Args.getLastArg(OPT_stack))
+ parseNumbers(Arg->getValue(), &Config->StackReserve, &Config->StackCommit);
+
+ // Handle /heap
+ if (auto *Arg = Args.getLastArg(OPT_heap))
+ parseNumbers(Arg->getValue(), &Config->HeapReserve, &Config->HeapCommit);
+
+ // Handle /version
+ if (auto *Arg = Args.getLastArg(OPT_version))
+ parseVersion(Arg->getValue(), &Config->MajorImageVersion,
+ &Config->MinorImageVersion);
+
+ // Handle /subsystem
+ if (auto *Arg = Args.getLastArg(OPT_subsystem))
+ parseSubsystem(Arg->getValue(), &Config->Subsystem, &Config->MajorOSVersion,
+ &Config->MinorOSVersion);
+
+ // Handle /alternatename
+ for (auto *Arg : Args.filtered(OPT_alternatename))
+ parseAlternateName(Arg->getValue());
+
+ // Handle /include
+ for (auto *Arg : Args.filtered(OPT_incl))
+ addUndefined(Arg->getValue());
+
+ // Handle /implib
+ if (auto *Arg = Args.getLastArg(OPT_implib))
+ Config->Implib = Arg->getValue();
+
+ // Handle /opt
+ for (auto *Arg : Args.filtered(OPT_opt)) {
+ std::string Str = StringRef(Arg->getValue()).lower();
+ SmallVector<StringRef, 1> Vec;
+ StringRef(Str).split(Vec, ',');
+ for (StringRef S : Vec) {
+ if (S == "noref") {
+ Config->DoGC = false;
+ Config->DoICF = false;
+ continue;
+ }
+ if (S == "icf" || StringRef(S).startswith("icf=")) {
+ Config->DoICF = true;
+ continue;
+ }
+ if (S == "noicf") {
+ Config->DoICF = false;
+ continue;
+ }
+ if (StringRef(S).startswith("lldlto=")) {
+ StringRef OptLevel = StringRef(S).substr(7);
+ if (OptLevel.getAsInteger(10, Config->LTOOptLevel) ||
+ Config->LTOOptLevel > 3)
+ error("/opt:lldlto: invalid optimization level: " + OptLevel);
+ continue;
+ }
+ if (StringRef(S).startswith("lldltojobs=")) {
+ StringRef Jobs = StringRef(S).substr(11);
+ if (Jobs.getAsInteger(10, Config->LTOJobs) || Config->LTOJobs == 0)
+ error("/opt:lldltojobs: invalid job count: " + Jobs);
+ continue;
+ }
+ if (S != "ref" && S != "lbr" && S != "nolbr")
+ error(Twine("/opt: unknown option: ") + S);
+ }
+ }
+
+ // Handle /failifmismatch
+ for (auto *Arg : Args.filtered(OPT_failifmismatch))
+ checkFailIfMismatch(Arg->getValue());
+
+ // Handle /merge
+ for (auto *Arg : Args.filtered(OPT_merge))
+ parseMerge(Arg->getValue());
+
+ // Handle /manifest
+ if (auto *Arg = Args.getLastArg(OPT_manifest_colon))
+ parseManifest(Arg->getValue());
+
+ // Handle /manifestuac
+ if (auto *Arg = Args.getLastArg(OPT_manifestuac))
+ parseManifestUAC(Arg->getValue());
+
+ // Handle /manifestdependency
+ if (auto *Arg = Args.getLastArg(OPT_manifestdependency))
+ Config->ManifestDependency = Arg->getValue();
+
+ // Handle /manifestfile
+ if (auto *Arg = Args.getLastArg(OPT_manifestfile))
+ Config->ManifestFile = Arg->getValue();
+
+ // Handle miscellaneous boolean flags.
+ if (Args.hasArg(OPT_allowbind_no))
+ Config->AllowBind = false;
+ if (Args.hasArg(OPT_allowisolation_no))
+ Config->AllowIsolation = false;
+ if (Args.hasArg(OPT_dynamicbase_no))
+ Config->DynamicBase = false;
+ if (Args.hasArg(OPT_nxcompat_no))
+ Config->NxCompat = false;
+ if (Args.hasArg(OPT_tsaware_no))
+ Config->TerminalServerAware = false;
+ if (Args.hasArg(OPT_nosymtab))
+ Config->WriteSymtab = false;
+
+ // Create a list of input files. Files can be given as arguments
+ // for /defaultlib option.
+ std::vector<StringRef> Paths;
+ std::vector<MemoryBufferRef> MBs;
+ for (auto *Arg : Args.filtered(OPT_INPUT))
+ if (Optional<StringRef> Path = findFile(Arg->getValue()))
+ Paths.push_back(*Path);
+ for (auto *Arg : Args.filtered(OPT_defaultlib))
+ if (Optional<StringRef> Path = findLib(Arg->getValue()))
+ Paths.push_back(*Path);
+ for (StringRef Path : Paths)
+ MBs.push_back(openFile(Path));
+
+ // Windows specific -- Create a resource file containing a manifest file.
+ if (Config->Manifest == Configuration::Embed) {
+ std::unique_ptr<MemoryBuffer> MB = createManifestRes();
+ MBs.push_back(MB->getMemBufferRef());
+ OwningMBs.push_back(std::move(MB)); // take ownership
+ }
+
+ // Windows specific -- Input files can be Windows resource files (.res files).
+ // We invoke cvtres.exe to convert resource files to a regular COFF file
+ // then link the result file normally.
+ std::vector<MemoryBufferRef> Resources;
+ auto NotResource = [](MemoryBufferRef MB) {
+ return identify_magic(MB.getBuffer()) != file_magic::windows_resource;
+ };
+ auto It = std::stable_partition(MBs.begin(), MBs.end(), NotResource);
+ if (It != MBs.end()) {
+ Resources.insert(Resources.