From 1c98619801a5705c688e683be3ef9d70169a0686 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 23 Jul 2016 20:48:50 +0000 Subject: Vendor import of lld release_39 branch r276489: https://llvm.org/svn/llvm-project/lld/branches/release_39@276489 --- .arcconfig | 2 +- CMakeLists.txt | 2 +- COFF/CMakeLists.txt | 3 + COFF/Chunks.cpp | 13 +- COFF/Chunks.h | 10 +- COFF/Config.h | 4 + COFF/DLL.cpp | 2 +- COFF/Driver.cpp | 55 +- COFF/Driver.h | 5 +- COFF/DriverUtils.cpp | 332 +-- COFF/Error.cpp | 13 +- COFF/Error.h | 18 +- COFF/ICF.cpp | 6 +- COFF/InputFiles.cpp | 119 +- COFF/InputFiles.h | 9 +- COFF/Librarian.cpp | 489 ++++ COFF/ModuleDef.cpp | 14 +- COFF/Options.td | 2 + COFF/PDB.cpp | 3 +- COFF/README.md | 266 +- COFF/SymbolTable.cpp | 33 +- COFF/SymbolTable.h | 2 +- COFF/Symbols.cpp | 28 +- COFF/Symbols.h | 4 - COFF/Writer.cpp | 72 +- ELF/CMakeLists.txt | 28 +- ELF/Config.h | 63 +- ELF/Driver.cpp | 463 +++- ELF/Driver.h | 65 +- ELF/DriverUtils.cpp | 234 +- ELF/EhFrame.cpp | 167 ++ ELF/EhFrame.h | 22 + ELF/Error.cpp | 49 +- ELF/Error.h | 39 +- ELF/ICF.cpp | 345 +++ ELF/ICF.h | 19 + ELF/InputFiles.cpp | 775 ++++-- ELF/InputFiles.h | 187 +- ELF/InputSection.cpp | 779 ++++-- ELF/InputSection.h | 206 +- ELF/LTO.cpp | 325 +++ ELF/LTO.h | 54 + ELF/LinkerScript.cpp | 566 +++- ELF/LinkerScript.h | 103 + ELF/MarkLive.cpp | 167 +- ELF/Options.td | 283 +- ELF/OutputSections.cpp | 2176 +++++++++------ ELF/OutputSections.h | 596 ++-- ELF/README.md | 22 +- ELF/Relocations.cpp | 704 +++++ ELF/Relocations.h | 93 + ELF/ScriptParser.cpp | 163 ++ ELF/ScriptParser.h | 49 + ELF/Strings.cpp | 98 + ELF/Strings.h | 29 + ELF/SymbolListFile.cpp | 168 ++ ELF/SymbolListFile.h | 27 + ELF/SymbolTable.cpp | 717 ++++- ELF/SymbolTable.h | 99 +- ELF/Symbols.cpp | 369 ++- ELF/Symbols.h | 470 ++-- ELF/Target.cpp | 2678 ++++++++++-------- ELF/Target.h | 151 +- ELF/Thunks.cpp | 268 ++ ELF/Thunks.h | 56 + ELF/Writer.cpp | 1564 ++++++----- ELF/Writer.h | 20 +- LICENSE.TXT | 2 +- docs/AtomLLD.rst | 61 + docs/NewLLD.rst | 350 +++ docs/ReleaseNotes.rst | 35 + docs/conf.py | 3 +- docs/design.rst | 31 - docs/index.rst | 72 +- docs/open_projects.rst | 5 - include/lld/Core/Alias.h | 100 - include/lld/Core/ArchiveLibraryFile.h | 15 +- include/lld/Core/Atom.h | 53 + include/lld/Core/DefinedAtom.h | 50 +- include/lld/Core/Error.h | 42 +- include/lld/Core/File.h | 120 +- include/lld/Core/LLVM.h | 6 + include/lld/Core/LinkingContext.h | 150 +- include/lld/Core/Node.h | 6 +- include/lld/Core/Parallel.h | 36 - include/lld/Core/Pass.h | 4 +- include/lld/Core/PassManager.h | 7 +- include/lld/Core/Reader.h | 9 +- include/lld/Core/Reference.h | 18 +- include/lld/Core/Resolver.h | 41 +- include/lld/Core/STDExtras.h | 29 - include/lld/Core/SharedLibraryAtom.h | 4 +- include/lld/Core/SharedLibraryFile.h | 21 +- include/lld/Core/Simple.h | 150 +- include/lld/Core/SymbolTable.h | 11 - include/lld/Core/UndefinedAtom.h | 10 +- include/lld/Core/Writer.h | 11 +- include/lld/Core/range.h | 738 ----- include/lld/Driver/Driver.h | 138 +- include/lld/ReaderWriter/AtomLayout.h | 39 - include/lld/ReaderWriter/CoreLinkingContext.h | 47 - include/lld/ReaderWriter/ELFLinkingContext.h | 422 --- include/lld/ReaderWriter/LinkerScript.h | 1471 ---------- include/lld/ReaderWriter/MachOLinkingContext.h | 133 +- lib/Config/Version.cpp | 27 +- lib/Core/DefinedAtom.cpp | 11 +- lib/Core/Error.cpp | 48 +- lib/Core/File.cpp | 2 +- lib/Core/LinkingContext.cpp | 47 +- lib/Core/Reader.cpp | 1 - lib/Core/Resolver.cpp | 330 +-- lib/Core/SymbolTable.cpp | 92 +- lib/Driver/CMakeLists.txt | 21 - lib/Driver/CoreDriver.cpp | 173 -- lib/Driver/CoreOptions.td | 15 - lib/Driver/DarwinLdDriver.cpp | 387 ++- lib/Driver/DarwinLdOptions.td | 35 + lib/Driver/Driver.cpp | 142 - lib/Driver/GnuLdDriver.cpp | 782 ------ lib/Driver/GnuLdOptions.td | 378 --- lib/Driver/TODO.rst | 99 - lib/Driver/UniversalDriver.cpp | 225 -- lib/Driver/UniversalDriverOptions.td | 19 - lib/ReaderWriter/CMakeLists.txt | 3 - lib/ReaderWriter/CoreLinkingContext.cpp | 50 - .../ELF/AArch64/AArch64DynamicLibraryWriter.h | 45 - .../ELF/AArch64/AArch64ExecutableWriter.cpp | 52 - .../ELF/AArch64/AArch64ExecutableWriter.h | 38 - .../ELF/AArch64/AArch64LinkingContext.cpp | 45 - .../ELF/AArch64/AArch64LinkingContext.h | 101 - .../ELF/AArch64/AArch64RelocationHandler.cpp | 556 ---- .../ELF/AArch64/AArch64RelocationHandler.h | 36 - .../ELF/AArch64/AArch64RelocationPass.cpp | 612 ----- .../ELF/AArch64/AArch64RelocationPass.h | 32 - .../ELF/AArch64/AArch64SectionChunks.cpp | 39 - .../ELF/AArch64/AArch64SectionChunks.h | 37 - .../ELF/AArch64/AArch64TargetHandler.cpp | 51 - .../ELF/AArch64/AArch64TargetHandler.h | 90 - lib/ReaderWriter/ELF/AArch64/CMakeLists.txt | 14 - lib/ReaderWriter/ELF/AArch64/TODO.rst | 15 - lib/ReaderWriter/ELF/ARM/ARMDynamicLibraryWriter.h | 49 - lib/ReaderWriter/ELF/ARM/ARMELFFile.h | 154 -- lib/ReaderWriter/ELF/ARM/ARMELFWriters.h | 120 - lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h | 68 - lib/ReaderWriter/ELF/ARM/ARMLinkingContext.cpp | 64 - lib/ReaderWriter/ELF/ARM/ARMLinkingContext.h | 80 - lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp | 680 ----- lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.h | 35 - lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp | 985 ------- lib/ReaderWriter/ELF/ARM/ARMRelocationPass.h | 31 - lib/ReaderWriter/ELF/ARM/ARMSymbolTable.h | 59 - lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp | 32 - lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h | 174 -- lib/ReaderWriter/ELF/ARM/CMakeLists.txt | 12 - lib/ReaderWriter/ELF/ARM/TODO.rst | 21 - lib/ReaderWriter/ELF/Atoms.cpp | 297 -- lib/ReaderWriter/ELF/Atoms.h | 493 ---- lib/ReaderWriter/ELF/CMakeLists.txt | 29 - lib/ReaderWriter/ELF/Chunk.h | 111 - lib/ReaderWriter/ELF/DynamicFile.cpp | 146 - lib/ReaderWriter/ELF/DynamicFile.h | 59 - lib/ReaderWriter/ELF/DynamicLibraryWriter.h | 86 - lib/ReaderWriter/ELF/ELFFile.cpp | 829 ------ lib/ReaderWriter/ELF/ELFFile.h | 395 --- lib/ReaderWriter/ELF/ELFLinkingContext.cpp | 263 -- lib/ReaderWriter/ELF/ELFReader.h | 47 - lib/ReaderWriter/ELF/ExecutableWriter.h | 157 -- lib/ReaderWriter/ELF/FileCommon.cpp | 66 - lib/ReaderWriter/ELF/FileCommon.h | 45 - lib/ReaderWriter/ELF/HeaderChunks.cpp | 205 -- lib/ReaderWriter/ELF/HeaderChunks.h | 154 -- lib/ReaderWriter/ELF/Hexagon/CMakeLists.txt | 11 - .../ELF/Hexagon/HexagonDynamicLibraryWriter.h | 67 - lib/ReaderWriter/ELF/Hexagon/HexagonELFFile.h | 149 - lib/ReaderWriter/ELF/Hexagon/HexagonEncodings.h | 638 ----- .../ELF/Hexagon/HexagonExecutableWriter.h | 73 - .../ELF/Hexagon/HexagonLinkingContext.cpp | 47 - .../ELF/Hexagon/HexagonLinkingContext.h | 61 - .../ELF/Hexagon/HexagonRelocationHandler.cpp | 330 --- .../ELF/Hexagon/HexagonRelocationHandler.h | 33 - .../ELF/Hexagon/HexagonTargetHandler.cpp | 382 --- .../ELF/Hexagon/HexagonTargetHandler.h | 134 - lib/ReaderWriter/ELF/Mips/CMakeLists.txt | 18 - lib/ReaderWriter/ELF/Mips/MipsAbiInfoHandler.cpp | 675 ----- lib/ReaderWriter/ELF/Mips/MipsAbiInfoHandler.h | 83 - lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp | 76 - lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.h | 25 - lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h | 124 - lib/ReaderWriter/ELF/Mips/MipsELFFile.cpp | 348 --- lib/ReaderWriter/ELF/Mips/MipsELFFile.h | 126 - lib/ReaderWriter/ELF/Mips/MipsELFWriters.cpp | 292 -- lib/ReaderWriter/ELF/Mips/MipsELFWriters.h | 102 - lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp | 164 -- lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h | 56 - .../ELF/Mips/MipsRelocationHandler.cpp | 687 ----- lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.h | 31 - lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp | 1415 ---------- lib/ReaderWriter/ELF/Mips/MipsRelocationPass.h | 25 - lib/ReaderWriter/ELF/Mips/MipsSectionChunks.cpp | 264 -- lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h | 150 - lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp | 166 -- lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h | 73 - lib/ReaderWriter/ELF/Mips/MipsTargetLayout.cpp | 111 - lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h | 71 - lib/ReaderWriter/ELF/OrderPass.h | 31 - lib/ReaderWriter/ELF/OutputELFWriter.cpp | 514 ---- lib/ReaderWriter/ELF/OutputELFWriter.h | 153 -- lib/ReaderWriter/ELF/Reader.cpp | 43 - lib/ReaderWriter/ELF/SectionChunks.cpp | 996 ------- lib/ReaderWriter/ELF/SectionChunks.h | 616 ----- lib/ReaderWriter/ELF/SegmentChunks.cpp | 519 ---- lib/ReaderWriter/ELF/SegmentChunks.h | 246 -- lib/ReaderWriter/ELF/TODO.txt | 18 - lib/ReaderWriter/ELF/TargetHandler.h | 35 - lib/ReaderWriter/ELF/TargetLayout.cpp | 747 ----- lib/ReaderWriter/ELF/TargetLayout.h | 327 --- lib/ReaderWriter/ELF/Writer.cpp | 23 - lib/ReaderWriter/ELF/Writer.h | 35 - lib/ReaderWriter/ELF/X86/CMakeLists.txt | 11 - lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h | 44 - lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h | 39 - lib/ReaderWriter/ELF/X86/X86LinkingContext.cpp | 39 - lib/ReaderWriter/ELF/X86/X86LinkingContext.h | 44 - lib/ReaderWriter/ELF/X86/X86RelocationHandler.cpp | 54 - lib/ReaderWriter/ELF/X86/X86RelocationHandler.h | 28 - lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp | 36 - lib/ReaderWriter/ELF/X86/X86TargetHandler.h | 48 - lib/ReaderWriter/ELF/X86_64/CMakeLists.txt | 17 - .../ELF/X86_64/ExampleSubTarget/CMakeLists.txt | 11 - .../ExampleSubTarget/ExampleLinkingContext.cpp | 35 - .../ExampleSubTarget/ExampleLinkingContext.h | 31 - .../ExampleSubTarget/ExampleTargetHandler.cpp | 22 - .../X86_64/ExampleSubTarget/ExampleTargetHandler.h | 31 - lib/ReaderWriter/ELF/X86_64/TODO.rst | 46 - .../ELF/X86_64/X86_64DynamicLibraryWriter.h | 45 - .../ELF/X86_64/X86_64ExecutableWriter.h | 57 - .../ELF/X86_64/X86_64LinkingContext.cpp | 50 - lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.h | 103 - .../ELF/X86_64/X86_64RelocationHandler.cpp | 147 - .../ELF/X86_64/X86_64RelocationHandler.h | 37 - .../ELF/X86_64/X86_64RelocationPass.cpp | 513 ---- lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.h | 32 - .../ELF/X86_64/X86_64SectionChunks.cpp | 37 - lib/ReaderWriter/ELF/X86_64/X86_64SectionChunks.h | 36 - .../ELF/X86_64/X86_64TargetHandler.cpp | 34 - lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h | 104 - lib/ReaderWriter/FileArchive.cpp | 173 +- lib/ReaderWriter/LinkerScript.cpp | 2895 -------------------- lib/ReaderWriter/MachO/ArchHandler.h | 29 +- lib/ReaderWriter/MachO/ArchHandler_arm.cpp | 131 +- lib/ReaderWriter/MachO/ArchHandler_arm64.cpp | 122 +- lib/ReaderWriter/MachO/ArchHandler_x86.cpp | 74 +- lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp | 178 +- lib/ReaderWriter/MachO/Atoms.h | 32 +- lib/ReaderWriter/MachO/CMakeLists.txt | 2 + lib/ReaderWriter/MachO/CompactUnwindPass.cpp | 33 +- lib/ReaderWriter/MachO/ExecutableAtoms.h | 108 +- lib/ReaderWriter/MachO/File.h | 93 +- lib/ReaderWriter/MachO/FlatNamespaceFile.h | 28 +- lib/ReaderWriter/MachO/GOTPass.cpp | 12 +- lib/ReaderWriter/MachO/LayoutPass.cpp | 47 +- lib/ReaderWriter/MachO/LayoutPass.h | 39 +- lib/ReaderWriter/MachO/MachOLinkingContext.cpp | 216 +- lib/ReaderWriter/MachO/MachONormalizedFile.h | 32 +- .../MachO/MachONormalizedFileBinaryReader.cpp | 44 +- .../MachO/MachONormalizedFileBinaryUtils.h | 46 +- .../MachO/MachONormalizedFileBinaryWriter.cpp | 461 ++-- .../MachO/MachONormalizedFileFromAtoms.cpp | 268 +- .../MachO/MachONormalizedFileToAtoms.cpp | 608 ++-- lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp | 81 +- lib/ReaderWriter/MachO/MachOPasses.h | 1 + lib/ReaderWriter/MachO/ObjCPass.cpp | 128 + lib/ReaderWriter/MachO/SectCreateFile.h | 19 +- lib/ReaderWriter/MachO/ShimPass.cpp | 13 +- lib/ReaderWriter/MachO/StubsPass.cpp | 40 +- lib/ReaderWriter/MachO/TLVPass.cpp | 14 +- lib/ReaderWriter/MachO/WriterMachO.cpp | 9 +- lib/ReaderWriter/YAML/ReaderWriterYAML.cpp | 302 +- test/CMakeLists.txt | 4 +- test/COFF/Inputs/armnt-executable.obj.yaml | 2 +- test/COFF/Inputs/export.yaml | 4 +- test/COFF/Inputs/export2.yaml | 2 +- test/COFF/Inputs/hello32.yaml | 2 +- test/COFF/Inputs/import.yaml | 2 +- test/COFF/Inputs/include1a.yaml | 4 +- test/COFF/Inputs/include1b.yaml | 4 +- test/COFF/Inputs/include1c.yaml | 2 +- test/COFF/Inputs/machine-x64.yaml | 2 +- test/COFF/Inputs/machine-x86.yaml | 2 +- test/COFF/Inputs/manifestinput.test | 13 + test/COFF/Inputs/ret42.yaml | 2 +- test/COFF/alternatename.test | 4 +- test/COFF/ar-comdat.test | 2 +- test/COFF/armnt-blx23t.test | 2 +- test/COFF/armnt-branch24t.test | 2 +- test/COFF/armnt-imports.test | 2 +- test/COFF/armnt-mov32t-exec.test | 2 +- test/COFF/armnt-movt32t.test | 2 +- test/COFF/base.test | 2 +- test/COFF/baserel.test | 2 +- test/COFF/common.test | 2 +- test/COFF/conflict.test | 2 +- test/COFF/debug.test | 2 +- test/COFF/dllorder.test | 65 - test/COFF/entry-inference.test | 2 +- test/COFF/entry-inference2.test | 4 +- test/COFF/entry-inference32.test | 2 +- test/COFF/entry-mangled.test | 2 +- test/COFF/export32.test | 4 +- test/COFF/force.test | 2 +- test/COFF/icf-circular.test | 2 +- test/COFF/icf-circular2.test | 2 +- test/COFF/icf-different-align.test | 2 +- test/COFF/icf-local.test | 2 +- test/COFF/icf-simple.test | 2 +- test/COFF/imports-mangle.test | 2 +- test/COFF/include.test | 4 +- test/COFF/internal.test | 2 +- test/COFF/invalid-obj.test | 2 +- test/COFF/loadcfg.ll | 2 +- test/COFF/loadcfg.test | 22 +- test/COFF/loadcfg32.test | 20 +- test/COFF/locally-imported.test | 2 +- test/COFF/locally-imported32.test | 2 +- test/COFF/long-section-name.test | 2 +- test/COFF/manifestinput.test | 10 + test/COFF/merge.test | 2 +- test/COFF/opt.test | 2 +- test/COFF/out.test | 6 +- test/COFF/reloc-arm.test | 2 +- test/COFF/reloc-x64.test | 2 +- test/COFF/reloc-x86.test | 2 +- test/COFF/safeseh.test | 2 +- test/COFF/section.test | 62 + test/COFF/seh.test | 2 +- test/COFF/sort-debug.test | 2 +- test/COFF/subsystem-inference.test | 2 +- test/COFF/symtab.test | 2 +- test/COFF/tls.test | 2 +- test/COFF/tls32.test | 4 +- test/COFF/unwind.test | 2 +- test/COFF/weak-external.test | 2 +- test/COFF/weak-external2.test | 2 +- test/COFF/weak-external3.test | 2 +- test/Driver/def-lib-search.test | 8 - test/Driver/flavor-option.test | 8 - test/Driver/lib-search.test | 24 - test/Driver/so-whole-archive.test | 63 - test/Driver/trivial-driver.test | 5 - test/Driver/undef-basic.objtxt | 22 - test/ELF/Inputs/aarch64-copy2.s | 5 + test/ELF/Inputs/aarch64-tls-gdie.s | 4 + test/ELF/Inputs/abs-hidden.s | 3 + test/ELF/Inputs/allow-shlib-undefined.s | 2 +- test/ELF/Inputs/archive.s | 4 +- test/ELF/Inputs/arm-plt-reloc.s | 14 + test/ELF/Inputs/arm-thumb-blx-targets.s | 36 + test/ELF/Inputs/arm-thumb-narrow-branch.s | 18 + test/ELF/Inputs/conflict.s | 7 + test/ELF/Inputs/copy-in-shared.s | 4 + test/ELF/Inputs/copy-rel-corrupted.s | 4 + test/ELF/Inputs/copy-rel-pie.s | 9 + test/ELF/Inputs/ctors_dtors_priority1.s | 5 + test/ELF/Inputs/ctors_dtors_priority2.s | 5 + test/ELF/Inputs/ctors_dtors_priority3.s | 5 + test/ELF/Inputs/duplicated-plt-entry.s | 3 + test/ELF/Inputs/dynamic-reloc-weak.s | 11 + test/ELF/Inputs/ehframe-relocation.s | 2 + test/ELF/Inputs/empty-ver.ver | 2 + test/ELF/Inputs/far-arm-abs.s | 13 + test/ELF/Inputs/far-arm-thumb-abs.s | 24 + test/ELF/Inputs/gc-sections-weak.s | 8 + test/ELF/Inputs/gnu-ifunc-gotpcrel.s | 4 + test/ELF/Inputs/gotpc-relax-und-dso.s | 4 + test/ELF/Inputs/icf2.s | 5 + test/ELF/Inputs/invalid-cie-version2.elf | Bin 0 -> 1128 bytes test/ELF/Inputs/libsearch-dyn.s | 2 +- test/ELF/Inputs/libsearch-st.s | 2 +- test/ELF/Inputs/mips-align-err.s | 2 + test/ELF/Inputs/mips-dynamic.s | 24 + test/ELF/Inputs/mips-gp-disp.so | Bin 131832 -> 131828 bytes test/ELF/Inputs/mips-nonalloc.s | 2 + test/ELF/Inputs/mips-pic.s | 19 + test/ELF/Inputs/mips-tls.s | 5 + test/ELF/Inputs/plt-aarch64.s | 5 + test/ELF/Inputs/ppc64-addr16-error.s | 3 + test/ELF/Inputs/protected-shared.s | 10 + test/ELF/Inputs/relocatable-ehframe.s | 14 + test/ELF/Inputs/relocatable.s | 22 + test/ELF/Inputs/relocatable2.s | 22 + test/ELF/Inputs/relocation-copy-alias.s | 25 + test/ELF/Inputs/relocation-copy-arm.s | 22 + test/ELF/Inputs/resolution-shared.s | 2 + test/ELF/Inputs/shared.s | 4 + test/ELF/Inputs/start-lib-comdat.s | 5 + test/ELF/Inputs/start-lib1.s | 3 + test/ELF/Inputs/start-lib2.s | 2 + test/ELF/Inputs/symbol-override.s | 16 + test/ELF/Inputs/tls-got-entry.s | 13 + test/ELF/Inputs/tls-in-archive.s | 3 + test/ELF/Inputs/trace-ar1.s | 2 + test/ELF/Inputs/trace-ar2.s | 2 + test/ELF/Inputs/trace-symbols-foo-strong.s | 14 + test/ELF/Inputs/trace-symbols-foo-weak.s | 12 + test/ELF/Inputs/undef-with-plt-addr.s | 7 + test/ELF/Inputs/undef.s | 3 + test/ELF/Inputs/unresolved-symbols.s | 3 + test/ELF/Inputs/verdef-defaultver.s | 22 + test/ELF/Inputs/verdef.s | 6 + test/ELF/Inputs/verneed.so.sh | 58 + test/ELF/Inputs/version-script-err.script | 4 + test/ELF/Inputs/version-use.script | 6 + test/ELF/Inputs/visibility.s | 1 + test/ELF/Inputs/warn-common.s | 2 + test/ELF/Inputs/warn-common2.s | 8 + test/ELF/Inputs/whole-archive.s | 2 +- test/ELF/Inputs/x86-64-relax-offset.s | 7 + test/ELF/Inputs/x86-64-reloc-error.s | 7 + test/ELF/Inputs/x86-64-tls-gd-got.s | 6 + test/ELF/aarch64-abs64-dyn.s | 27 + test/ELF/aarch64-copy.s | 38 +- test/ELF/aarch64-copy2.s | 27 + test/ELF/aarch64-fpic-abs16.s | 2 +- test/ELF/aarch64-fpic-add_abs_lo12_nc.s | 2 +- test/ELF/aarch64-fpic-adr_prel_lo21.s | 2 +- test/ELF/aarch64-fpic-adr_prel_pg_hi21.s | 2 +- test/ELF/aarch64-fpic-got.s | 18 + test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s | 2 +- test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s | 2 +- test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s | 2 +- test/ELF/aarch64-fpic-prel16.s | 2 +- test/ELF/aarch64-fpic-prel32.s | 2 +- test/ELF/aarch64-fpic-prel64.s | 2 +- test/ELF/aarch64-gnu-ifunc-nosym.s | 6 +- test/ELF/aarch64-gnu-ifunc.s | 16 +- test/ELF/aarch64-got-relocations.s | 21 + test/ELF/aarch64-got.s | 18 + test/ELF/aarch64-relative.s | 26 + test/ELF/aarch64-relocs.s | 30 + test/ELF/aarch64-tls-gdie.s | 34 + test/ELF/aarch64-tls-gdle.s | 26 + test/ELF/aarch64-tls-ie.s | 3 +- test/ELF/aarch64-tls-iele.s | 33 + test/ELF/aarch64-tls-le.s | 31 + test/ELF/aarch64-tls-pie.s | 28 + test/ELF/aarch64-tls-static.s | 37 + test/ELF/aarch64-tlsdesc.s | 24 + test/ELF/abs-hidden.s | 46 + test/ELF/allow-shlib-undefined.s | 2 +- test/ELF/amdgpu-entry.s | 2 +- test/ELF/amdgpu-globals.s | 20 +- test/ELF/amdgpu-kernels.s | 10 +- test/ELF/amdgpu-relocs.s | 33 + test/ELF/archive.s | 4 + test/ELF/arm-abs32-dyn.s | 32 + test/ELF/arm-attributes-remove.s | 45 + test/ELF/arm-blx.s | 113 + test/ELF/arm-branch-error.s | 19 + test/ELF/arm-branch.s | 59 + test/ELF/arm-copy.s | 81 + test/ELF/arm-data-prel.s | 63 + test/ELF/arm-data-relocs.s | 20 + test/ELF/arm-fpic-got.s | 63 + test/ELF/arm-gnu-ifunc-nosym.s | 27 + test/ELF/arm-gnu-ifunc.s | 131 + test/ELF/arm-got-relative.s | 53 + test/ELF/arm-gotoff.s | 74 + test/ELF/arm-mov-relocs.s | 94 + test/ELF/arm-plt-reloc.s | 90 + test/ELF/arm-thumb-blx.s | 85 + test/ELF/arm-thumb-branch-error.s | 19 + test/ELF/arm-thumb-branch.s | 59 + test/ELF/arm-thumb-interwork-thunk.s | 375 +++ test/ELF/arm-thumb-narrow-branch-check.s | 72 + test/ELF/arm-thumb-plt-reloc.s | 101 + test/ELF/as-needed-no-reloc.s | 23 + test/ELF/as-needed.s | 5 +- test/ELF/avoid-empty-program-headers.s | 78 + test/ELF/basic-aarch64.s | 2 +- test/ELF/basic-mips.s | 99 +- test/ELF/basic-ppc.s | 13 +- test/ELF/basic.s | 22 +- test/ELF/basic32.s | 4 +- test/ELF/basic64be.s | 76 +- test/ELF/bsymbolic-undef.s | 26 + test/ELF/bsymbolic.s | 34 + test/ELF/build-id.s | 38 + test/ELF/combrelocs.s | 92 + test/ELF/comdat.s | 11 + test/ELF/common.s | 3 + test/ELF/compressed-debug-input.s | 61 + test/ELF/conflict.s | 26 + test/ELF/copy-errors.s | 15 + test/ELF/copy-in-shared.s | 10 + test/ELF/copy-rel-corrupted.s | 10 + test/ELF/copy-rel-pie-error.s | 12 + test/ELF/copy-rel-pie.s | 44 + test/ELF/ctors_dtors_priority.s | 41 + test/ELF/default-output.s | 2 +- test/ELF/discard-merge-locals.s | 11 + test/ELF/discard-merge-unnamed.s | 11 + test/ELF/discard-none.s | 2 +- test/ELF/dont-export-hidden.s | 39 + test/ELF/driver.test | 49 + test/ELF/duplicate-internal.s | 2 +- test/ELF/duplicated-plt-entry.s | 17 + test/ELF/dynamic-list.s | 110 + test/ELF/dynamic-reloc-in-ro.s | 8 + test/ELF/dynamic-reloc-weak.s | 14 +- test/ELF/dynamic-reloc.s | 2 +- test/ELF/dynamic.s | 44 + test/ELF/dynsym-pie.s | 36 + test/ELF/edata-etext.s | 117 + test/ELF/eh-frame-dyn-rel.s | 10 + test/ELF/eh-frame-gc.s | 20 + test/ELF/eh-frame-hdr-abs-fde.s | 33 + test/ELF/eh-frame-hdr-augmentation.s | 38 + test/ELF/eh-frame-hdr-icf.s | 27 + test/ELF/eh-frame-hdr-no-out.s | 6 + test/ELF/eh-frame-hdr-no-out2.s | 19 + test/ELF/eh-frame-hdr.s | 127 + test/ELF/eh-frame-marker.s | 6 + test/ELF/eh-frame-merge.s | 2 +- test/ELF/eh-frame-multilpe-cie.s | 12 + test/ELF/eh-frame-type.test | 5 +- test/ELF/ehframe-relocation.s | 8 +- test/ELF/empty-ver.s | 25 + test/ELF/emulation.s | 118 +- test/ELF/end.s | 8 +- test/ELF/entry.s | 4 +- test/ELF/fatal-warnings.s | 16 + test/ELF/file-sym.s | 12 + test/ELF/gc-merge-local-sym.s | 34 + test/ELF/gc-sections-eh.s | 13 + test/ELF/gc-sections-local-sym.s | 57 + test/ELF/gc-sections-lsda.s | 21 + test/ELF/gc-sections-merge-addend.s | 39 + test/ELF/gc-sections-merge-implicit-addend.s | 39 + test/ELF/gc-sections-merge.s | 61 + test/ELF/gc-sections-protected.s | 18 + test/ELF/gc-sections-shared.s | 34 + test/ELF/gc-sections-weak.s | 24 + test/ELF/global_offset_table_shared.s | 9 + test/ELF/gnu-ifunc-gotpcrel.s | 14 + test/ELF/gnu-ifunc-i386.s | 16 +- test/ELF/gnu-ifunc-nosym-i386.s | 6 +- test/ELF/gnu-ifunc-nosym.s | 6 +- test/ELF/gnu-ifunc-relative.s | 23 + test/ELF/gnu-ifunc.s | 18 +- test/ELF/gnu-unique.s | 33 +- test/ELF/got-plt-header.s | 30 + test/ELF/gotpc-relax-nopic.s | 81 + test/ELF/gotpc-relax-und-dso.s | 72 + test/ELF/gotpc-relax.s | 98 + test/ELF/gotpcrelx.s | 30 + test/ELF/i386-got-and-copy.s | 25 + test/ELF/i386-gotpc.s | 20 + test/ELF/i386-merge.s | 50 + test/ELF/i386-relative.s | 14 + test/ELF/i386-relax-reloc.s | 12 + test/ELF/i386-tls-ie-shared.s | 110 + test/ELF/icf1.s | 23 + test/ELF/icf2.s | 17 + test/ELF/icf3.s | 19 + test/ELF/icf4.s | 19 + test/ELF/icf5.s | 19 + test/ELF/icf6.s | 23 + test/ELF/icf7.s | 29 + test/ELF/image-base.s | 60 + test/ELF/incompatible.s | 1 + test/ELF/init-fini.s | 2 +- test/ELF/init_fini_priority.s | 37 + test/ELF/invalid-cie-length.s | 2 +- test/ELF/invalid-cie-length3.s | 2 +- test/ELF/invalid-cie-length4.s | 2 +- test/ELF/invalid-cie-length5.s | 2 +- test/ELF/invalid-cie-reference.s | 2 +- test/ELF/invalid-dynamic-list.test | 37 + test/ELF/invalid-elf.test | 13 +- test/ELF/invalid-linkerscript.test | 54 + test/ELF/invalid-relocations.test | 5 +- test/ELF/libsearch.s | 12 +- test/ELF/linkerscript-align.s | 41 + test/ELF/linkerscript-diagnostic.s | 66 + test/ELF/linkerscript-locationcounter.s | 340 +++ test/ELF/linkerscript-orphans.s | 31 + test/ELF/linkerscript-phdr-check.s | 15 + test/ELF/linkerscript-repsection-va.s | 24 + test/ELF/linkerscript-sections-keep.s | 80 + test/ELF/linkerscript-sections-padding.s | 44 + test/ELF/linkerscript-sections.s | 10 +- test/ELF/linkerscript-symbol-conflict.s | 11 + test/ELF/linkerscript-symbols.s | 11 + test/ELF/linkerscript-va.s | 24 + test/ELF/linkerscript.s | 38 +- test/ELF/linkerscript2.s | 8 +- test/ELF/lit.local.cfg | 2 +- test/ELF/llvm33-rela-outside-group.s | 11 + test/ELF/local-dynamic.s | 11 + test/ELF/local-got-pie.s | 36 + test/ELF/local-undefined-symbol.s | 13 + test/ELF/lto/Inputs/archive-2.ll | 6 + test/ELF/lto/Inputs/archive-3.ll | 5 + test/ELF/lto/Inputs/archive.ll | 6 + test/ELF/lto/Inputs/available-externally.ll | 6 + test/ELF/lto/Inputs/comdat.s | 5 + test/ELF/lto/Inputs/common.s | 1 + test/ELF/lto/Inputs/drop-debug-info.bc | Bin 0 -> 1152 bytes test/ELF/lto/Inputs/drop-linkage.ll | 12 + test/ELF/lto/Inputs/dynsym.s | 3 + test/ELF/lto/Inputs/internalize-exportdyn.ll | 6 + test/ELF/lto/Inputs/internalize-undef.ll | 6 + test/ELF/lto/Inputs/irmover-error.ll | 6 + test/ELF/lto/Inputs/linkonce-odr.ll | 6 + test/ELF/lto/Inputs/linkonce.ll | 6 + test/ELF/lto/Inputs/resolution.s | 4 + test/ELF/lto/Inputs/save-temps.ll | 6 + test/ELF/lto/Inputs/shared.s | 7 + test/ELF/lto/Inputs/start-lib1.ll | 8 + test/ELF/lto/Inputs/start-lib2.ll | 6 + test/ELF/lto/Inputs/tls-mixed.s | 4 + test/ELF/lto/Inputs/type-merge.ll | 8 + test/ELF/lto/Inputs/type-merge2.ll | 8 + test/ELF/lto/Inputs/undef-mixed.s | 3 + test/ELF/lto/Inputs/unnamed-addr-lib.s | 6 + test/ELF/lto/Inputs/visibility.s | 8 + test/ELF/lto/archive-2.ll | 28 + test/ELF/lto/archive-3.ll | 19 + test/ELF/lto/archive.ll | 37 + test/ELF/lto/asmundef.ll | 25 + test/ELF/lto/available-externally.ll | 22 + test/ELF/lto/combined-lto-object-name.ll | 14 + test/ELF/lto/comdat.ll | 21 + test/ELF/lto/comdat2.ll | 40 + test/ELF/lto/common.ll | 31 + test/ELF/lto/common2.ll | 24 + test/ELF/lto/ctors.ll | 18 + test/ELF/lto/discard-value-names.ll | 23 + test/ELF/lto/drop-debug-info.ll | 9 + test/ELF/lto/drop-linkage.ll | 14 + test/ELF/lto/duplicated.ll | 10 + test/ELF/lto/dynamic-list.ll | 25 + test/ELF/lto/dynsym.ll | 25 + test/ELF/lto/inline-asm.ll | 11 + test/ELF/lto/internalize-basic.ll | 21 + test/ELF/lto/internalize-exportdyn.ll | 47 + test/ELF/lto/internalize-llvmused.ll | 20 + test/ELF/lto/internalize-undef.ll | 16 + test/ELF/lto/internalize-version-script.ll | 22 + test/ELF/lto/invalid-bitcode.ll | 12 + test/ELF/lto/irmover-error.ll | 12 + test/ELF/lto/linkage.ll | 20 + test/ELF/lto/linkonce-odr.ll | 17 + test/ELF/lto/linkonce.ll | 17 + test/ELF/lto/lto-start.ll | 23 + test/ELF/lto/ltopasses-basic.ll | 18 + test/ELF/lto/ltopasses-custom.ll | 30 + test/ELF/lto/metadata.ll | 13 + test/ELF/lto/mix-platforms.ll | 10 + test/ELF/lto/module-asm.ll | 19 + test/ELF/lto/opt-level.ll | 29 + test/ELF/lto/parallel-internalize.ll | 57 + test/ELF/lto/parallel.ll | 24 + test/ELF/lto/pic.ll | 20 + test/ELF/lto/relax-relocs.ll | 15 + test/ELF/lto/resolution.ll | 27 + test/ELF/lto/save-temps.ll | 20 + test/ELF/lto/shlib-undefined.ll | 27 + test/ELF/lto/start-lib.ll | 27 + test/ELF/lto/tls-mixed.ll | 10 + test/ELF/lto/tls-preserve.ll | 25 + test/ELF/lto/type-merge.ll | 26 + test/ELF/lto/type-merge2.ll | 27 + test/ELF/lto/undef-mixed.ll | 22 + test/ELF/lto/undef-weak.ll | 29 + test/ELF/lto/undef.ll | 20 + test/ELF/lto/undefined-puts.ll | 28 + test/ELF/lto/unnamed-addr-comdat.ll | 11 + test/ELF/lto/unnamed-addr-lib.ll | 21 + test/ELF/lto/unnamed-addr.ll | 14 + test/ELF/lto/verify-invalid.ll | 17 + test/ELF/lto/version-script.ll | 50 + test/ELF/lto/visibility.ll | 35 + test/ELF/lto/weak.ll | 16 + test/ELF/merge-shared-str.s | 28 + test/ELF/merge-shared.s | 2 +- test/ELF/merge-string-align.s | 25 +- test/ELF/merge-string-error.s | 4 +- test/ELF/merge-string-no-null.s | 2 +- test/ELF/merge-string.s | 26 +- test/ELF/merge.s | 6 +- test/ELF/mips-26.s | 95 + test/ELF/mips-32.s | 78 + test/ELF/mips-64-disp.s | 89 + test/ELF/mips-64-got.s | 87 + test/ELF/mips-64-gprel-so.s | 23 + test/ELF/mips-64-rels.s | 46 + test/ELF/mips-64.s | 63 + test/ELF/mips-align-err.s | 12 + test/ELF/mips-dynamic.s | 19 +- test/ELF/mips-gnu-hash.s | 2 +- test/ELF/mips-got-and-copy.s | 57 + test/ELF/mips-got-extsym.s | 59 + test/ELF/mips-got-redundant.s | 58 + test/ELF/mips-got-relocs.s | 5 +- test/ELF/mips-got-weak.s | 172 ++ test/ELF/mips-got16.s | 120 + test/ELF/mips-gp-disp.s | 9 +- test/ELF/mips-gp-local.s | 20 + test/ELF/mips-gprel32-relocs-gp0.test | 31 + test/ELF/mips-gprel32-relocs.s | 2 +- test/ELF/mips-hilo-gp-disp.s | 21 +- test/ELF/mips-hilo-hi-only.s | 2 +- test/ELF/mips-hilo.s | 10 +- test/ELF/mips-jalr.test | 7 +- test/ELF/mips-lo16-not-relative.s | 23 + test/ELF/mips-nonalloc.s | 21 + test/ELF/mips-npic-call-pic.s | 144 + test/ELF/mips-options-r.test | 19 + test/ELF/mips-options.s | 28 + test/ELF/mips-pc-relocs.s | 15 +- test/ELF/mips-plt-copy.s | 85 + test/ELF/mips-relocs.s | 42 - test/ELF/mips-sto-plt.s | 66 + test/ELF/mips-tls-64.s | 86 + test/ELF/mips-tls-hilo.s | 52 + test/ELF/mips-tls.s | 77 + test/ELF/no-augmentation.s | 19 + test/ELF/no-inhibit-exec.s | 4 +- test/ELF/no-plt-shared.s | 17 + test/ELF/no-undefined.s | 2 +- test/ELF/noplt-pie.s | 21 + test/ELF/note.s | 18 + test/ELF/phdr-align.s | 82 + test/ELF/pie-weak.s | 16 + test/ELF/pie.s | 102 + test/ELF/plt-aarch64.s | 2 +- test/ELF/plt-i686.s | 20 +- test/ELF/plt.s | 2 +- test/ELF/ppc64-addr16-error.s | 5 +- test/ELF/ppc64-relocs.s | 4 +- test/ELF/ppc64-toc-restore.s | 4 +- test/ELF/pre_init_fini_array.s | 24 +- test/ELF/progname.s | 21 +- test/ELF/protected-shared.s | 52 + test/ELF/rel-offset.s | 15 + test/ELF/relative-dynamic-reloc-pie.s | 26 + test/ELF/relative-dynamic-reloc-ppc64.s | 7 +- test/ELF/relative-dynamic-reloc.s | 7 +- test/ELF/relocatable-bss.s | 40 + test/ELF/relocatable-ehframe.s | 51 + test/ELF/relocatable-reloc.s | 14 + test/ELF/relocatable-symbols.s | 183 ++ test/ELF/relocatable.s | 121 +- test/ELF/relocation-copy-alias.s | 67 + test/ELF/relocation-copy-flags.s | 73 + test/ELF/relocation-copy-i686.s | 2 +- test/ELF/relocation-copy.s | 2 +- test/ELF/relocation-i686.s | 24 +- test/ELF/relocation-in-merge.s | 2 +- test/ELF/relocation-non-alloc.s | 60 + test/ELF/relocation-past-merge-end.s | 3 +- test/ELF/relocation-relative-absolute.s | 12 + test/ELF/relocation-relative-synthetic.s | 11 + test/ELF/relocation-relative-weak.s | 14 + test/ELF/relocation-shared.s | 35 + test/ELF/relocation-size-shared.s | 76 +- test/ELF/relocation-size.s | 138 +- test/ELF/relocation.s | 21 +- test/ELF/relro-tls.s | 23 + test/ELF/relro.s | 2 +- test/ELF/reproduce-error.s | 15 + test/ELF/reproduce-linkerscript.s | 17 + test/ELF/reproduce-thin-archive.s | 15 + test/ELF/reproduce-windows.s | 12 + test/ELF/reproduce.s | 67 + test/ELF/resolution-shared.s | 15 + test/ELF/resolution.s | 2 +- test/ELF/section-align-0.test | 3 +- test/ELF/section-name.s | 6 + test/ELF/section-symbol.s | 13 +- test/ELF/shared-be.s | 7 +- test/ELF/shared.s | 19 +- test/ELF/soname.s | 2 +- test/ELF/splitstacks.s | 11 + test/ELF/start-lib-comdat.s | 23 + test/ELF/start-lib.s | 25 + test/ELF/startstop-gccollect.s | 32 + test/ELF/startstop-shared.s | 20 +- test/ELF/startstop.s | 16 +- test/ELF/string-gc.s | 73 + test/ELF/string-table.s | 5 +- test/ELF/strip-all.s | 6 +- test/ELF/strip-debug.s | 25 + test/ELF/symbol-override.s | 46 + test/ELF/symbols.s | 14 +- test/ELF/sysroot.s | 4 +- test/ELF/tail-merge-string-align.s | 35 + test/ELF/tls-archive.s | 10 + test/ELF/tls-dynamic-i686.s | 24 +- test/ELF/tls-dynamic.s | 10 +- test/ELF/tls-got-entry.s | 25 + test/ELF/tls-got.s | 2 +- test/ELF/tls-i686.s | 54 +- test/ELF/tls-in-archive.s | 11 + test/ELF/tls-initial-exec-local.s | 36 + test/ELF/tls-offset.s | 56 + test/ELF/tls-opt-gdie.s | 27 +- test/ELF/tls-opt-iele-i686-nopic.s | 59 - test/ELF/tls-opt-no-plt.s | 34 + test/ELF/tls-opt.s | 74 +- test/ELF/tls-two-relocs.s | 30 + test/ELF/trace-ar.s | 21 + test/ELF/trace-symbols.s | 78 + test/ELF/trace.s | 9 + test/ELF/undef-shared.s | 14 + test/ELF/undef-version-script.s | 40 + test/ELF/undef-with-plt-addr-i686.s | 23 + test/ELF/undef-with-plt-addr.s | 45 + test/ELF/undef.s | 15 +- test/ELF/undefined-opt.s | 13 +- test/ELF/unresolved-symbols.s | 63 + test/ELF/user_def_init_array_start.s | 10 + test/ELF/valid-cie-length-dw64.s | 13 - test/ELF/verdef-defaultver.s | 205 ++ test/ELF/verdef-dependency.s | 44 + test/ELF/verdef.s | 117 + test/ELF/verneed-as-needed-weak.s | 14 + test/ELF/verneed-local.s | 8 + test/ELF/verneed.s | 173 ++ test/ELF/version-script-err.s | 10 + test/ELF/version-script-extern.s | 97 + test/ELF/version-script-noundef.s | 22 + test/ELF/version-script.s | 274 ++ test/ELF/version-undef-sym.s | 42 + test/ELF/version-use.s | 9 + test/ELF/version-wildcard.test | 114 + test/ELF/visibility.s | 31 +- test/ELF/warn-common.s | 25 + test/ELF/weak-undef-hidden.s | 29 + test/ELF/weak-undef-shared.s | 19 + test/ELF/weak-undef.s | 21 + test/ELF/whole-archive.s | 8 +- test/ELF/wildcards.s | 80 + test/ELF/writable-merge.s | 4 +- test/ELF/x86-64-dyn-rel-error.s | 12 + test/ELF/x86-64-dyn-rel-error2.s | 12 + test/ELF/x86-64-rela.s | 11 + test/ELF/x86-64-relax-offset.s | 13 + test/ELF/x86-64-reloc-32-error.s | 8 - test/ELF/x86-64-reloc-32-fpic.s | 7 + test/ELF/x86-64-reloc-32S-error.s | 7 - test/ELF/x86-64-reloc-error.s | 10 + test/ELF/x86-64-reloc-pc32-fpic.s | 7 + test/ELF/x86-64-reloc-range.s | 13 + test/ELF/x86-64-tls-gd-got.s | 19 + test/ELF/x86-64-tls-gd-local.s | 52 + test/ELF/x86-64-tls-pie.s | 26 + test/ELF/zdefs.s | 7 + test/LinkerScript/expr-precedence.test | 34 - test/LinkerScript/extern-bad-symbol.test | 22 - test/LinkerScript/extern-empty.test | 19 - test/LinkerScript/extern-valid.test | 29 - test/LinkerScript/incomplete-ternary.test | 25 - test/LinkerScript/libname-err-1.test | 11 - test/LinkerScript/libname-err-2.test | 11 - test/LinkerScript/linker-script-outputformat.test | 12 - test/LinkerScript/linker-script.test | 46 - test/LinkerScript/memory-empty.test | 17 - test/LinkerScript/memory-missing-attrs.test | 32 - test/LinkerScript/memory-missing-length.test | 29 - test/LinkerScript/memory-missing-name.test | 31 - test/LinkerScript/memory-missing-origin.test | 30 - test/LinkerScript/memory-valid.test | 56 - test/LinkerScript/missing-entry-symbol.test | 21 - test/LinkerScript/missing-input-file-name.test | 25 - test/LinkerScript/missing-input-sections.test | 27 - test/LinkerScript/missing-operand.test | 24 - test/LinkerScript/missing-output-section-name.test | 25 - test/LinkerScript/missing-symbol.test | 24 - test/LinkerScript/phdrs-sections.test | 29 - test/LinkerScript/sections.test | 624 ----- test/Unit/lit.site.cfg.in | 4 +- test/core/Inputs/archive-basic.objtxt | 21 - test/core/Inputs/archive-chain.objtxt | 24 - test/core/Inputs/archive-chain2.objtxt | 21 - test/core/Inputs/archive-tentdef-search.objtxt | 11 - test/core/Inputs/associates.objtxt | 8 - test/core/Inputs/auto-hide-coalesce.objtxt | 20 - test/core/Inputs/code-model-attributes.objtxt | 4 - test/core/Inputs/code-model-attributes2.objtxt | 4 - test/core/Inputs/code-model-attributes3.objtxt | 4 - test/core/Inputs/code-model-attributes4.objtxt | 4 - test/core/Inputs/code-model-attributes5.objtxt | 4 - test/core/Inputs/constants-coalesce.objtxt | 9 - test/core/Inputs/constants-coalesce2.objtxt | 10 - test/core/Inputs/cstring-coalesce.objtxt | 6 - test/core/Inputs/cstring-coalesce2.objtxt | 6 - test/core/Inputs/custom-section-coalesce.objtxt | 15 - test/core/Inputs/custom-section-coalesce2.objtxt | 13 - test/core/Inputs/dead-strip-attributes.objtxt | 4 - test/core/Inputs/dead-strip-attributes2.objtxt | 4 - test/core/Inputs/dead-strip-basic.objtxt | 9 - test/core/Inputs/dead-strip-basic2.objtxt | 8 - test/core/Inputs/dead-strip-globals.objtxt | 9 - test/core/Inputs/dead-strip-globals2.objtxt | 8 - test/core/Inputs/error-duplicate-absolutes.objtxt | 5 - .../Inputs/gnulinkonce-rearrange-resolve.objtxt | 26 - .../core/Inputs/gnulinkonce-remaining-undef.objtxt | 34 - .../Inputs/gnulinkonce-remaining-undef2.objtxt | 4 - test/core/Inputs/gnulinkonce-resolve.objtxt | 25 - test/core/Inputs/gnulinkonce-simple.objtxt | 4 - test/core/Inputs/inline-coalesce.objtxt | 6 - test/core/Inputs/inline-coalesce2.objtxt | 6 - test/core/Inputs/multiple-def-error.objtxt | 5 - test/core/Inputs/sectiongroup-deadstrip.objtxt | 3 - .../Inputs/sectiongroup-gnulinkonce-error.objtxt | 26 - .../Inputs/sectiongroup-rearrange-resolve.objtxt | 25 - .../Inputs/sectiongroup-remaining-undef.objtxt | 34 - .../Inputs/sectiongroup-remaining-undef2.objtxt | 4 - test/core/Inputs/sectiongroup-resolve.objtxt | 26 - test/core/Inputs/sectiongroup-simple.objtxt | 4 - test/core/Inputs/shared-library-coalesce.objtxt | 28 - test/core/Inputs/tent-merge.objtxt | 6 - test/core/Inputs/undef-coalesce-error.objtxt | 8 - test/core/Inputs/undef-coalesce-error2.objtxt | 8 - test/core/Inputs/undef-coalesce.objtxt | 8 - test/core/Inputs/undef-coalesce2.objtxt | 8 - test/core/Inputs/undef-fallback.objtxt | 7 - test/core/Inputs/undef-weak-coalesce.objtxt | 20 - test/core/Inputs/weak-coalesce.objtxt | 5 - test/core/Inputs/weak-coalesce2.objtxt | 6 - test/core/absolute-basic.objtxt | 23 - test/core/absolute-local.objtxt | 25 - test/core/archive-basic.objtxt | 23 - test/core/archive-chain.objtxt | 23 - test/core/archive-tentdef-search.objtxt | 30 - test/core/associates.objtxt | 21 - test/core/auto-hide-coalesce.objtxt | 39 - test/core/code-model-attributes.objtxt | 33 - test/core/constants-coalesce.objtxt | 42 - test/core/cstring-coalesce.objtxt | 29 - test/core/custom-section-coalesce.objtxt | 50 - test/core/custom-section.objtxt | 34 - test/core/dead-strip-attributes.objtxt | 22 - test/core/dead-strip-basic.objtxt | 45 - test/core/dead-strip-globals.objtxt | 43 - test/core/dead-strip-reverse.objtxt | 25 - test/core/error-atom-attribute.objtxt | 19 - test/core/error-atom-content-byte-value.objtxt | 18 - test/core/error-atom-content-bytes.objtxt | 19 - test/core/error-atom-type.objtxt | 19 - .../error-atom-undefined-wrong-attribue.objtxt | 17 - test/core/error-duplicate-absolutes.objtxt | 19 - test/core/error-file-attribute.objtxt | 17 - test/core/error-fixup-attribute.objtxt | 21 - test/core/error-fixup-target.objtxt | 26 - test/core/fixups-addend.objtxt | 50 - test/core/fixups-dup-named.objtxt | 31 - test/core/fixups-named.objtxt | 36 - test/core/fixups-unnamed.objtxt | 40 - test/core/gnulinkonce-rearrange-resolve.objtxt | 53 - test/core/gnulinkonce-remaining-undef.objtxt | 43 - test/core/gnulinkonce-resolve.objtxt | 63 - test/core/gnulinkonce-simple.objtxt | 76 - test/core/inline-coalesce.objtxt | 19 - test/core/multiple-def-error.objtxt | 14 - test/core/permissions.objtxt | 57 - test/core/sectiongroup-deadstrip.objtxt | 84 - test/core/sectiongroup-gnulinkonce-error.objtxt | 38 - test/core/sectiongroup-rearrange-resolve.objtxt | 53 - test/core/sectiongroup-remaining-undef.objtxt | 42 - test/core/sectiongroup-resolve.objtxt | 64 - test/core/sectiongroup-simple.objtxt | 76 - test/core/shared-library-basic.objtxt | 40 - test/core/shared-library-coalesce.objtxt | 55 - test/core/tent-merge.objtxt | 19 - test/core/undef-coalesce-error.objtxt | 31 - test/core/undef-coalesce.objtxt | 26 - test/core/undef-fallback.objtxt | 29 - test/core/undef-weak-coalesce.objtxt | 52 - test/core/weak-coalesce.objtxt | 16 - test/darwin/cmdline-objc_gc.objtxt | 15 + test/darwin/cmdline-objc_gc_compaction.objtxt | 15 + test/darwin/cmdline-objc_gc_only.objtxt | 15 + test/lit.cfg | 13 +- test/lit.site.cfg.in | 5 +- .../Inputs/no-version-min-load-command-object.yaml | 22 + test/mach-o/Inputs/swift-version-1.yaml | 18 + test/mach-o/arm-interworking-movw.yaml | 6 +- .../mach-o/arm64-relocs-errors-delta64-offset.yaml | 2 +- test/mach-o/data-in-code-load-command.yaml | 35 + test/mach-o/dead-strip-globals.yaml | 27 + test/mach-o/dependency_info.yaml | 13 +- test/mach-o/do-not-emit-unwind-fde-arm64.yaml | 8 +- test/mach-o/dso_handle.yaml | 2 +- test/mach-o/eh-frame-relocs-arm64.yaml | 318 +++ test/mach-o/error-simulator-vs-macosx.yaml | 30 + test/mach-o/function-starts-load-command.yaml | 32 + test/mach-o/hello-world-x86_64.yaml | 5 +- test/mach-o/interposing-section.yaml | 2 +- test/mach-o/lazy-bind-x86_64.yaml | 11 + test/mach-o/mach_header-cpusubtype.yaml | 34 + test/mach-o/mh_bundle_header.yaml | 9 +- test/mach-o/mh_dylib_header.yaml | 2 +- test/mach-o/objc-category-list-atom.yaml | 70 + test/mach-o/objc-image-info-host-vs-simulator.yaml | 23 + test/mach-o/objc-image-info-invalid-size.yaml | 20 + test/mach-o/objc-image-info-invalid-version.yaml | 20 + .../objc-image-info-mismatched-swift-version.yaml | 20 + test/mach-o/objc-image-info-pass-output.yaml | 30 + test/mach-o/objc-image-info-simulator-vs-host.yaml | 23 + test/mach-o/objc-image-info-unsupported-gc.yaml | 20 + test/mach-o/objc_export_list.yaml | 2 +- test/mach-o/parse-cfstring32.yaml | 2 +- test/mach-o/parse-compact-unwind64.yaml | 2 +- test/mach-o/parse-data-relocs-x86_64.yaml | 126 +- test/mach-o/parse-data.yaml | 4 +- test/mach-o/parse-eh-frame.yaml | 2 +- test/mach-o/sdk-version-error.yaml | 22 + test/mach-o/sectattrs.yaml | 30 + test/mach-o/seg-protection-arm64.yaml | 78 + test/mach-o/seg-protection-x86_64.yaml | 78 + test/mach-o/source-version.yaml | 28 + test/mach-o/subsections-via-symbols-default.yaml | 28 + test/mach-o/unwind-info-simple-arm64.yaml | 2 +- test/mach-o/unwind-info-simple-x86_64.yaml | 4 - test/mach-o/version-min-load-command-object.yaml | 35 + test/mach-o/version-min-load-command.yaml | 43 + test/old-elf/AArch64/Inputs/fn.c | 4 - test/old-elf/AArch64/Inputs/fn.o | Bin 899 -> 0 bytes test/old-elf/AArch64/Inputs/general-dyn-tls-0.yaml | 64 - test/old-elf/AArch64/Inputs/initfini-option.c | 12 - test/old-elf/AArch64/Inputs/initfini-option.o | Bin 1552 -> 0 bytes test/old-elf/AArch64/Inputs/initfini.c | 13 - test/old-elf/AArch64/Inputs/initfini.o | Bin 2056 -> 0 bytes .../old-elf/AArch64/Inputs/initial-exec-tls-1.yaml | 77 - test/old-elf/AArch64/Inputs/main.c | 4 - test/old-elf/AArch64/Inputs/main.o | Bin 1064 -> 0 bytes test/old-elf/AArch64/Inputs/no-interp-section.c | 1 - test/old-elf/AArch64/Inputs/no-interp-section.o | Bin 903 -> 0 bytes test/old-elf/AArch64/Inputs/zerosizedsection.o | Bin 816 -> 0 bytes test/old-elf/AArch64/Inputs/zerosizedsection.s | 3 - test/old-elf/AArch64/defsym.test | 22 - .../AArch64/dontignorezerosize-sections.test | 9 - test/old-elf/AArch64/dynamicvars.test | 113 - test/old-elf/AArch64/dynlib-nointerp-section.test | 5 - test/old-elf/AArch64/general-dyn-tls-0.test | 103 - test/old-elf/AArch64/initfini.test | 23 - test/old-elf/AArch64/initial-exec-tls-0.test | 146 - test/old-elf/AArch64/local-tls.test | 184 -- test/old-elf/AArch64/rel-abs16-overflow.test | 44 - test/old-elf/AArch64/rel-abs16.test | 53 - test/old-elf/AArch64/rel-abs32-overflow.test | 53 - test/old-elf/AArch64/rel-abs32.test | 59 - test/old-elf/AArch64/rel-abs64.test | 59 - .../AArch64/rel-adr_prel_lo21-overflow.test | 45 - test/old-elf/AArch64/rel-adr_prel_lo21.test | 51 - .../AArch64/rel-adr_prel_pg_hi21-overflow.test | 45 - test/old-elf/AArch64/rel-adr_prel_pg_hi21.test | 52 - test/old-elf/AArch64/rel-bad.test | 44 - test/old-elf/AArch64/rel-prel16-overflow.test | 53 - test/old-elf/AArch64/rel-prel16.test | 59 - test/old-elf/AArch64/rel-prel32-overflow.test | 53 - test/old-elf/AArch64/rel-prel32.test | 59 - test/old-elf/AArch64/rel-prel64.test | 59 - test/old-elf/ARM/Inputs/fn.c | 1 - test/old-elf/ARM/Inputs/libfn.so | Bin 4972 -> 0 bytes test/old-elf/ARM/Inputs/libobj.so | Bin 5067 -> 0 bytes test/old-elf/ARM/Inputs/obj.c | 4 - test/old-elf/ARM/arm-symbols.test | 51 - test/old-elf/ARM/defsym.test | 50 - test/old-elf/ARM/dynamic-symbols.test | 83 - test/old-elf/ARM/entry-point.test | 113 - test/old-elf/ARM/exidx.test | 254 -- test/old-elf/ARM/header-flags.test | 57 - test/old-elf/ARM/mapping-code-model.test | 160 -- test/old-elf/ARM/mapping-symbols.test | 122 - test/old-elf/ARM/missing-symbol.test | 38 - test/old-elf/ARM/plt-dynamic.test | 200 -- test/old-elf/ARM/plt-ifunc-interwork.test | 396 --- test/old-elf/ARM/plt-ifunc-mapping.test | 109 - test/old-elf/ARM/rel-abs32.test | 58 - test/old-elf/ARM/rel-arm-call.test | 112 - test/old-elf/ARM/rel-arm-jump24-veneer-b.test | 122 - test/old-elf/ARM/rel-arm-jump24-veneer-bl.test | 120 - test/old-elf/ARM/rel-arm-jump24.test | 108 - test/old-elf/ARM/rel-arm-mov.test | 64 - test/old-elf/ARM/rel-arm-prel31.test | 90 - test/old-elf/ARM/rel-arm-target1.test | 114 - test/old-elf/ARM/rel-arm-thm-interwork.test | 121 - test/old-elf/ARM/rel-base-prel.test | 61 - test/old-elf/ARM/rel-copy.test | 60 - test/old-elf/ARM/rel-glob-dat.test | 57 - test/old-elf/ARM/rel-got-brel.test | 63 - test/old-elf/ARM/rel-group-relocs.test | 71 - test/old-elf/ARM/rel-ifunc.test | 101 - test/old-elf/ARM/rel-jump-slot.test | 50 - test/old-elf/ARM/rel-rel32.test | 56 - test/old-elf/ARM/rel-thm-call.test | 114 - test/old-elf/ARM/rel-thm-jump11.test | 209 -- test/old-elf/ARM/rel-thm-jump24-veneer.test | 120 - test/old-elf/ARM/rel-thm-jump24.test | 110 - test/old-elf/ARM/rel-thm-mov.test | 70 - test/old-elf/ARM/rel-tls-ie32.test | 125 - test/old-elf/ARM/rel-tls-le32.test | 73 - test/old-elf/ARM/rel-v4bx.test | 72 - test/old-elf/ARM/thm-symbols.test | 51 - test/old-elf/ARM/two-got-for-symbol.test | 62 - test/old-elf/ARM/undef-lazy-symbol.test | 133 - test/old-elf/ARM/veneer-mapping.test | 92 - test/old-elf/ARM/weak-branch.test | 221 -- test/old-elf/Hexagon/Inputs/dynobj-data.c | 3 - test/old-elf/Hexagon/Inputs/dynobj-data.o | Bin 916 -> 0 bytes test/old-elf/Hexagon/Inputs/dynobj.c | 26 - test/old-elf/Hexagon/Inputs/dynobj.o | Bin 1288 -> 0 bytes test/old-elf/Hexagon/Inputs/got-plt-order.c | 6 - test/old-elf/Hexagon/Inputs/got-plt-order.o | Bin 964 -> 0 bytes test/old-elf/Hexagon/Inputs/libMaxAlignment.a | Bin 1010 -> 0 bytes test/old-elf/Hexagon/Inputs/sda-base.o | Bin 1469 -> 0 bytes test/old-elf/Hexagon/Inputs/sdata1.c | 3 - test/old-elf/Hexagon/Inputs/sdata1.o | Bin 684 -> 0 bytes test/old-elf/Hexagon/Inputs/sdata2.c | 6 - test/old-elf/Hexagon/Inputs/sdata2.o | Bin 829 -> 0 bytes test/old-elf/Hexagon/Inputs/use-shared.hexagon | Bin 872 -> 0 bytes test/old-elf/Hexagon/dynlib-data.test | 9 - test/old-elf/Hexagon/dynlib-gotoff.test | 128 - test/old-elf/Hexagon/dynlib-hash.test | 9 - test/old-elf/Hexagon/dynlib-rela.test | 9 - test/old-elf/Hexagon/dynlib-syms.test | 7 - test/old-elf/Hexagon/dynlib.test | 36 - test/old-elf/Hexagon/hexagon-got-plt-order.test | 5 - test/old-elf/Hexagon/hexagon-plt-setup.test | 12 - test/old-elf/Hexagon/maxalignment.test | 8 - test/old-elf/Hexagon/rela-order.test | 9 - test/old-elf/Hexagon/sda-base.test | 4 - test/old-elf/Hexagon/zerofillquick-sdata.test | 18 - test/old-elf/Inputs/abs-test.i386 | Bin 504 -> 0 bytes test/old-elf/Inputs/allowduplicates.objtxt | 12 - test/old-elf/Inputs/bar.o.x86-64 | Bin 1240 -> 0 bytes test/old-elf/Inputs/branch-test.hexagon | Bin 700 -> 0 bytes test/old-elf/Inputs/branch-test.ppc | Bin 852 -> 0 bytes test/old-elf/Inputs/consecutive-weak-defs.o.yaml | 65 - test/old-elf/Inputs/constants-merge.x86-64 | Bin 1232 -> 0 bytes test/old-elf/Inputs/constdata.x86-64 | Bin 1688 -> 0 bytes test/old-elf/Inputs/foo.o.x86-64 | Bin 1240 -> 0 bytes test/old-elf/Inputs/globalconst.c | 2 - test/old-elf/Inputs/globalconst.o.x86-64 | Bin 1072 -> 0 bytes test/old-elf/Inputs/gotpcrel.S | 11 - test/old-elf/Inputs/gotpcrel.x86-64 | Bin 904 -> 0 bytes test/old-elf/Inputs/group-cmd-search-1.ls | 1 - test/old-elf/Inputs/group-cmd-search-2.ls | 1 - test/old-elf/Inputs/group-cmd-search-3.ls | 1 - test/old-elf/Inputs/ifunc.S | 21 - test/old-elf/Inputs/ifunc.cpp | 3 - test/old-elf/Inputs/ifunc.cpp.x86-64 | Bin 1224 -> 0 bytes test/old-elf/Inputs/ifunc.x86-64 | Bin 912 -> 0 bytes test/old-elf/Inputs/libfnarchive.a | Bin 2656 -> 0 bytes test/old-elf/Inputs/libifunc.x86-64.so | Bin 2512 -> 0 bytes test/old-elf/Inputs/libundef.so | Bin 11128 -> 0 bytes test/old-elf/Inputs/libweaksym.so | Bin 2160 -> 0 bytes test/old-elf/Inputs/main-with-global-def.o.yaml | 55 - test/old-elf/Inputs/mainobj.x86_64 | Bin 1360 -> 0 bytes test/old-elf/Inputs/no-unique-section-names.x86-64 | Bin 2128 -> 0 bytes test/old-elf/Inputs/object-test.elf-hexagon | Bin 1532 -> 0 bytes test/old-elf/Inputs/object-test.elf-i386 | Bin 1784 -> 0 bytes test/old-elf/Inputs/phdr.i386 | Bin 17536 -> 0 bytes .../Inputs/quickdata-sort-test.o.elf-hexagon | Bin 1385 -> 0 bytes .../Inputs/quickdata-sortcommon-test.o.elf-hexagon | Bin 1469 -> 0 bytes test/old-elf/Inputs/quickdata-test.elf-hexagon | Bin 891 -> 0 bytes test/old-elf/Inputs/reloc-test.elf-i386 | Bin 1076 -> 0 bytes test/old-elf/Inputs/reloc-xb.x86 | Bin 568 -> 0 bytes test/old-elf/Inputs/reloc-xt.x86 | Bin 548 -> 0 bytes test/old-elf/Inputs/relocs-dynamic.x86-64 | Bin 864 -> 0 bytes test/old-elf/Inputs/relocs.x86-64 | Bin 1536 -> 0 bytes test/old-elf/Inputs/responsefile | 1 - test/old-elf/Inputs/rodata-test.hexagon | Bin 669 -> 0 bytes test/old-elf/Inputs/rodata-test.i386 | Bin 537 -> 0 bytes test/old-elf/Inputs/rodata.c | 4 - test/old-elf/Inputs/rodata.o | Bin 1568 -> 0 bytes test/old-elf/Inputs/section-test.i386 | Bin 717 -> 0 bytes test/old-elf/Inputs/shared.c | 16 - test/old-elf/Inputs/shared.so-x86-64 | Bin 7536 -> 0 bytes test/old-elf/Inputs/shndx.o-x86_64 | Bin 624 -> 0 bytes test/old-elf/Inputs/stripped-empty.x86_64 | Bin 416 -> 0 bytes test/old-elf/Inputs/target-test.hexagon | Bin 676 -> 0 bytes test/old-elf/Inputs/target-test.ppc | Bin 552 -> 0 bytes test/old-elf/Inputs/tls-tbss-size.yaml | 59 - test/old-elf/Inputs/tls.S | 50 - test/old-elf/Inputs/tls.c | 11 - test/old-elf/Inputs/tls.x86-64 | Bin 1424 -> 0 bytes test/old-elf/Inputs/tlsAddr.x86-64 | Bin 1752 -> 0 bytes test/old-elf/Inputs/tlsaddr.c | 8 - test/old-elf/Inputs/undef-from-main-so.c | 1 - test/old-elf/Inputs/undef-from-main.c | 5 - test/old-elf/Inputs/undef-pc32.o | Bin 1248 -> 0 bytes test/old-elf/Inputs/undef.o | Bin 1264 -> 0 bytes test/old-elf/Inputs/undef2-so.o.yaml | 49 - test/old-elf/Inputs/use-shared-32s.c | 8 - test/old-elf/Inputs/use-shared-32s.x86-64 | Bin 1336 -> 0 bytes test/old-elf/Inputs/use-shared.c | 7 - test/old-elf/Inputs/use-shared.x86-64 | Bin 1376 -> 0 bytes test/old-elf/Inputs/weaksym.o | Bin 840 -> 0 bytes test/old-elf/Inputs/writersyms.o | Bin 868 -> 0 bytes test/old-elf/Inputs/x86-64-relocs.S | 12 - test/old-elf/Mips/abi-flags-01.test | 35 - test/old-elf/Mips/abi-flags-02.test | 92 - test/old-elf/Mips/abi-flags-03.test | 149 - test/old-elf/Mips/abi-flags-04.test | 125 - test/old-elf/Mips/abi-flags-05.test | 186 -- test/old-elf/Mips/abi-flags-06.test | 79 - test/old-elf/Mips/abi-flags-07.test | 60 - test/old-elf/Mips/abi-flags-08.test | 71 - test/old-elf/Mips/abi-flags-09.test | 67 - test/old-elf/Mips/abi-flags-10.test | 60 - test/old-elf/Mips/abi-flags-11.test | 59 - test/old-elf/Mips/base-address-64.test | 80 - test/old-elf/Mips/base-address.test | 95 - test/old-elf/Mips/ctors-order.test | 164 -- test/old-elf/Mips/driver-hash-style.test | 15 - test/old-elf/Mips/dt-textrel-64.test | 74 - test/old-elf/Mips/dt-textrel.test | 74 - test/old-elf/Mips/dynamic-linking.test | 22 - test/old-elf/Mips/dynamic-sym.test | 41 - test/old-elf/Mips/dynlib-dynamic.test | 110 - test/old-elf/Mips/dynlib-dynsym-micro.test | 208 -- test/old-elf/Mips/dynlib-dynsym.test | 202 -- test/old-elf/Mips/dynlib-fileheader-64.test | 72 - test/old-elf/Mips/dynlib-fileheader-micro-64.test | 75 - test/old-elf/Mips/dynlib-fileheader-micro.test | 79 - test/old-elf/Mips/dynlib-fileheader.test | 76 - test/old-elf/Mips/dynsym-table-1.test | 127 - test/old-elf/Mips/dynsym-table-2.test | 105 - test/old-elf/Mips/e-flags-merge-1-64.test | 30 - test/old-elf/Mips/e-flags-merge-1.test | 56 - test/old-elf/Mips/e-flags-merge-10.test | 43 - test/old-elf/Mips/e-flags-merge-11.test | 43 - test/old-elf/Mips/e-flags-merge-12.test | 44 - test/old-elf/Mips/e-flags-merge-2-64.test | 33 - test/old-elf/Mips/e-flags-merge-2.test | 35 - test/old-elf/Mips/e-flags-merge-3-64.test | 130 - test/old-elf/Mips/e-flags-merge-3.test | 134 - test/old-elf/Mips/e-flags-merge-4-64.test | 64 - test/old-elf/Mips/e-flags-merge-4.test | 65 - test/old-elf/Mips/e-flags-merge-5-64.test | 42 - test/old-elf/Mips/e-flags-merge-5.test | 42 - test/old-elf/Mips/e-flags-merge-6-64.test | 79 - test/old-elf/Mips/e-flags-merge-6.test | 80 - test/old-elf/Mips/e-flags-merge-7-64.test | 42 - test/old-elf/Mips/e-flags-merge-7.test | 42 - test/old-elf/Mips/e-flags-merge-8.test | 65 - test/old-elf/Mips/e-flags-merge-9.test | 43 - test/old-elf/Mips/entry-name.test | 26 - test/old-elf/Mips/exe-dynamic.test | 110 - test/old-elf/Mips/exe-dynsym-micro.test | 94 - test/old-elf/Mips/exe-dynsym.test | 91 - test/old-elf/Mips/exe-fileheader-02.test | 62 - test/old-elf/Mips/exe-fileheader-03.test | 72 - test/old-elf/Mips/exe-fileheader-64.test | 66 - test/old-elf/Mips/exe-fileheader-be-64.test | 60 - test/old-elf/Mips/exe-fileheader-be.test | 60 - test/old-elf/Mips/exe-fileheader-micro-64.test | 68 - test/old-elf/Mips/exe-fileheader-micro.test | 69 - test/old-elf/Mips/exe-fileheader-n32.test | 65 - test/old-elf/Mips/exe-fileheader.test | 105 - test/old-elf/Mips/exe-got-micro.test | 115 - test/old-elf/Mips/exe-got.test | 116 - test/old-elf/Mips/got-page-32-micro.test | 251 -- test/old-elf/Mips/got-page-32.test | 244 -- test/old-elf/Mips/got-page-64-micro.test | 210 -- test/old-elf/Mips/got-page-64.test | 203 -- test/old-elf/Mips/got16-2.test | 73 - test/old-elf/Mips/got16-micro.test | 165 -- test/old-elf/Mips/got16.test | 196 -- test/old-elf/Mips/gotsym.test | 43 - test/old-elf/Mips/gp-sym-1-micro.test | 88 - test/old-elf/Mips/gp-sym-1.test | 86 - test/old-elf/Mips/gp-sym-2.test | 103 - test/old-elf/Mips/hilo16-1.test | 40 - test/old-elf/Mips/hilo16-2.test | 70 - test/old-elf/Mips/hilo16-3-overflow.test | 44 - test/old-elf/Mips/hilo16-3.test | 74 - test/old-elf/Mips/hilo16-4.test | 93 - test/old-elf/Mips/hilo16-5.test | 103 - test/old-elf/Mips/hilo16-8-micro.test | 81 - test/old-elf/Mips/hilo16-9-micro.test | 142 - test/old-elf/Mips/initfini-micro.test | 45 - test/old-elf/Mips/interpreter-64.test | 26 - test/old-elf/Mips/interpreter-n32.test | 27 - test/old-elf/Mips/interpreter.test | 26 - test/old-elf/Mips/invalid-reginfo.test | 28 - test/old-elf/Mips/jalx-align-err.test | 46 - test/old-elf/Mips/jalx-jalr.test | 47 - test/old-elf/Mips/jalx.test | 71 - test/old-elf/Mips/jump-fix-err.test | 45 - test/old-elf/Mips/la25-stub-be.test | 113 - test/old-elf/Mips/la25-stub-micro-be.test | 121 - test/old-elf/Mips/la25-stub-micro.test | 136 - test/old-elf/Mips/la25-stub-npic-01.test | 153 -- test/old-elf/Mips/la25-stub-npic-02.test | 123 - test/old-elf/Mips/la25-stub-npic-shared.test | 152 - test/old-elf/Mips/la25-stub-pic.test | 144 - test/old-elf/Mips/la25-stub.test | 133 - test/old-elf/Mips/mips-options-01.test | 34 - test/old-elf/Mips/mips-options-02.test | 104 - test/old-elf/Mips/mips-options-03.test | 41 - test/old-elf/Mips/mips-options-04.test | 77 - test/old-elf/Mips/mips-options-05.test | 119 - test/old-elf/Mips/mips-options-gp0.test | 77 - test/old-elf/Mips/n32-rela-chain.test | 68 - test/old-elf/Mips/n64-rel-chain.test | 204 -- test/old-elf/Mips/n64-rel-shift.test | 48 - test/old-elf/Mips/opt-emulation.test | 43 - test/old-elf/Mips/pc23-range.test | 54 - test/old-elf/Mips/plt-entry-mixed-1.test | 114 - test/old-elf/Mips/plt-entry-mixed-2.test | 93 - test/old-elf/Mips/plt-entry-mixed-3.test | 98 - test/old-elf/Mips/plt-entry-mixed-4.test | 85 - test/old-elf/Mips/plt-entry-r6-be.test | 109 - test/old-elf/Mips/plt-entry-r6.test | 109 - test/old-elf/Mips/plt-header-be.test | 104 - test/old-elf/Mips/plt-header-micro-be.test | 105 - test/old-elf/Mips/plt-header-micro.test | 108 - test/old-elf/Mips/plt-header-mixed.test | 105 - test/old-elf/Mips/plt-header.test | 99 - test/old-elf/Mips/r26-1-micro.test | 131 - test/old-elf/Mips/r26-1.test | 132 - test/old-elf/Mips/r26-2-micro.test | 31 - test/old-elf/Mips/r26-2.test | 31 - test/old-elf/Mips/reginfo-01.test | 30 - test/old-elf/Mips/reginfo-02.test | 107 - test/old-elf/Mips/reginfo-03.test | 45 - test/old-elf/Mips/reginfo-04.test | 81 - test/old-elf/Mips/reginfo-05.test | 123 - test/old-elf/Mips/rel-16-overflow.test | 45 - test/old-elf/Mips/rel-16.test | 51 - test/old-elf/Mips/rel-32-be.test | 60 - test/old-elf/Mips/rel-32.test | 59 - test/old-elf/Mips/rel-64.test | 61 - test/old-elf/Mips/rel-call-hilo-01.test | 109 - test/old-elf/Mips/rel-call-hilo-micro.test | 154 -- test/old-elf/Mips/rel-copy-micro.test | 159 -- test/old-elf/Mips/rel-copy-pc.test | 113 - test/old-elf/Mips/rel-copy.test | 177 -- test/old-elf/Mips/rel-dynamic-01-micro.test | 201 -- test/old-elf/Mips/rel-dynamic-01.test | 261 -- test/old-elf/Mips/rel-dynamic-02.test | 101 - test/old-elf/Mips/rel-dynamic-03-micro.test | 133 - test/old-elf/Mips/rel-dynamic-03.test | 129 - test/old-elf/Mips/rel-dynamic-04-micro.test | 226 -- test/old-elf/Mips/rel-dynamic-04.test | 221 -- test/old-elf/Mips/rel-dynamic-05-micro.test | 192 -- test/old-elf/Mips/rel-dynamic-05.test | 188 -- test/old-elf/Mips/rel-dynamic-06-64.test | 114 - test/old-elf/Mips/rel-dynamic-06.test | 115 - test/old-elf/Mips/rel-dynamic-07-64.test | 348 --- test/old-elf/Mips/rel-dynamic-07.test | 363 --- test/old-elf/Mips/rel-dynamic-08-64.test | 275 -- test/old-elf/Mips/rel-dynamic-08-micro.test | 278 -- test/old-elf/Mips/rel-dynamic-08.test | 275 -- test/old-elf/Mips/rel-dynamic-09-micro.test | 109 - test/old-elf/Mips/rel-dynamic-09.test | 107 - test/old-elf/Mips/rel-dynamic-10-micro.test | 166 -- test/old-elf/Mips/rel-dynamic-10.test | 160 -- test/old-elf/Mips/rel-dynamic-11.test | 110 - test/old-elf/Mips/rel-dynamic-12.test | 237 -- test/old-elf/Mips/rel-dynamic-13.test | 94 - test/old-elf/Mips/rel-dynamic-14.test | 94 - test/old-elf/Mips/rel-dynamic-15.test | 81 - test/old-elf/Mips/rel-eh-01.test | 186 -- test/old-elf/Mips/rel-eh-02.test | 130 - test/old-elf/Mips/rel-eh-03.test | 128 - test/old-elf/Mips/rel-got-hilo-01.test | 109 - test/old-elf/Mips/rel-got-hilo-micro.test | 154 -- test/old-elf/Mips/rel-gprel16-micro-overflow.test | 57 - test/old-elf/Mips/rel-gprel16-micro.test | 78 - test/old-elf/Mips/rel-gprel16-overflow.test | 48 - test/old-elf/Mips/rel-gprel16.test | 104 - test/old-elf/Mips/rel-gprel32-64.test | 84 - test/old-elf/Mips/rel-gprel32.test | 84 - test/old-elf/Mips/rel-gprel7-micro-overflow.test | 48 - test/old-elf/Mips/rel-gprel7-micro.test | 65 - test/old-elf/Mips/rel-hi0-lo16-micro.test | 58 - test/old-elf/Mips/rel-high-01.test | 25 - test/old-elf/Mips/rel-high-02.test | 25 - test/old-elf/Mips/rel-jalr-01.test | 101 - test/old-elf/Mips/rel-jalr-02.test | 68 - test/old-elf/Mips/rel-lit-micro.test | 59 - test/old-elf/Mips/rel-lit.test | 57 - test/old-elf/Mips/rel-pc-hilo.test | 70 - test/old-elf/Mips/rel-pc16-align.test | 43 - test/old-elf/Mips/rel-pc16-overflow.test | 45 - test/old-elf/Mips/rel-pc16.test | 53 - test/old-elf/Mips/rel-pc18-s3-align.test | 44 - test/old-elf/Mips/rel-pc18-s3-micro.test | 56 - test/old-elf/Mips/rel-pc18-s3.test | 54 - test/old-elf/Mips/rel-pc19-s2-align.test | 44 - test/old-elf/Mips/rel-pc19-s2-micro.test | 56 - test/old-elf/Mips/rel-pc19-s2.test | 54 - test/old-elf/Mips/rel-pc21-s2-align.test | 44 - test/old-elf/Mips/rel-pc21-s2-micro.test | 56 - test/old-elf/Mips/rel-pc21-s2-overflow.test | 45 - test/old-elf/Mips/rel-pc21-s2.test | 54 - test/old-elf/Mips/rel-pc26-s2-align.test | 44 - test/old-elf/Mips/rel-pc26-s2-micro.test | 56 - test/old-elf/Mips/rel-pc26-s2.test | 54 - test/old-elf/Mips/rel-pc32.test | 59 - test/old-elf/Mips/rel-pc7-10-16-23.test | 86 - test/old-elf/Mips/rel-sub-micro.test | 62 - test/old-elf/Mips/rel-sub.test | 61 - test/old-elf/Mips/rld_map.test | 42 - test/old-elf/Mips/sign-rela.test | 54 - test/old-elf/Mips/st-other.test | 90 - test/old-elf/Mips/static-01.test | 119 - test/old-elf/Mips/tls-1-micro.test | 65 - test/old-elf/Mips/tls-1.test | 63 - test/old-elf/Mips/tls-2-64-static.test | 71 - test/old-elf/Mips/tls-2-64.test | 69 - test/old-elf/Mips/tls-2-micro.test | 70 - test/old-elf/Mips/tls-2-static.test | 125 - test/old-elf/Mips/tls-2.test | 69 - test/old-elf/Mips/tls-3-64-static.test | 70 - test/old-elf/Mips/tls-3-micro.test | 183 -- test/old-elf/Mips/tls-3-static.test | 67 - test/old-elf/Mips/tls-3.test | 180 -- test/old-elf/Mips/tls-4-64-static.test | 71 - test/old-elf/Mips/tls-4-micro.test | 126 - test/old-elf/Mips/tls-4-static.test | 68 - test/old-elf/Mips/tls-4.test | 123 - test/old-elf/Mips/tls-5-64.test | 71 - test/old-elf/Mips/tls-5-micro.test | 70 - test/old-elf/Mips/tls-5.test | 69 - test/old-elf/Mips/validate-rel-01.test | 82 - test/old-elf/Mips/validate-rel-03.test | 56 - test/old-elf/X86_64/ExampleTarget/triple.test | 32 - test/old-elf/X86_64/Inputs/constint.c | 1 - test/old-elf/X86_64/Inputs/constint.o | Bin 1062 -> 0 bytes test/old-elf/X86_64/Inputs/debug0.c | 5 - test/old-elf/X86_64/Inputs/debug0.x86-64 | Bin 2704 -> 0 bytes test/old-elf/X86_64/Inputs/debug1.c | 3 - test/old-elf/X86_64/Inputs/debug1.x86-64 | Bin 2584 -> 0 bytes test/old-elf/X86_64/Inputs/externtls.c | 6 - test/old-elf/X86_64/Inputs/externtls.x86-64 | Bin 1424 -> 0 bytes test/old-elf/X86_64/Inputs/fn.c | 4 - test/old-elf/X86_64/Inputs/fn.o | Bin 1072 -> 0 bytes test/old-elf/X86_64/Inputs/generaltls-so.o.yaml | 67 - test/old-elf/X86_64/Inputs/group/1.c | 8 - test/old-elf/X86_64/Inputs/group/1.o | Bin 1456 -> 0 bytes test/old-elf/X86_64/Inputs/group/fn.c | 4 - test/old-elf/X86_64/Inputs/group/fn.o | Bin 1360 -> 0 bytes test/old-elf/X86_64/Inputs/group/fn1.c | 3 - test/old-elf/X86_64/Inputs/group/fn1.o | Bin 1352 -> 0 bytes test/old-elf/X86_64/Inputs/group/fn2.c | 3 - test/old-elf/X86_64/Inputs/group/fn2.o | Bin 1224 -> 0 bytes test/old-elf/X86_64/Inputs/group/group.sh | 38 - test/old-elf/X86_64/Inputs/group/libfn.a | Bin 2792 -> 0 bytes test/old-elf/X86_64/Inputs/group/libfn.so | Bin 2516 -> 0 bytes test/old-elf/X86_64/Inputs/group/libfn1.a | Bin 1492 -> 0 bytes test/old-elf/X86_64/Inputs/group/libfn2.so | Bin 9624 -> 0 bytes test/old-elf/X86_64/Inputs/initfini-option.c | 13 - test/old-elf/X86_64/Inputs/initfini-option.o | Bin 1824 -> 0 bytes test/old-elf/X86_64/Inputs/initfini.c | 14 - test/old-elf/X86_64/Inputs/initfini.o | Bin 2256 -> 0 bytes test/old-elf/X86_64/Inputs/largebss.c | 3 - test/old-elf/X86_64/Inputs/largebss.o | Bin 1131 -> 0 bytes test/old-elf/X86_64/Inputs/layoutpass/1.c | 8 - test/old-elf/X86_64/Inputs/layoutpass/1.o | Bin 1448 -> 0 bytes test/old-elf/X86_64/Inputs/layoutpass/2.c | 7 - test/old-elf/X86_64/Inputs/layoutpass/2.o | Bin 1320 -> 0 bytes test/old-elf/X86_64/Inputs/layoutpass/3.c | 3 - test/old-elf/X86_64/Inputs/layoutpass/3.o | Bin 1216 -> 0 bytes test/old-elf/X86_64/Inputs/layoutpass/lib2.a | Bin 1464 -> 0 bytes test/old-elf/X86_64/Inputs/libfn.a | Bin 1364 -> 0 bytes test/old-elf/X86_64/Inputs/libfn.so | Bin 2008 -> 0 bytes test/old-elf/X86_64/Inputs/main.c | 4 - test/old-elf/X86_64/Inputs/main.o | Bin 1360 -> 0 bytes test/old-elf/X86_64/Inputs/multi-ovrd.c | 10 - test/old-elf/X86_64/Inputs/multi-ovrd.o | Bin 1648 -> 0 bytes test/old-elf/X86_64/Inputs/multi-weak.c | 20 - test/old-elf/X86_64/Inputs/multi-weak.o | Bin 1856 -> 0 bytes test/old-elf/X86_64/Inputs/multiweaksyms.o | Bin 928 -> 0 bytes test/old-elf/X86_64/Inputs/nmagic.c | 8 - test/old-elf/X86_64/Inputs/nmagic.o | Bin 1528 -> 0 bytes test/old-elf/X86_64/Inputs/no-interp-section.c | 1 - test/old-elf/X86_64/Inputs/no-interp-section.o | Bin 975 -> 0 bytes test/old-elf/X86_64/Inputs/note.o | Bin 785 -> 0 bytes test/old-elf/X86_64/Inputs/note.s | 11 - test/old-elf/X86_64/Inputs/note_ro_rw.o | Bin 905 -> 0 bytes test/old-elf/X86_64/Inputs/note_ro_rw.s | 21 - test/old-elf/X86_64/Inputs/ovrd.c | 6 - test/old-elf/X86_64/Inputs/ovrd.o | Bin 1488 -> 0 bytes test/old-elf/X86_64/Inputs/rodata.c | 3 - test/old-elf/X86_64/Inputs/rodata.o | Bin 1584 -> 0 bytes test/old-elf/X86_64/Inputs/rodata.s | 24 - test/old-elf/X86_64/Inputs/rwint.c | 1 - test/old-elf/X86_64/Inputs/rwint.o | Bin 963 -> 0 bytes test/old-elf/X86_64/Inputs/sectionmap.c | 4 - test/old-elf/X86_64/Inputs/sectionmap.o | Bin 1478 -> 0 bytes test/old-elf/X86_64/Inputs/undefcpp.c | 1 - test/old-elf/X86_64/Inputs/undefcpp.o | Bin 1344 -> 0 bytes test/old-elf/X86_64/Inputs/weak-zero-sized.o | Bin 688 -> 0 bytes test/old-elf/X86_64/Inputs/weak.c | 14 - test/old-elf/X86_64/Inputs/weak.o | Bin 1712 -> 0 bytes test/old-elf/X86_64/Inputs/weak.s | 21 - test/old-elf/X86_64/Inputs/zerosizedsection.o | Bin 760 -> 0 bytes test/old-elf/X86_64/Inputs/zerosizedsection.s | 3 - test/old-elf/X86_64/alignoffset.test | 118 - test/old-elf/X86_64/debug.test | 57 - test/old-elf/X86_64/defsym.test | 22 - test/old-elf/X86_64/demangle.test | 12 - .../X86_64/dontignorezerosize-sections.test | 9 - test/old-elf/X86_64/dynamicvars.test | 123 - test/old-elf/X86_64/dynlib-nointerp-section.test | 4 - test/old-elf/X86_64/dynlib-search.test | 6 - test/old-elf/X86_64/dynsym-weak.test | 118 - test/old-elf/X86_64/extern-tls.test | 16 - test/old-elf/X86_64/general-dynamic-tls.test | 128 - test/old-elf/X86_64/imagebase.test | 94 - test/old-elf/X86_64/initfini-order.test | 10 - test/old-elf/X86_64/initfini.test | 23 - test/old-elf/X86_64/largebss.test | 20 - test/old-elf/X86_64/layoutpass-order.test | 14 - test/old-elf/X86_64/maxpagesize.test | 113 - test/old-elf/X86_64/mergesimilarstrings.test | 47 - test/old-elf/X86_64/multi-weak-layout.test | 52 - test/old-elf/X86_64/multi-weak-override.test | 16 - test/old-elf/X86_64/multi-weak-syms-order.test | 13 - test/old-elf/X86_64/nmagic.test | 91 - test/old-elf/X86_64/noalignsegments.test | 95 - test/old-elf/X86_64/note-sections-ro_plus_rw.test | 42 - test/old-elf/X86_64/note-sections.test | 23 - test/old-elf/X86_64/omagic.test | 237 -- test/old-elf/X86_64/outputsegments.test | 188 -- test/old-elf/X86_64/reloc_r_x86_64_16.test | 59 - test/old-elf/X86_64/reloc_r_x86_64_pc16.test | 60 - test/old-elf/X86_64/reloc_r_x86_64_pc64.test | 60 - test/old-elf/X86_64/rodata.test | 9 - test/old-elf/X86_64/sectionchoice.test | 7 - test/old-elf/X86_64/sectionmap.test | 22 - test/old-elf/X86_64/startGroupEndGroup.test | 48 - .../X86_64/startGroupEndGroupWithDynlib.test | 10 - test/old-elf/X86_64/staticlib-search.test | 6 - test/old-elf/X86_64/undef.test | 18 - test/old-elf/X86_64/underscore-end.test | 81 - test/old-elf/X86_64/weak-override.test | 45 - test/old-elf/X86_64/weak-zero-sized.test | 26 - test/old-elf/X86_64/weaksym.test | 77 - test/old-elf/X86_64/yamlinput.test | 166 -- test/old-elf/abs-dup.objtxt | 19 - test/old-elf/abs.test | 19 - test/old-elf/allowduplicates.objtxt | 41 - test/old-elf/archive-elf-forceload.test | 43 - test/old-elf/archive-elf.test | 38 - test/old-elf/as-needed.test | 15 - test/old-elf/branch.test | 34 - test/old-elf/check.test | 39 - test/old-elf/checkrodata.test | 9 - test/old-elf/common.test | 10 - test/old-elf/consecutive-weak-sym-defs.test | 81 - test/old-elf/defsym.objtxt | 31 - test/old-elf/discard-all.test | 88 - test/old-elf/discard-locals.test | 65 - test/old-elf/dynamic-segorder.test | 17 - test/old-elf/dynamic-undef.test | 38 - test/old-elf/dynamic.test | 80 - test/old-elf/eh_frame_hdr.test | 30 - test/old-elf/entry.objtxt | 58 - test/old-elf/export-dynamic.test | 98 - test/old-elf/filenotfound.test | 3 - .../gnulinkonce-report-discarded-reference.test | 145 - .../gnulinkonce/gnulinkonce-report-undef.test | 127 - test/old-elf/gnulinkonce/gnulinkonce.test | 149 - test/old-elf/gotpcrel.test | 21 - test/old-elf/gottpoff.test | 119 - test/old-elf/group-cmd-search.test | 134 - test/old-elf/hexagon-quickdata-sort.test | 12 - test/old-elf/hexagon-quickdata-sortcommon.test | 16 - test/old-elf/ifunc.test | 69 - test/old-elf/ignore-unknownoption.test | 5 - test/old-elf/init_array-order.test | 67 - test/old-elf/init_array.test | 127 - test/old-elf/initfini-options.test-1.test | 33 - test/old-elf/initfini-options.test-2.test | 47 - test/old-elf/initfini-options.test-3.test | 53 - test/old-elf/librarynotfound.test | 5 - test/old-elf/linker-as-ld.test | 16 - test/old-elf/linkerscript/Inputs/externs.ls | 3 - test/old-elf/linkerscript/Inputs/invalid.ls | 1 - test/old-elf/linkerscript/Inputs/prog1.o.yaml | 87 - test/old-elf/linkerscript/Inputs/prog2.o.yaml | 88 - test/old-elf/linkerscript/Inputs/prog3.o.yaml | 51 - test/old-elf/linkerscript/Inputs/simple-pic.o.yaml | 32 - test/old-elf/linkerscript/Inputs/simple.o.yaml | 51 - test/old-elf/linkerscript/Inputs/valid.ls | 6 - test/old-elf/linkerscript/externs.objtxt | 21 - .../linkerscript/filename-with-wildcards.test | 49 - .../old-elf/linkerscript/invalid-script-cli-1.test | 10 - .../old-elf/linkerscript/invalid-script-cli-2.test | 6 - test/old-elf/linkerscript/invalid.test | 5 - test/old-elf/linkerscript/phdrs-all-none.test | 26 - test/old-elf/linkerscript/phdrs-custom-none.test | 36 - test/old-elf/linkerscript/phdrs-default.test | 82 - test/old-elf/linkerscript/phdrs-different.test | 45 - test/old-elf/linkerscript/phdrs-extra-program.test | 27 - test/old-elf/linkerscript/phdrs-flags.test | 46 - test/old-elf/linkerscript/phdrs-has-program.test | 33 - test/old-elf/linkerscript/phdrs-invalid.test | 63 - .../linkerscript/phdrs-misplaced-program.test | 26 - test/old-elf/linkerscript/phdrs-no-program.test | 25 - test/old-elf/linkerscript/phdrs-one-none.test | 36 - test/old-elf/linkerscript/phdrs-program-flags.test | 33 - .../linkerscript/phdrs-program-good-phdrs.test | 34 - .../linkerscript/phdrs-program-no-phdrs.test | 26 - .../linkerscript/phdrs-program-wrong-phdrs.test | 26 - test/old-elf/linkerscript/phdrs-same-flags.test | 35 - test/old-elf/linkerscript/phdrs-same.test | 36 - .../linkerscript/phdrs/sections-empty-phdrs.script | 11 - .../linkerscript/phdrs/sections-no-phdrs.script | 7 - .../linkerscript/phdrs/sections-none-phdrs.script | 11 - .../linkerscript/phdrs/undef-empty-phdrs.script | 11 - .../linkerscript/phdrs/undef-id-phdrs.script | 12 - .../linkerscript/phdrs/undef-no-phdrs.script | 7 - test/old-elf/linkerscript/sections-order.test | 113 - .../linkerscript/sections-with-wildcards.test | 88 - .../old-elf/linkerscript/symbol-definition-so.test | 32 - test/old-elf/linkerscript/symbol-definition.test | 54 - test/old-elf/linkerscript/valid-script-cli.objtxt | 23 - test/old-elf/loginputfiles.test | 28 - test/old-elf/mergeatoms.test | 6 - test/old-elf/mergeconstants.test | 20 - test/old-elf/mergeglobalatoms.test | 11 - test/old-elf/no-unique-section-names.test | 19 - test/old-elf/note.test | 50 - test/old-elf/options/dynamic-linker.test | 17 - test/old-elf/options/target-specific-args.test | 5 - test/old-elf/phdr.test | 99 - test/old-elf/quickdata.test | 15 - test/old-elf/reloc.test | 38 - test/old-elf/responsefile.test | 6 - test/old-elf/rodata.test | 5 - test/old-elf/rosegment.test | 26 - .../sectionGroups/sectiongroup-new-members.test | 151 - .../old-elf/sectionGroups/sectiongroup-simple.test | 144 - .../sectiongroup-undef-member-other.test | 156 -- .../sectionGroups/sectiongroup-undef-member.test | 142 - .../sectiongroup-with-globalsymbols.test | 250 -- ...sectiongroup-with-undef-external-reference.test | 236 -- .../sectiongroup-with-undef-signature.test | 219 -- test/old-elf/sections.test | 142 - test/old-elf/sh_addralign.test | 37 - test/old-elf/shndx.test | 18 - test/old-elf/soname.test | 6 - test/old-elf/start-stop-sym.test | 108 - test/old-elf/strip-all.test | 108 - test/old-elf/stripped-empty.test | 4 - test/old-elf/symbols.test | 33 - test/old-elf/tls-tbss-size.test | 176 -- test/old-elf/tls.test | 43 - test/old-elf/tlsAddr.test | 7 - test/old-elf/undef-from-dso-to-main.test | 52 - test/old-elf/undef-from-main-dso.test | 43 - test/old-elf/weaksym.test | 7 - test/old-elf/wrap.test | 276 -- test/old-elf/x86-64-dynamic-relocs.test | 26 - test/old-elf/x86-64-dynamic.test | 79 - test/old-elf/x86.test | 38 - test/old-elf/x86_64-kinds.test | 23 - test/old-elf/zoption_dtflags.test | 89 - tools/CMakeLists.txt | 2 - tools/linker-script-test/CMakeLists.txt | 8 - tools/linker-script-test/linker-script-test.cpp | 57 - tools/lld/CMakeLists.txt | 1 + tools/lld/TODO.txt | 2 - tools/lld/lld.cpp | 108 +- unittests/CoreTests/CMakeLists.txt | 5 +- unittests/CoreTests/RangeTest.cpp | 240 -- unittests/DriverTests/CMakeLists.txt | 4 - unittests/DriverTests/DarwinLdDriverTest.cpp | 153 +- unittests/DriverTests/DriverTest.h | 61 - unittests/DriverTests/GnuLdDriverTest.cpp | 299 -- unittests/DriverTests/UniversalDriverTest.cpp | 33 - .../MachONormalizedFileBinaryReaderTests.cpp | 25 +- .../MachONormalizedFileBinaryWriterTests.cpp | 18 +- .../MachOTests/MachONormalizedFileToAtomsTests.cpp | 18 +- .../MachOTests/MachONormalizedFileYAMLTests.cpp | 23 +- 1685 files changed, 30937 insertions(+), 78902 deletions(-) create mode 100644 COFF/Librarian.cpp create mode 100644 ELF/EhFrame.cpp create mode 100644 ELF/EhFrame.h create mode 100644 ELF/ICF.cpp create mode 100644 ELF/ICF.h create mode 100644 ELF/LTO.cpp create mode 100644 ELF/LTO.h create mode 100644 ELF/LinkerScript.h create mode 100644 ELF/Relocations.cpp create mode 100644 ELF/Relocations.h create mode 100644 ELF/ScriptParser.cpp create mode 100644 ELF/ScriptParser.h create mode 100644 ELF/Strings.cpp create mode 100644 ELF/Strings.h create mode 100644 ELF/SymbolListFile.cpp create mode 100644 ELF/SymbolListFile.h create mode 100644 ELF/Thunks.cpp create mode 100644 ELF/Thunks.h create mode 100644 docs/AtomLLD.rst create mode 100644 docs/NewLLD.rst create mode 100644 docs/ReleaseNotes.rst delete mode 100644 include/lld/Core/Alias.h delete mode 100644 include/lld/Core/STDExtras.h delete mode 100644 include/lld/Core/range.h delete mode 100644 include/lld/ReaderWriter/AtomLayout.h delete mode 100644 include/lld/ReaderWriter/CoreLinkingContext.h delete mode 100644 include/lld/ReaderWriter/ELFLinkingContext.h delete mode 100644 include/lld/ReaderWriter/LinkerScript.h delete mode 100644 lib/Driver/CoreDriver.cpp delete mode 100644 lib/Driver/CoreOptions.td delete mode 100644 lib/Driver/Driver.cpp delete mode 100644 lib/Driver/GnuLdDriver.cpp delete mode 100644 lib/Driver/GnuLdOptions.td delete mode 100644 lib/Driver/TODO.rst delete mode 100644 lib/Driver/UniversalDriver.cpp delete mode 100644 lib/Driver/UniversalDriverOptions.td delete mode 100644 lib/ReaderWriter/CoreLinkingContext.cpp delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.cpp delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.h delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.cpp delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.h delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.h delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64SectionChunks.cpp delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64SectionChunks.h delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h delete mode 100644 lib/ReaderWriter/ELF/AArch64/CMakeLists.txt delete mode 100644 lib/ReaderWriter/ELF/AArch64/TODO.rst delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMDynamicLibraryWriter.h delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMELFFile.h delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMELFWriters.h delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMLinkingContext.cpp delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMLinkingContext.h delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.h delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMRelocationPass.h delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMSymbolTable.h delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h delete mode 100644 lib/ReaderWriter/ELF/ARM/CMakeLists.txt delete mode 100644 lib/ReaderWriter/ELF/ARM/TODO.rst delete mode 100644 lib/ReaderWriter/ELF/Atoms.cpp delete mode 100644 lib/ReaderWriter/ELF/Atoms.h delete mode 100644 lib/ReaderWriter/ELF/CMakeLists.txt delete mode 100644 lib/ReaderWriter/ELF/Chunk.h delete mode 100644 lib/ReaderWriter/ELF/DynamicFile.cpp delete mode 100644 lib/ReaderWriter/ELF/DynamicFile.h delete mode 100644 lib/ReaderWriter/ELF/DynamicLibraryWriter.h delete mode 100644 lib/ReaderWriter/ELF/ELFFile.cpp delete mode 100644 lib/ReaderWriter/ELF/ELFFile.h delete mode 100644 lib/ReaderWriter/ELF/ELFLinkingContext.cpp delete mode 100644 lib/ReaderWriter/ELF/ELFReader.h delete mode 100644 lib/ReaderWriter/ELF/ExecutableWriter.h delete mode 100644 lib/ReaderWriter/ELF/FileCommon.cpp delete mode 100644 lib/ReaderWriter/ELF/FileCommon.h delete mode 100644 lib/ReaderWriter/ELF/HeaderChunks.cpp delete mode 100644 lib/ReaderWriter/ELF/HeaderChunks.h delete mode 100644 lib/ReaderWriter/ELF/Hexagon/CMakeLists.txt delete mode 100644 lib/ReaderWriter/ELF/Hexagon/HexagonDynamicLibraryWriter.h delete mode 100644 lib/ReaderWriter/ELF/Hexagon/HexagonELFFile.h delete mode 100644 lib/ReaderWriter/ELF/Hexagon/HexagonEncodings.h delete mode 100644 lib/ReaderWriter/ELF/Hexagon/HexagonExecutableWriter.h delete mode 100644 lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp delete mode 100644 lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.h delete mode 100644 lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h delete mode 100644 lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h delete mode 100644 lib/ReaderWriter/ELF/Mips/CMakeLists.txt delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsAbiInfoHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsAbiInfoHandler.h delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.h delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsELFFile.cpp delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsELFFile.h delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsELFWriters.cpp delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsELFWriters.h delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.h delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsRelocationPass.h delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsSectionChunks.cpp delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsTargetLayout.cpp delete mode 100644 lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h delete mode 100644 lib/ReaderWriter/ELF/OrderPass.h delete mode 100644 lib/ReaderWriter/ELF/OutputELFWriter.cpp delete mode 100644 lib/ReaderWriter/ELF/OutputELFWriter.h delete mode 100644 lib/ReaderWriter/ELF/Reader.cpp delete mode 100644 lib/ReaderWriter/ELF/SectionChunks.cpp delete mode 100644 lib/ReaderWriter/ELF/SectionChunks.h delete mode 100644 lib/ReaderWriter/ELF/SegmentChunks.cpp delete mode 100644 lib/ReaderWriter/ELF/SegmentChunks.h delete mode 100644 lib/ReaderWriter/ELF/TODO.txt delete mode 100644 lib/ReaderWriter/ELF/TargetHandler.h delete mode 100644 lib/ReaderWriter/ELF/TargetLayout.cpp delete mode 100644 lib/ReaderWriter/ELF/TargetLayout.h delete mode 100644 lib/ReaderWriter/ELF/Writer.cpp delete mode 100644 lib/ReaderWriter/ELF/Writer.h delete mode 100644 lib/ReaderWriter/ELF/X86/CMakeLists.txt delete mode 100644 lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h delete mode 100644 lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h delete mode 100644 lib/ReaderWriter/ELF/X86/X86LinkingContext.cpp delete mode 100644 lib/ReaderWriter/ELF/X86/X86LinkingContext.h delete mode 100644 lib/ReaderWriter/ELF/X86/X86RelocationHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/X86/X86RelocationHandler.h delete mode 100644 lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/X86/X86TargetHandler.h delete mode 100644 lib/ReaderWriter/ELF/X86_64/CMakeLists.txt delete mode 100644 lib/ReaderWriter/ELF/X86_64/ExampleSubTarget/CMakeLists.txt delete mode 100644 lib/ReaderWriter/ELF/X86_64/ExampleSubTarget/ExampleLinkingContext.cpp delete mode 100644 lib/ReaderWriter/ELF/X86_64/ExampleSubTarget/ExampleLinkingContext.h delete mode 100644 lib/ReaderWriter/ELF/X86_64/ExampleSubTarget/ExampleTargetHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/X86_64/ExampleSubTarget/ExampleTargetHandler.h delete mode 100644 lib/ReaderWriter/ELF/X86_64/TODO.rst delete mode 100644 lib/ReaderWriter/ELF/X86_64/X86_64DynamicLibraryWriter.h delete mode 100644 lib/ReaderWriter/ELF/X86_64/X86_64ExecutableWriter.h delete mode 100644 lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp delete mode 100644 lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.h delete mode 100644 lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h delete mode 100644 lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp delete mode 100644 lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.h delete mode 100644 lib/ReaderWriter/ELF/X86_64/X86_64SectionChunks.cpp delete mode 100644 lib/ReaderWriter/ELF/X86_64/X86_64SectionChunks.h delete mode 100644 lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp delete mode 100644 lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h delete mode 100644 lib/ReaderWriter/LinkerScript.cpp create mode 100644 lib/ReaderWriter/MachO/ObjCPass.cpp create mode 100644 test/COFF/Inputs/manifestinput.test delete mode 100644 test/COFF/dllorder.test create mode 100644 test/COFF/manifestinput.test create mode 100644 test/COFF/section.test delete mode 100644 test/Driver/def-lib-search.test delete mode 100644 test/Driver/flavor-option.test delete mode 100644 test/Driver/lib-search.test delete mode 100644 test/Driver/so-whole-archive.test delete mode 100644 test/Driver/trivial-driver.test delete mode 100644 test/Driver/undef-basic.objtxt create mode 100644 test/ELF/Inputs/aarch64-copy2.s create mode 100644 test/ELF/Inputs/aarch64-tls-gdie.s create mode 100644 test/ELF/Inputs/abs-hidden.s create mode 100644 test/ELF/Inputs/arm-plt-reloc.s create mode 100644 test/ELF/Inputs/arm-thumb-blx-targets.s create mode 100644 test/ELF/Inputs/arm-thumb-narrow-branch.s create mode 100644 test/ELF/Inputs/conflict.s create mode 100644 test/ELF/Inputs/copy-in-shared.s create mode 100644 test/ELF/Inputs/copy-rel-corrupted.s create mode 100644 test/ELF/Inputs/copy-rel-pie.s create mode 100644 test/ELF/Inputs/ctors_dtors_priority1.s create mode 100644 test/ELF/Inputs/ctors_dtors_priority2.s create mode 100644 test/ELF/Inputs/ctors_dtors_priority3.s create mode 100644 test/ELF/Inputs/duplicated-plt-entry.s create mode 100644 test/ELF/Inputs/dynamic-reloc-weak.s create mode 100644 test/ELF/Inputs/ehframe-relocation.s create mode 100644 test/ELF/Inputs/empty-ver.ver create mode 100644 test/ELF/Inputs/far-arm-abs.s create mode 100644 test/ELF/Inputs/far-arm-thumb-abs.s create mode 100644 test/ELF/Inputs/gc-sections-weak.s create mode 100644 test/ELF/Inputs/gnu-ifunc-gotpcrel.s create mode 100644 test/ELF/Inputs/gotpc-relax-und-dso.s create mode 100644 test/ELF/Inputs/icf2.s create mode 100644 test/ELF/Inputs/invalid-cie-version2.elf create mode 100644 test/ELF/Inputs/mips-align-err.s create mode 100644 test/ELF/Inputs/mips-nonalloc.s create mode 100644 test/ELF/Inputs/mips-pic.s create mode 100644 test/ELF/Inputs/mips-tls.s create mode 100644 test/ELF/Inputs/plt-aarch64.s create mode 100644 test/ELF/Inputs/ppc64-addr16-error.s create mode 100644 test/ELF/Inputs/protected-shared.s create mode 100644 test/ELF/Inputs/relocatable-ehframe.s create mode 100644 test/ELF/Inputs/relocatable.s create mode 100644 test/ELF/Inputs/relocatable2.s create mode 100644 test/ELF/Inputs/relocation-copy-alias.s create mode 100644 test/ELF/Inputs/relocation-copy-arm.s create mode 100644 test/ELF/Inputs/resolution-shared.s create mode 100644 test/ELF/Inputs/start-lib-comdat.s create mode 100644 test/ELF/Inputs/start-lib1.s create mode 100644 test/ELF/Inputs/start-lib2.s create mode 100644 test/ELF/Inputs/symbol-override.s create mode 100644 test/ELF/Inputs/tls-got-entry.s create mode 100644 test/ELF/Inputs/tls-in-archive.s create mode 100644 test/ELF/Inputs/trace-ar1.s create mode 100644 test/ELF/Inputs/trace-ar2.s create mode 100644 test/ELF/Inputs/trace-symbols-foo-strong.s create mode 100644 test/ELF/Inputs/trace-symbols-foo-weak.s create mode 100644 test/ELF/Inputs/undef-with-plt-addr.s create mode 100644 test/ELF/Inputs/undef.s create mode 100644 test/ELF/Inputs/unresolved-symbols.s create mode 100644 test/ELF/Inputs/verdef-defaultver.s create mode 100644 test/ELF/Inputs/verdef.s create mode 100755 test/ELF/Inputs/verneed.so.sh create mode 100644 test/ELF/Inputs/version-script-err.script create mode 100644 test/ELF/Inputs/version-use.script create mode 100644 test/ELF/Inputs/warn-common.s create mode 100644 test/ELF/Inputs/warn-common2.s create mode 100644 test/ELF/Inputs/x86-64-relax-offset.s create mode 100644 test/ELF/Inputs/x86-64-reloc-error.s create mode 100644 test/ELF/Inputs/x86-64-tls-gd-got.s create mode 100644 test/ELF/aarch64-abs64-dyn.s create mode 100644 test/ELF/aarch64-copy2.s create mode 100644 test/ELF/aarch64-fpic-got.s create mode 100644 test/ELF/aarch64-got-relocations.s create mode 100644 test/ELF/aarch64-got.s create mode 100644 test/ELF/aarch64-relative.s create mode 100644 test/ELF/aarch64-tls-gdie.s create mode 100644 test/ELF/aarch64-tls-gdle.s create mode 100644 test/ELF/aarch64-tls-iele.s create mode 100644 test/ELF/aarch64-tls-le.s create mode 100644 test/ELF/aarch64-tls-pie.s create mode 100644 test/ELF/aarch64-tls-static.s create mode 100644 test/ELF/aarch64-tlsdesc.s create mode 100644 test/ELF/abs-hidden.s create mode 100644 test/ELF/amdgpu-relocs.s create mode 100644 test/ELF/arm-abs32-dyn.s create mode 100644 test/ELF/arm-attributes-remove.s create mode 100644 test/ELF/arm-blx.s create mode 100644 test/ELF/arm-branch-error.s create mode 100644 test/ELF/arm-branch.s create mode 100644 test/ELF/arm-copy.s create mode 100644 test/ELF/arm-data-prel.s create mode 100644 test/ELF/arm-data-relocs.s create mode 100644 test/ELF/arm-fpic-got.s create mode 100644 test/ELF/arm-gnu-ifunc-nosym.s create mode 100644 test/ELF/arm-gnu-ifunc.s create mode 100644 test/ELF/arm-got-relative.s create mode 100644 test/ELF/arm-gotoff.s create mode 100644 test/ELF/arm-mov-relocs.s create mode 100644 test/ELF/arm-plt-reloc.s create mode 100644 test/ELF/arm-thumb-blx.s create mode 100644 test/ELF/arm-thumb-branch-error.s create mode 100644 test/ELF/arm-thumb-branch.s create mode 100644 test/ELF/arm-thumb-interwork-thunk.s create mode 100644 test/ELF/arm-thumb-narrow-branch-check.s create mode 100644 test/ELF/arm-thumb-plt-reloc.s create mode 100644 test/ELF/as-needed-no-reloc.s create mode 100644 test/ELF/avoid-empty-program-headers.s create mode 100644 test/ELF/bsymbolic-undef.s create mode 100644 test/ELF/bsymbolic.s create mode 100644 test/ELF/build-id.s create mode 100644 test/ELF/combrelocs.s create mode 100644 test/ELF/compressed-debug-input.s create mode 100644 test/ELF/conflict.s create mode 100644 test/ELF/copy-errors.s create mode 100644 test/ELF/copy-in-shared.s create mode 100644 test/ELF/copy-rel-corrupted.s create mode 100644 test/ELF/copy-rel-pie-error.s create mode 100644 test/ELF/copy-rel-pie.s create mode 100644 test/ELF/ctors_dtors_priority.s create mode 100644 test/ELF/dont-export-hidden.s create mode 100644 test/ELF/driver.test create mode 100644 test/ELF/duplicated-plt-entry.s create mode 100644 test/ELF/dynamic-list.s create mode 100644 test/ELF/dynamic-reloc-in-ro.s create mode 100644 test/ELF/dynamic.s create mode 100644 test/ELF/dynsym-pie.s create mode 100644 test/ELF/edata-etext.s create mode 100644 test/ELF/eh-frame-dyn-rel.s create mode 100644 test/ELF/eh-frame-gc.s create mode 100644 test/ELF/eh-frame-hdr-abs-fde.s create mode 100644 test/ELF/eh-frame-hdr-augmentation.s create mode 100644 test/ELF/eh-frame-hdr-icf.s create mode 100644 test/ELF/eh-frame-hdr-no-out.s create mode 100644 test/ELF/eh-frame-hdr-no-out2.s create mode 100644 test/ELF/eh-frame-hdr.s create mode 100644 test/ELF/eh-frame-marker.s create mode 100644 test/ELF/eh-frame-multilpe-cie.s create mode 100644 test/ELF/empty-ver.s create mode 100644 test/ELF/fatal-warnings.s create mode 100644 test/ELF/file-sym.s create mode 100644 test/ELF/gc-merge-local-sym.s create mode 100644 test/ELF/gc-sections-local-sym.s create mode 100644 test/ELF/gc-sections-lsda.s create mode 100644 test/ELF/gc-sections-merge-addend.s create mode 100644 test/ELF/gc-sections-merge-implicit-addend.s create mode 100644 test/ELF/gc-sections-merge.s create mode 100644 test/ELF/gc-sections-protected.s create mode 100644 test/ELF/gc-sections-shared.s create mode 100644 test/ELF/gc-sections-weak.s create mode 100644 test/ELF/global_offset_table_shared.s create mode 100644 test/ELF/gnu-ifunc-gotpcrel.s create mode 100644 test/ELF/gnu-ifunc-relative.s create mode 100644 test/ELF/got-plt-header.s create mode 100644 test/ELF/gotpc-relax-nopic.s create mode 100644 test/ELF/gotpc-relax-und-dso.s create mode 100644 test/ELF/gotpc-relax.s create mode 100644 test/ELF/gotpcrelx.s create mode 100644 test/ELF/i386-got-and-copy.s create mode 100644 test/ELF/i386-gotpc.s create mode 100644 test/ELF/i386-merge.s create mode 100644 test/ELF/i386-relative.s create mode 100644 test/ELF/i386-relax-reloc.s create mode 100644 test/ELF/i386-tls-ie-shared.s create mode 100644 test/ELF/icf1.s create mode 100644 test/ELF/icf2.s create mode 100644 test/ELF/icf3.s create mode 100644 test/ELF/icf4.s create mode 100644 test/ELF/icf5.s create mode 100644 test/ELF/icf6.s create mode 100644 test/ELF/icf7.s create mode 100644 test/ELF/image-base.s create mode 100644 test/ELF/init_fini_priority.s create mode 100644 test/ELF/invalid-dynamic-list.test create mode 100644 test/ELF/invalid-linkerscript.test create mode 100644 test/ELF/linkerscript-align.s create mode 100644 test/ELF/linkerscript-diagnostic.s create mode 100644 test/ELF/linkerscript-locationcounter.s create mode 100644 test/ELF/linkerscript-orphans.s create mode 100644 test/ELF/linkerscript-phdr-check.s create mode 100644 test/ELF/linkerscript-repsection-va.s create mode 100644 test/ELF/linkerscript-sections-keep.s create mode 100644 test/ELF/linkerscript-sections-padding.s create mode 100644 test/ELF/linkerscript-symbol-conflict.s create mode 100644 test/ELF/linkerscript-symbols.s create mode 100644 test/ELF/linkerscript-va.s create mode 100644 test/ELF/llvm33-rela-outside-group.s create mode 100644 test/ELF/local-got-pie.s create mode 100644 test/ELF/local-undefined-symbol.s create mode 100644 test/ELF/lto/Inputs/archive-2.ll create mode 100644 test/ELF/lto/Inputs/archive-3.ll create mode 100644 test/ELF/lto/Inputs/archive.ll create mode 100644 test/ELF/lto/Inputs/available-externally.ll create mode 100644 test/ELF/lto/Inputs/comdat.s create mode 100644 test/ELF/lto/Inputs/common.s create mode 100644 test/ELF/lto/Inputs/drop-debug-info.bc create mode 100644 test/ELF/lto/Inputs/drop-linkage.ll create mode 100644 test/ELF/lto/Inputs/dynsym.s create mode 100644 test/ELF/lto/Inputs/internalize-exportdyn.ll create mode 100644 test/ELF/lto/Inputs/internalize-undef.ll create mode 100644 test/ELF/lto/Inputs/irmover-error.ll create mode 100644 test/ELF/lto/Inputs/linkonce-odr.ll create mode 100644 test/ELF/lto/Inputs/linkonce.ll create mode 100644 test/ELF/lto/Inputs/resolution.s create mode 100644 test/ELF/lto/Inputs/save-temps.ll create mode 100644 test/ELF/lto/Inputs/shared.s create mode 100644 test/ELF/lto/Inputs/start-lib1.ll create mode 100644 test/ELF/lto/Inputs/start-lib2.ll create mode 100644 test/ELF/lto/Inputs/tls-mixed.s create mode 100644 test/ELF/lto/Inputs/type-merge.ll create mode 100644 test/ELF/lto/Inputs/type-merge2.ll create mode 100644 test/ELF/lto/Inputs/undef-mixed.s create mode 100644 test/ELF/lto/Inputs/unnamed-addr-lib.s create mode 100644 test/ELF/lto/Inputs/visibility.s create mode 100644 test/ELF/lto/archive-2.ll create mode 100644 test/ELF/lto/archive-3.ll create mode 100644 test/ELF/lto/archive.ll create mode 100644 test/ELF/lto/asmundef.ll create mode 100644 test/ELF/lto/available-externally.ll create mode 100644 test/ELF/lto/combined-lto-object-name.ll create mode 100644 test/ELF/lto/comdat.ll create mode 100644 test/ELF/lto/comdat2.ll create mode 100644 test/ELF/lto/common.ll create mode 100644 test/ELF/lto/common2.ll create mode 100644 test/ELF/lto/ctors.ll create mode 100644 test/ELF/lto/discard-value-names.ll create mode 100644 test/ELF/lto/drop-debug-info.ll create mode 100644 test/ELF/lto/drop-linkage.ll create mode 100644 test/ELF/lto/duplicated.ll create mode 100644 test/ELF/lto/dynamic-list.ll create mode 100644 test/ELF/lto/dynsym.ll create mode 100644 test/ELF/lto/inline-asm.ll create mode 100644 test/ELF/lto/internalize-basic.ll create mode 100644 test/ELF/lto/internalize-exportdyn.ll create mode 100644 test/ELF/lto/internalize-llvmused.ll create mode 100644 test/ELF/lto/internalize-undef.ll create mode 100644 test/ELF/lto/internalize-version-script.ll create mode 100644 test/ELF/lto/invalid-bitcode.ll create mode 100644 test/ELF/lto/irmover-error.ll create mode 100644 test/ELF/lto/linkage.ll create mode 100644 test/ELF/lto/linkonce-odr.ll create mode 100644 test/ELF/lto/linkonce.ll create mode 100644 test/ELF/lto/lto-start.ll create mode 100644 test/ELF/lto/ltopasses-basic.ll create mode 100644 test/ELF/lto/ltopasses-custom.ll create mode 100644 test/ELF/lto/metadata.ll create mode 100644 test/ELF/lto/mix-platforms.ll create mode 100644 test/ELF/lto/module-asm.ll create mode 100644 test/ELF/lto/opt-level.ll create mode 100644 test/ELF/lto/parallel-internalize.ll create mode 100644 test/ELF/lto/parallel.ll create mode 100644 test/ELF/lto/pic.ll create mode 100644 test/ELF/lto/relax-relocs.ll create mode 100644 test/ELF/lto/resolution.ll create mode 100644 test/ELF/lto/save-temps.ll create mode 100644 test/ELF/lto/shlib-undefined.ll create mode 100644 test/ELF/lto/start-lib.ll create mode 100644 test/ELF/lto/tls-mixed.ll create mode 100644 test/ELF/lto/tls-preserve.ll create mode 100644 test/ELF/lto/type-merge.ll create mode 100644 test/ELF/lto/type-merge2.ll create mode 100644 test/ELF/lto/undef-mixed.ll create mode 100644 test/ELF/lto/undef-weak.ll create mode 100644 test/ELF/lto/undef.ll create mode 100644 test/ELF/lto/undefined-puts.ll create mode 100644 test/ELF/lto/unnamed-addr-comdat.ll create mode 100644 test/ELF/lto/unnamed-addr-lib.ll create mode 100644 test/ELF/lto/unnamed-addr.ll create mode 100644 test/ELF/lto/verify-invalid.ll create mode 100644 test/ELF/lto/version-script.ll create mode 100644 test/ELF/lto/visibility.ll create mode 100644 test/ELF/lto/weak.ll create mode 100644 test/ELF/merge-shared-str.s create mode 100644 test/ELF/mips-26.s create mode 100644 test/ELF/mips-32.s create mode 100644 test/ELF/mips-64-disp.s create mode 100644 test/ELF/mips-64-got.s create mode 100644 test/ELF/mips-64-gprel-so.s create mode 100644 test/ELF/mips-64-rels.s create mode 100644 test/ELF/mips-64.s create mode 100644 test/ELF/mips-align-err.s create mode 100644 test/ELF/mips-got-and-copy.s create mode 100644 test/ELF/mips-got-extsym.s create mode 100644 test/ELF/mips-got-redundant.s create mode 100644 test/ELF/mips-got-weak.s create mode 100644 test/ELF/mips-got16.s create mode 100644 test/ELF/mips-gp-local.s create mode 100644 test/ELF/mips-gprel32-relocs-gp0.test create mode 100644 test/ELF/mips-lo16-not-relative.s create mode 100644 test/ELF/mips-nonalloc.s create mode 100644 test/ELF/mips-npic-call-pic.s create mode 100644 test/ELF/mips-options-r.test create mode 100644 test/ELF/mips-options.s create mode 100644 test/ELF/mips-plt-copy.s delete mode 100644 test/ELF/mips-relocs.s create mode 100644 test/ELF/mips-sto-plt.s create mode 100644 test/ELF/mips-tls-64.s create mode 100644 test/ELF/mips-tls-hilo.s create mode 100644 test/ELF/mips-tls.s create mode 100644 test/ELF/no-augmentation.s create mode 100644 test/ELF/no-plt-shared.s create mode 100644 test/ELF/noplt-pie.s create mode 100644 test/ELF/note.s create mode 100644 test/ELF/phdr-align.s create mode 100644 test/ELF/pie-weak.s create mode 100644 test/ELF/pie.s create mode 100644 test/ELF/protected-shared.s create mode 100644 test/ELF/rel-offset.s create mode 100644 test/ELF/relative-dynamic-reloc-pie.s create mode 100644 test/ELF/relocatable-bss.s create mode 100644 test/ELF/relocatable-ehframe.s create mode 100644 test/ELF/relocatable-reloc.s create mode 100644 test/ELF/relocatable-symbols.s create mode 100644 test/ELF/relocation-copy-alias.s create mode 100644 test/ELF/relocation-copy-flags.s create mode 100644 test/ELF/relocation-non-alloc.s create mode 100644 test/ELF/relocation-relative-absolute.s create mode 100644 test/ELF/relocation-relative-synthetic.s create mode 100644 test/ELF/relocation-relative-weak.s create mode 100644 test/ELF/relocation-shared.s create mode 100644 test/ELF/relro-tls.s create mode 100644 test/ELF/reproduce-error.s create mode 100644 test/ELF/reproduce-linkerscript.s create mode 100644 test/ELF/reproduce-thin-archive.s create mode 100644 test/ELF/reproduce-windows.s create mode 100644 test/ELF/reproduce.s create mode 100644 test/ELF/resolution-shared.s create mode 100644 test/ELF/splitstacks.s create mode 100644 test/ELF/start-lib-comdat.s create mode 100644 test/ELF/start-lib.s create mode 100644 test/ELF/startstop-gccollect.s create mode 100644 test/ELF/string-gc.s create mode 100644 test/ELF/strip-debug.s create mode 100644 test/ELF/symbol-override.s create mode 100644 test/ELF/tail-merge-string-align.s create mode 100644 test/ELF/tls-archive.s create mode 100644 test/ELF/tls-got-entry.s create mode 100644 test/ELF/tls-in-archive.s create mode 100644 test/ELF/tls-initial-exec-local.s create mode 100644 test/ELF/tls-offset.s create mode 100644 test/ELF/tls-opt-no-plt.s create mode 100644 test/ELF/tls-two-relocs.s create mode 100644 test/ELF/trace-ar.s create mode 100644 test/ELF/trace-symbols.s create mode 100644 test/ELF/trace.s create mode 100644 test/ELF/undef-shared.s create mode 100644 test/ELF/undef-version-script.s create mode 100644 test/ELF/undef-with-plt-addr-i686.s create mode 100644 test/ELF/undef-with-plt-addr.s create mode 100644 test/ELF/unresolved-symbols.s create mode 100644 test/ELF/user_def_init_array_start.s delete mode 100644 test/ELF/valid-cie-length-dw64.s create mode 100644 test/ELF/verdef-defaultver.s create mode 100644 test/ELF/verdef-dependency.s create mode 100644 test/ELF/verdef.s create mode 100644 test/ELF/verneed-as-needed-weak.s create mode 100644 test/ELF/verneed-local.s create mode 100644 test/ELF/verneed.s create mode 100644 test/ELF/version-script-err.s create mode 100644 test/ELF/version-script-extern.s create mode 100644 test/ELF/version-script-noundef.s create mode 100644 test/ELF/version-script.s create mode 100644 test/ELF/version-undef-sym.s create mode 100644 test/ELF/version-use.s create mode 100644 test/ELF/version-wildcard.test create mode 100644 test/ELF/warn-common.s create mode 100644 test/ELF/weak-undef-hidden.s create mode 100644 test/ELF/weak-undef-shared.s create mode 100644 test/ELF/weak-undef.s create mode 100644 test/ELF/wildcards.s create mode 100644 test/ELF/x86-64-dyn-rel-error.s create mode 100644 test/ELF/x86-64-dyn-rel-error2.s create mode 100644 test/ELF/x86-64-rela.s create mode 100644 test/ELF/x86-64-relax-offset.s delete mode 100644 test/ELF/x86-64-reloc-32-error.s create mode 100644 test/ELF/x86-64-reloc-32-fpic.s delete mode 100644 test/ELF/x86-64-reloc-32S-error.s create mode 100644 test/ELF/x86-64-reloc-error.s create mode 100644 test/ELF/x86-64-reloc-pc32-fpic.s create mode 100644 test/ELF/x86-64-reloc-range.s create mode 100644 test/ELF/x86-64-tls-gd-got.s create mode 100644 test/ELF/x86-64-tls-gd-local.s create mode 100644 test/ELF/x86-64-tls-pie.s create mode 100644 test/ELF/zdefs.s delete mode 100644 test/LinkerScript/expr-precedence.test delete mode 100644 test/LinkerScript/extern-bad-symbol.test delete mode 100644 test/LinkerScript/extern-empty.test delete mode 100644 test/LinkerScript/extern-valid.test delete mode 100644 test/LinkerScript/incomplete-ternary.test delete mode 100644 test/LinkerScript/libname-err-1.test delete mode 100644 test/LinkerScript/libname-err-2.test delete mode 100644 test/LinkerScript/linker-script-outputformat.test delete mode 100644 test/LinkerScript/linker-script.test delete mode 100644 test/LinkerScript/memory-empty.test delete mode 100644 test/LinkerScript/memory-missing-attrs.test delete mode 100644 test/LinkerScript/memory-missing-length.test delete mode 100644 test/LinkerScript/memory-missing-name.test delete mode 100644 test/LinkerScript/memory-missing-origin.test delete mode 100644 test/LinkerScript/memory-valid.test delete mode 100644 test/LinkerScript/missing-entry-symbol.test delete mode 100644 test/LinkerScript/missing-input-file-name.test delete mode 100644 test/LinkerScript/missing-input-sections.test delete mode 100644 test/LinkerScript/missing-operand.test delete mode 100644 test/LinkerScript/missing-output-section-name.test delete mode 100644 test/LinkerScript/missing-symbol.test delete mode 100644 test/LinkerScript/phdrs-sections.test delete mode 100644 test/LinkerScript/sections.test delete mode 100644 test/core/Inputs/archive-basic.objtxt delete mode 100644 test/core/Inputs/archive-chain.objtxt delete mode 100644 test/core/Inputs/archive-chain2.objtxt delete mode 100644 test/core/Inputs/archive-tentdef-search.objtxt delete mode 100644 test/core/Inputs/associates.objtxt delete mode 100644 test/core/Inputs/auto-hide-coalesce.objtxt delete mode 100644 test/core/Inputs/code-model-attributes.objtxt delete mode 100644 test/core/Inputs/code-model-attributes2.objtxt delete mode 100644 test/core/Inputs/code-model-attributes3.objtxt delete mode 100644 test/core/Inputs/code-model-attributes4.objtxt delete mode 100644 test/core/Inputs/code-model-attributes5.objtxt delete mode 100644 test/core/Inputs/constants-coalesce.objtxt delete mode 100644 test/core/Inputs/constants-coalesce2.objtxt delete mode 100644 test/core/Inputs/cstring-coalesce.objtxt delete mode 100644 test/core/Inputs/cstring-coalesce2.objtxt delete mode 100644 test/core/Inputs/custom-section-coalesce.objtxt delete mode 100644 test/core/Inputs/custom-section-coalesce2.objtxt delete mode 100644 test/core/Inputs/dead-strip-attributes.objtxt delete mode 100644 test/core/Inputs/dead-strip-attributes2.objtxt delete mode 100644 test/core/Inputs/dead-strip-basic.objtxt delete mode 100644 test/core/Inputs/dead-strip-basic2.objtxt delete mode 100644 test/core/Inputs/dead-strip-globals.objtxt delete mode 100644 test/core/Inputs/dead-strip-globals2.objtxt delete mode 100644 test/core/Inputs/error-duplicate-absolutes.objtxt delete mode 100644 test/core/Inputs/gnulinkonce-rearrange-resolve.objtxt delete mode 100644 test/core/Inputs/gnulinkonce-remaining-undef.objtxt delete mode 100644 test/core/Inputs/gnulinkonce-remaining-undef2.objtxt delete mode 100644 test/core/Inputs/gnulinkonce-resolve.objtxt delete mode 100644 test/core/Inputs/gnulinkonce-simple.objtxt delete mode 100644 test/core/Inputs/inline-coalesce.objtxt delete mode 100644 test/core/Inputs/inline-coalesce2.objtxt delete mode 100644 test/core/Inputs/multiple-def-error.objtxt delete mode 100644 test/core/Inputs/sectiongroup-deadstrip.objtxt delete mode 100644 test/core/Inputs/sectiongroup-gnulinkonce-error.objtxt delete mode 100644 test/core/Inputs/sectiongroup-rearrange-resolve.objtxt delete mode 100644 test/core/Inputs/sectiongroup-remaining-undef.objtxt delete mode 100644 test/core/Inputs/sectiongroup-remaining-undef2.objtxt delete mode 100644 test/core/Inputs/sectiongroup-resolve.objtxt delete mode 100644 test/core/Inputs/sectiongroup-simple.objtxt delete mode 100644 test/core/Inputs/shared-library-coalesce.objtxt delete mode 100644 test/core/Inputs/tent-merge.objtxt delete mode 100644 test/core/Inputs/undef-coalesce-error.objtxt delete mode 100644 test/core/Inputs/undef-coalesce-error2.objtxt delete mode 100644 test/core/Inputs/undef-coalesce.objtxt delete mode 100644 test/core/Inputs/undef-coalesce2.objtxt delete mode 100644 test/core/Inputs/undef-fallback.objtxt delete mode 100644 test/core/Inputs/undef-weak-coalesce.objtxt delete mode 100644 test/core/Inputs/weak-coalesce.objtxt delete mode 100644 test/core/Inputs/weak-coalesce2.objtxt delete mode 100644 test/core/absolute-basic.objtxt delete mode 100644 test/core/absolute-local.objtxt delete mode 100644 test/core/archive-basic.objtxt delete mode 100644 test/core/archive-chain.objtxt delete mode 100644 test/core/archive-tentdef-search.objtxt delete mode 100644 test/core/associates.objtxt delete mode 100644 test/core/auto-hide-coalesce.objtxt delete mode 100644 test/core/code-model-attributes.objtxt delete mode 100644 test/core/constants-coalesce.objtxt delete mode 100644 test/core/cstring-coalesce.objtxt delete mode 100644 test/core/custom-section-coalesce.objtxt delete mode 100644 test/core/custom-section.objtxt delete mode 100644 test/core/dead-strip-attributes.objtxt delete mode 100644 test/core/dead-strip-basic.objtxt delete mode 100644 test/core/dead-strip-globals.objtxt delete mode 100644 test/core/dead-strip-reverse.objtxt delete mode 100644 test/core/error-atom-attribute.objtxt delete mode 100644 test/core/error-atom-content-byte-value.objtxt delete mode 100644 test/core/error-atom-content-bytes.objtxt delete mode 100644 test/core/error-atom-type.objtxt delete mode 100644 test/core/error-atom-undefined-wrong-attribue.objtxt delete mode 100644 test/core/error-duplicate-absolutes.objtxt delete mode 100644 test/core/error-file-attribute.objtxt delete mode 100644 test/core/error-fixup-attribute.objtxt delete mode 100644 test/core/error-fixup-target.objtxt delete mode 100644 test/core/fixups-addend.objtxt delete mode 100644 test/core/fixups-dup-named.objtxt delete mode 100644 test/core/fixups-named.objtxt delete mode 100644 test/core/fixups-unnamed.objtxt delete mode 100644 test/core/gnulinkonce-rearrange-resolve.objtxt delete mode 100644 test/core/gnulinkonce-remaining-undef.objtxt delete mode 100644 test/core/gnulinkonce-resolve.objtxt delete mode 100644 test/core/gnulinkonce-simple.objtxt delete mode 100644 test/core/inline-coalesce.objtxt delete mode 100644 test/core/multiple-def-error.objtxt delete mode 100644 test/core/permissions.objtxt delete mode 100644 test/core/sectiongroup-deadstrip.objtxt delete mode 100644 test/core/sectiongroup-gnulinkonce-error.objtxt delete mode 100644 test/core/sectiongroup-rearrange-resolve.objtxt delete mode 100644 test/core/sectiongroup-remaining-undef.objtxt delete mode 100644 test/core/sectiongroup-resolve.objtxt delete mode 100644 test/core/sectiongroup-simple.objtxt delete mode 100644 test/core/shared-library-basic.objtxt delete mode 100644 test/core/shared-library-coalesce.objtxt delete mode 100644 test/core/tent-merge.objtxt delete mode 100644 test/core/undef-coalesce-error.objtxt delete mode 100644 test/core/undef-coalesce.objtxt delete mode 100644 test/core/undef-fallback.objtxt delete mode 100644 test/core/undef-weak-coalesce.objtxt delete mode 100644 test/core/weak-coalesce.objtxt create mode 100644 test/darwin/cmdline-objc_gc.objtxt create mode 100644 test/darwin/cmdline-objc_gc_compaction.objtxt create mode 100644 test/darwin/cmdline-objc_gc_only.objtxt create mode 100644 test/mach-o/Inputs/no-version-min-load-command-object.yaml create mode 100644 test/mach-o/Inputs/swift-version-1.yaml create mode 100644 test/mach-o/data-in-code-load-command.yaml create mode 100644 test/mach-o/dead-strip-globals.yaml create mode 100644 test/mach-o/eh-frame-relocs-arm64.yaml create mode 100644 test/mach-o/error-simulator-vs-macosx.yaml create mode 100644 test/mach-o/function-starts-load-command.yaml create mode 100644 test/mach-o/mach_header-cpusubtype.yaml create mode 100644 test/mach-o/objc-category-list-atom.yaml create mode 100644 test/mach-o/objc-image-info-host-vs-simulator.yaml create mode 100644 test/mach-o/objc-image-info-invalid-size.yaml create mode 100644 test/mach-o/objc-image-info-invalid-version.yaml create mode 100644 test/mach-o/objc-image-info-mismatched-swift-version.yaml create mode 100644 test/mach-o/objc-image-info-pass-output.yaml create mode 100644 test/mach-o/objc-image-info-simulator-vs-host.yaml create mode 100644 test/mach-o/objc-image-info-unsupported-gc.yaml create mode 100644 test/mach-o/sdk-version-error.yaml create mode 100644 test/mach-o/sectattrs.yaml create mode 100644 test/mach-o/seg-protection-arm64.yaml create mode 100644 test/mach-o/seg-protection-x86_64.yaml create mode 100644 test/mach-o/source-version.yaml create mode 100644 test/mach-o/subsections-via-symbols-default.yaml create mode 100644 test/mach-o/version-min-load-command-object.yaml create mode 100644 test/mach-o/version-min-load-command.yaml delete mode 100644 test/old-elf/AArch64/Inputs/fn.c delete mode 100644 test/old-elf/AArch64/Inputs/fn.o delete mode 100644 test/old-elf/AArch64/Inputs/general-dyn-tls-0.yaml delete mode 100644 test/old-elf/AArch64/Inputs/initfini-option.c delete mode 100644 test/old-elf/AArch64/Inputs/initfini-option.o delete mode 100644 test/old-elf/AArch64/Inputs/initfini.c delete mode 100644 test/old-elf/AArch64/Inputs/initfini.o delete mode 100644 test/old-elf/AArch64/Inputs/initial-exec-tls-1.yaml delete mode 100644 test/old-elf/AArch64/Inputs/main.c delete mode 100644 test/old-elf/AArch64/Inputs/main.o delete mode 100644 test/old-elf/AArch64/Inputs/no-interp-section.c delete mode 100644 test/old-elf/AArch64/Inputs/no-interp-section.o delete mode 100644 test/old-elf/AArch64/Inputs/zerosizedsection.o delete mode 100644 test/old-elf/AArch64/Inputs/zerosizedsection.s delete mode 100644 test/old-elf/AArch64/defsym.test delete mode 100644 test/old-elf/AArch64/dontignorezerosize-sections.test delete mode 100644 test/old-elf/AArch64/dynamicvars.test delete mode 100644 test/old-elf/AArch64/dynlib-nointerp-section.test delete mode 100644 test/old-elf/AArch64/general-dyn-tls-0.test delete mode 100644 test/old-elf/AArch64/initfini.test delete mode 100644 test/old-elf/AArch64/initial-exec-tls-0.test delete mode 100644 test/old-elf/AArch64/local-tls.test delete mode 100644 test/old-elf/AArch64/rel-abs16-overflow.test delete mode 100644 test/old-elf/AArch64/rel-abs16.test delete mode 100644 test/old-elf/AArch64/rel-abs32-overflow.test delete mode 100644 test/old-elf/AArch64/rel-abs32.test delete mode 100644 test/old-elf/AArch64/rel-abs64.test delete mode 100644 test/old-elf/AArch64/rel-adr_prel_lo21-overflow.test delete mode 100644 test/old-elf/AArch64/rel-adr_prel_lo21.test delete mode 100644 test/old-elf/AArch64/rel-adr_prel_pg_hi21-overflow.test delete mode 100644 test/old-elf/AArch64/rel-adr_prel_pg_hi21.test delete mode 100644 test/old-elf/AArch64/rel-bad.test delete mode 100644 test/old-elf/AArch64/rel-prel16-overflow.test delete mode 100644 test/old-elf/AArch64/rel-prel16.test delete mode 100644 test/old-elf/AArch64/rel-prel32-overflow.test delete mode 100644 test/old-elf/AArch64/rel-prel32.test delete mode 100644 test/old-elf/AArch64/rel-prel64.test delete mode 100644 test/old-elf/ARM/Inputs/fn.c delete mode 100755 test/old-elf/ARM/Inputs/libfn.so delete mode 100755 test/old-elf/ARM/Inputs/libobj.so delete mode 100644 test/old-elf/ARM/Inputs/obj.c delete mode 100644 test/old-elf/ARM/arm-symbols.test delete mode 100644 test/old-elf/ARM/defsym.test delete mode 100644 test/old-elf/ARM/dynamic-symbols.test delete mode 100644 test/old-elf/ARM/entry-point.test delete mode 100644 test/old-elf/ARM/exidx.test delete mode 100644 test/old-elf/ARM/header-flags.test delete mode 100644 test/old-elf/ARM/mapping-code-model.test delete mode 100644 test/old-elf/ARM/mapping-symbols.test delete mode 100644 test/old-elf/ARM/missing-symbol.test delete mode 100644 test/old-elf/ARM/plt-dynamic.test delete mode 100644 test/old-elf/ARM/plt-ifunc-interwork.test delete mode 100644 test/old-elf/ARM/plt-ifunc-mapping.test delete mode 100644 test/old-elf/ARM/rel-abs32.test delete mode 100644 test/old-elf/ARM/rel-arm-call.test delete mode 100644 test/old-elf/ARM/rel-arm-jump24-veneer-b.test delete mode 100644 test/old-elf/ARM/rel-arm-jump24-veneer-bl.test delete mode 100644 test/old-elf/ARM/rel-arm-jump24.test delete mode 100644 test/old-elf/ARM/rel-arm-mov.test delete mode 100644 test/old-elf/ARM/rel-arm-prel31.test delete mode 100644 test/old-elf/ARM/rel-arm-target1.test delete mode 100644 test/old-elf/ARM/rel-arm-thm-interwork.test delete mode 100644 test/old-elf/ARM/rel-base-prel.test delete mode 100644 test/old-elf/ARM/rel-copy.test delete mode 100644 test/old-elf/ARM/rel-glob-dat.test delete mode 100644 test/old-elf/ARM/rel-got-brel.test delete mode 100644 test/old-elf/ARM/rel-group-relocs.test delete mode 100644 test/old-elf/ARM/rel-ifunc.test delete mode 100644 test/old-elf/ARM/rel-jump-slot.test delete mode 100644 test/old-elf/ARM/rel-rel32.test delete mode 100644 test/old-elf/ARM/rel-thm-call.test delete mode 100644 test/old-elf/ARM/rel-thm-jump11.test delete mode 100644 test/old-elf/ARM/rel-thm-jump24-veneer.test delete mode 100644 test/old-elf/ARM/rel-thm-jump24.test delete mode 100644 test/old-elf/ARM/rel-thm-mov.test delete mode 100644 test/old-elf/ARM/rel-tls-ie32.test delete mode 100644 test/old-elf/ARM/rel-tls-le32.test delete mode 100644 test/old-elf/ARM/rel-v4bx.test delete mode 100644 test/old-elf/ARM/thm-symbols.test delete mode 100644 test/old-elf/ARM/two-got-for-symbol.test delete mode 100644 test/old-elf/ARM/undef-lazy-symbol.test delete mode 100644 test/old-elf/ARM/veneer-mapping.test delete mode 100644 test/old-elf/ARM/weak-branch.test delete mode 100644 test/old-elf/Hexagon/Inputs/dynobj-data.c delete mode 100644 test/old-elf/Hexagon/Inputs/dynobj-data.o delete mode 100644 test/old-elf/Hexagon/Inputs/dynobj.c delete mode 100644 test/old-elf/Hexagon/Inputs/dynobj.o delete mode 100644 test/old-elf/Hexagon/Inputs/got-plt-order.c delete mode 100644 test/old-elf/Hexagon/Inputs/got-plt-order.o delete mode 100644 test/old-elf/Hexagon/Inputs/libMaxAlignment.a delete mode 100644 test/old-elf/Hexagon/Inputs/sda-base.o delete mode 100644 test/old-elf/Hexagon/Inputs/sdata1.c delete mode 100644 test/old-elf/Hexagon/Inputs/sdata1.o delete mode 100644 test/old-elf/Hexagon/Inputs/sdata2.c delete mode 100644 test/old-elf/Hexagon/Inputs/sdata2.o delete mode 100644 test/old-elf/Hexagon/Inputs/use-shared.hexagon delete mode 100644 test/old-elf/Hexagon/dynlib-data.test delete mode 100644 test/old-elf/Hexagon/dynlib-gotoff.test delete mode 100644 test/old-elf/Hexagon/dynlib-hash.test delete mode 100644 test/old-elf/Hexagon/dynlib-rela.test delete mode 100644 test/old-elf/Hexagon/dynlib-syms.test delete mode 100644 test/old-elf/Hexagon/dynlib.test delete mode 100644 test/old-elf/Hexagon/hexagon-got-plt-order.test delete mode 100644 test/old-elf/Hexagon/hexagon-plt-setup.test delete mode 100644 test/old-elf/Hexagon/maxalignment.test delete mode 100644 test/old-elf/Hexagon/rela-order.test delete mode 100644 test/old-elf/Hexagon/sda-base.test delete mode 100644 test/old-elf/Hexagon/zerofillquick-sdata.test delete mode 100644 test/old-elf/Inputs/abs-test.i386 delete mode 100644 test/old-elf/Inputs/allowduplicates.objtxt delete mode 100644 test/old-elf/Inputs/bar.o.x86-64 delete mode 100644 test/old-elf/Inputs/branch-test.hexagon delete mode 100644 test/old-elf/Inputs/branch-test.ppc delete mode 100644 test/old-elf/Inputs/consecutive-weak-defs.o.yaml delete mode 100644 test/old-elf/Inputs/constants-merge.x86-64 delete mode 100644 test/old-elf/Inputs/constdata.x86-64 delete mode 100644 test/old-elf/Inputs/foo.o.x86-64 delete mode 100644 test/old-elf/Inputs/globalconst.c delete mode 100644 test/old-elf/Inputs/globalconst.o.x86-64 delete mode 100644 test/old-elf/Inputs/gotpcrel.S delete mode 100644 test/old-elf/Inputs/gotpcrel.x86-64 delete mode 100644 test/old-elf/Inputs/group-cmd-search-1.ls delete mode 100644 test/old-elf/Inputs/group-cmd-search-2.ls delete mode 100644 test/old-elf/Inputs/group-cmd-search-3.ls delete mode 100644 test/old-elf/Inputs/ifunc.S delete mode 100644 test/old-elf/Inputs/ifunc.cpp delete mode 100644 test/old-elf/Inputs/ifunc.cpp.x86-64 delete mode 100644 test/old-elf/Inputs/ifunc.x86-64 delete mode 100644 test/old-elf/Inputs/libfnarchive.a delete mode 100644 test/old-elf/Inputs/libifunc.x86-64.so delete mode 100644 test/old-elf/Inputs/libundef.so delete mode 100755 test/old-elf/Inputs/libweaksym.so delete mode 100644 test/old-elf/Inputs/main-with-global-def.o.yaml delete mode 100644 test/old-elf/Inputs/mainobj.x86_64 delete mode 100644 test/old-elf/Inputs/no-unique-section-names.x86-64 delete mode 100644 test/old-elf/Inputs/object-test.elf-hexagon delete mode 100644 test/old-elf/Inputs/object-test.elf-i386 delete mode 100644 test/old-elf/Inputs/phdr.i386 delete mode 100644 test/old-elf/Inputs/quickdata-sort-test.o.elf-hexagon delete mode 100644 test/old-elf/Inputs/quickdata-sortcommon-test.o.elf-hexagon delete mode 100644 test/old-elf/Inputs/quickdata-test.elf-hexagon delete mode 100644 test/old-elf/Inputs/reloc-test.elf-i386 delete mode 100644 test/old-elf/Inputs/reloc-xb.x86 delete mode 100644 test/old-elf/Inputs/reloc-xt.x86 delete mode 100644 test/old-elf/Inputs/relocs-dynamic.x86-64 delete mode 100644 test/old-elf/Inputs/relocs.x86-64 delete mode 100644 test/old-elf/Inputs/responsefile delete mode 100644 test/old-elf/Inputs/rodata-test.hexagon delete mode 100644 test/old-elf/Inputs/rodata-test.i386 delete mode 100644 test/old-elf/Inputs/rodata.c delete mode 100644 test/old-elf/Inputs/rodata.o delete mode 100644 test/old-elf/Inputs/section-test.i386 delete mode 100644 test/old-elf/Inputs/shared.c delete mode 100644 test/old-elf/Inputs/shared.so-x86-64 delete mode 100644 test/old-elf/Inputs/shndx.o-x86_64 delete mode 100644 test/old-elf/Inputs/stripped-empty.x86_64 delete mode 100644 test/old-elf/Inputs/target-test.hexagon delete mode 100644 test/old-elf/Inputs/target-test.ppc delete mode 100644 test/old-elf/Inputs/tls-tbss-size.yaml delete mode 100644 test/old-elf/Inputs/tls.S delete mode 100644 test/old-elf/Inputs/tls.c delete mode 100644 test/old-elf/Inputs/tls.x86-64 delete mode 100644 test/old-elf/Inputs/tlsAddr.x86-64 delete mode 100644 test/old-elf/Inputs/tlsaddr.c delete mode 100644 test/old-elf/Inputs/undef-from-main-so.c delete mode 100644 test/old-elf/Inputs/undef-from-main.c delete mode 100644 test/old-elf/Inputs/undef-pc32.o delete mode 100644 test/old-elf/Inputs/undef.o delete mode 100644 test/old-elf/Inputs/undef2-so.o.yaml delete mode 100644 test/old-elf/Inputs/use-shared-32s.c delete mode 100644 test/old-elf/Inputs/use-shared-32s.x86-64 delete mode 100644 test/old-elf/Inputs/use-shared.c delete mode 100644 test/old-elf/Inputs/use-shared.x86-64 delete mode 100644 test/old-elf/Inputs/weaksym.o delete mode 100644 test/old-elf/Inputs/writersyms.o delete mode 100644 test/old-elf/Inputs/x86-64-relocs.S delete mode 100644 test/old-elf/Mips/abi-flags-01.test delete mode 100644 test/old-elf/Mips/abi-flags-02.test delete mode 100644 test/old-elf/Mips/abi-flags-03.test delete mode 100644 test/old-elf/Mips/abi-flags-04.test delete mode 100644 test/old-elf/Mips/abi-flags-05.test delete mode 100644 test/old-elf/Mips/abi-flags-06.test delete mode 100644 test/old-elf/Mips/abi-flags-07.test delete mode 100644 test/old-elf/Mips/abi-flags-08.test delete mode 100644 test/old-elf/Mips/abi-flags-09.test delete mode 100644 test/old-elf/Mips/abi-flags-10.test delete mode 100644 test/old-elf/Mips/abi-flags-11.test delete mode 100644 test/old-elf/Mips/base-address-64.test delete mode 100644 test/old-elf/Mips/base-address.test delete mode 100644 test/old-elf/Mips/ctors-order.test delete mode 100644 test/old-elf/Mips/driver-hash-style.test delete mode 100644 test/old-elf/Mips/dt-textrel-64.test delete mode 100644 test/old-elf/Mips/dt-textrel.test delete mode 100644 test/old-elf/Mips/dynamic-linking.test delete mode 100644 test/old-elf/Mips/dynamic-sym.test delete mode 100644 test/old-elf/Mips/dynlib-dynamic.test delete mode 100644 test/old-elf/Mips/dynlib-dynsym-micro.test delete mode 100644 test/old-elf/Mips/dynlib-dynsym.test delete mode 100644 test/old-elf/Mips/dynlib-fileheader-64.test delete mode 100644 test/old-elf/Mips/dynlib-fileheader-micro-64.test delete mode 100644 test/old-elf/Mips/dynlib-fileheader-micro.test delete mode 100644 test/old-elf/Mips/dynlib-fileheader.test delete mode 100644 test/old-elf/Mips/dynsym-table-1.test delete mode 100644 test/old-elf/Mips/dynsym-table-2.test delete mode 100644 test/old-elf/Mips/e-flags-merge-1-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-1.test delete mode 100644 test/old-elf/Mips/e-flags-merge-10.test delete mode 100644 test/old-elf/Mips/e-flags-merge-11.test delete mode 100644 test/old-elf/Mips/e-flags-merge-12.test delete mode 100644 test/old-elf/Mips/e-flags-merge-2-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-2.test delete mode 100644 test/old-elf/Mips/e-flags-merge-3-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-3.test delete mode 100644 test/old-elf/Mips/e-flags-merge-4-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-4.test delete mode 100644 test/old-elf/Mips/e-flags-merge-5-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-5.test delete mode 100644 test/old-elf/Mips/e-flags-merge-6-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-6.test delete mode 100644 test/old-elf/Mips/e-flags-merge-7-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-7.test delete mode 100644 test/old-elf/Mips/e-flags-merge-8.test delete mode 100644 test/old-elf/Mips/e-flags-merge-9.test delete mode 100644 test/old-elf/Mips/entry-name.test delete mode 100644 test/old-elf/Mips/exe-dynamic.test delete mode 100644 test/old-elf/Mips/exe-dynsym-micro.test delete mode 100644 test/old-elf/Mips/exe-dynsym.test delete mode 100644 test/old-elf/Mips/exe-fileheader-02.test delete mode 100644 test/old-elf/Mips/exe-fileheader-03.test delete mode 100644 test/old-elf/Mips/exe-fileheader-64.test delete mode 100644 test/old-elf/Mips/exe-fileheader-be-64.test delete mode 100644 test/old-elf/Mips/exe-fileheader-be.test delete mode 100644 test/old-elf/Mips/exe-fileheader-micro-64.test delete mode 100644 test/old-elf/Mips/exe-fileheader-micro.test delete mode 100644 test/old-elf/Mips/exe-fileheader-n32.test delete mode 100644 test/old-elf/Mips/exe-fileheader.test delete mode 100644 test/old-elf/Mips/exe-got-micro.test delete mode 100644 test/old-elf/Mips/exe-got.test delete mode 100644 test/old-elf/Mips/got-page-32-micro.test delete mode 100644 test/old-elf/Mips/got-page-32.test delete mode 100644 test/old-elf/Mips/got-page-64-micro.test delete mode 100644 test/old-elf/Mips/got-page-64.test delete mode 100644 test/old-elf/Mips/got16-2.test delete mode 100644 test/old-elf/Mips/got16-micro.test delete mode 100644 test/old-elf/Mips/got16.test delete mode 100644 test/old-elf/Mips/gotsym.test delete mode 100644 test/old-elf/Mips/gp-sym-1-micro.test delete mode 100644 test/old-elf/Mips/gp-sym-1.test delete mode 100644 test/old-elf/Mips/gp-sym-2.test delete mode 100644 test/old-elf/Mips/hilo16-1.test delete mode 100644 test/old-elf/Mips/hilo16-2.test delete mode 100644 test/old-elf/Mips/hilo16-3-overflow.test delete mode 100644 test/old-elf/Mips/hilo16-3.test delete mode 100644 test/old-elf/Mips/hilo16-4.test delete mode 100644 test/old-elf/Mips/hilo16-5.test delete mode 100644 test/old-elf/Mips/hilo16-8-micro.test delete mode 100644 test/old-elf/Mips/hilo16-9-micro.test delete mode 100644 test/old-elf/Mips/initfini-micro.test delete mode 100644 test/old-elf/Mips/interpreter-64.test delete mode 100644 test/old-elf/Mips/interpreter-n32.test delete mode 100644 test/old-elf/Mips/interpreter.test delete mode 100644 test/old-elf/Mips/invalid-reginfo.test delete mode 100644 test/old-elf/Mips/jalx-align-err.test delete mode 100644 test/old-elf/Mips/jalx-jalr.test delete mode 100644 test/old-elf/Mips/jalx.test delete mode 100644 test/old-elf/Mips/jump-fix-err.test delete mode 100644 test/old-elf/Mips/la25-stub-be.test delete mode 100644 test/old-elf/Mips/la25-stub-micro-be.test delete mode 100644 test/old-elf/Mips/la25-stub-micro.test delete mode 100644 test/old-elf/Mips/la25-stub-npic-01.test delete mode 100644 test/old-elf/Mips/la25-stub-npic-02.test delete mode 100644 test/old-elf/Mips/la25-stub-npic-shared.test delete mode 100644 test/old-elf/Mips/la25-stub-pic.test delete mode 100644 test/old-elf/Mips/la25-stub.test delete mode 100644 test/old-elf/Mips/mips-options-01.test delete mode 100644 test/old-elf/Mips/mips-options-02.test delete mode 100644 test/old-elf/Mips/mips-options-03.test delete mode 100644 test/old-elf/Mips/mips-options-04.test delete mode 100644 test/old-elf/Mips/mips-options-05.test delete mode 100644 test/old-elf/Mips/mips-options-gp0.test delete mode 100644 test/old-elf/Mips/n32-rela-chain.test delete mode 100644 test/old-elf/Mips/n64-rel-chain.test delete mode 100644 test/old-elf/Mips/n64-rel-shift.test delete mode 100644 test/old-elf/Mips/opt-emulation.test delete mode 100644 test/old-elf/Mips/pc23-range.test delete mode 100644 test/old-elf/Mips/plt-entry-mixed-1.test delete mode 100644 test/old-elf/Mips/plt-entry-mixed-2.test delete mode 100644 test/old-elf/Mips/plt-entry-mixed-3.test delete mode 100644 test/old-elf/Mips/plt-entry-mixed-4.test delete mode 100644 test/old-elf/Mips/plt-entry-r6-be.test delete mode 100644 test/old-elf/Mips/plt-entry-r6.test delete mode 100644 test/old-elf/Mips/plt-header-be.test delete mode 100644 test/old-elf/Mips/plt-header-micro-be.test delete mode 100644 test/old-elf/Mips/plt-header-micro.test delete mode 100644 test/old-elf/Mips/plt-header-mixed.test delete mode 100644 test/old-elf/Mips/plt-header.test delete mode 100644 test/old-elf/Mips/r26-1-micro.test delete mode 100644 test/old-elf/Mips/r26-1.test delete mode 100644 test/old-elf/Mips/r26-2-micro.test delete mode 100644 test/old-elf/Mips/r26-2.test delete mode 100644 test/old-elf/Mips/reginfo-01.test delete mode 100644 test/old-elf/Mips/reginfo-02.test delete mode 100644 test/old-elf/Mips/reginfo-03.test delete mode 100644 test/old-elf/Mips/reginfo-04.test delete mode 100644 test/old-elf/Mips/reginfo-05.test delete mode 100644 test/old-elf/Mips/rel-16-overflow.test delete mode 100644 test/old-elf/Mips/rel-16.test delete mode 100644 test/old-elf/Mips/rel-32-be.test delete mode 100644 test/old-elf/Mips/rel-32.test delete mode 100644 test/old-elf/Mips/rel-64.test delete mode 100644 test/old-elf/Mips/rel-call-hilo-01.test delete mode 100644 test/old-elf/Mips/rel-call-hilo-micro.test delete mode 100644 test/old-elf/Mips/rel-copy-micro.test delete mode 100644 test/old-elf/Mips/rel-copy-pc.test delete mode 100644 test/old-elf/Mips/rel-copy.test delete mode 100644 test/old-elf/Mips/rel-dynamic-01-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-01.test delete mode 100644 test/old-elf/Mips/rel-dynamic-02.test delete mode 100644 test/old-elf/Mips/rel-dynamic-03-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-03.test delete mode 100644 test/old-elf/Mips/rel-dynamic-04-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-04.test delete mode 100644 test/old-elf/Mips/rel-dynamic-05-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-05.test delete mode 100644 test/old-elf/Mips/rel-dynamic-06-64.test delete mode 100644 test/old-elf/Mips/rel-dynamic-06.test delete mode 100644 test/old-elf/Mips/rel-dynamic-07-64.test delete mode 100644 test/old-elf/Mips/rel-dynamic-07.test delete mode 100644 test/old-elf/Mips/rel-dynamic-08-64.test delete mode 100644 test/old-elf/Mips/rel-dynamic-08-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-08.test delete mode 100644 test/old-elf/Mips/rel-dynamic-09-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-09.test delete mode 100644 test/old-elf/Mips/rel-dynamic-10-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-10.test delete mode 100644 test/old-elf/Mips/rel-dynamic-11.test delete mode 100644 test/old-elf/Mips/rel-dynamic-12.test delete mode 100644 test/old-elf/Mips/rel-dynamic-13.test delete mode 100644 test/old-elf/Mips/rel-dynamic-14.test delete mode 100644 test/old-elf/Mips/rel-dynamic-15.test delete mode 100644 test/old-elf/Mips/rel-eh-01.test delete mode 100644 test/old-elf/Mips/rel-eh-02.test delete mode 100644 test/old-elf/Mips/rel-eh-03.test delete mode 100644 test/old-elf/Mips/rel-got-hilo-01.test delete mode 100644 test/old-elf/Mips/rel-got-hilo-micro.test delete mode 100644 test/old-elf/Mips/rel-gprel16-micro-overflow.test delete mode 100644 test/old-elf/Mips/rel-gprel16-micro.test delete mode 100644 test/old-elf/Mips/rel-gprel16-overflow.test delete mode 100644 test/old-elf/Mips/rel-gprel16.test delete mode 100644 test/old-elf/Mips/rel-gprel32-64.test delete mode 100644 test/old-elf/Mips/rel-gprel32.test delete mode 100644 test/old-elf/Mips/rel-gprel7-micro-overflow.test delete mode 100644 test/old-elf/Mips/rel-gprel7-micro.test delete mode 100644 test/old-elf/Mips/rel-hi0-lo16-micro.test delete mode 100644 test/old-elf/Mips/rel-high-01.test delete mode 100644 test/old-elf/Mips/rel-high-02.test delete mode 100644 test/old-elf/Mips/rel-jalr-01.test delete mode 100644 test/old-elf/Mips/rel-jalr-02.test delete mode 100644 test/old-elf/Mips/rel-lit-micro.test delete mode 100644 test/old-elf/Mips/rel-lit.test delete mode 100644 test/old-elf/Mips/rel-pc-hilo.test delete mode 100644 test/old-elf/Mips/rel-pc16-align.test delete mode 100644 test/old-elf/Mips/rel-pc16-overflow.test delete mode 100644 test/old-elf/Mips/rel-pc16.test delete mode 100644 test/old-elf/Mips/rel-pc18-s3-align.test delete mode 100644 test/old-elf/Mips/rel-pc18-s3-micro.test delete mode 100644 test/old-elf/Mips/rel-pc18-s3.test delete mode 100644 test/old-elf/Mips/rel-pc19-s2-align.test delete mode 100644 test/old-elf/Mips/rel-pc19-s2-micro.test delete mode 100644 test/old-elf/Mips/rel-pc19-s2.test delete mode 100644 test/old-elf/Mips/rel-pc21-s2-align.test delete mode 100644 test/old-elf/Mips/rel-pc21-s2-micro.test delete mode 100644 test/old-elf/Mips/rel-pc21-s2-overflow.test delete mode 100644 test/old-elf/Mips/rel-pc21-s2.test delete mode 100644 test/old-elf/Mips/rel-pc26-s2-align.test delete mode 100644 test/old-elf/Mips/rel-pc26-s2-micro.test delete mode 100644 test/old-elf/Mips/rel-pc26-s2.test delete mode 100644 test/old-elf/Mips/rel-pc32.test delete mode 100644 test/old-elf/Mips/rel-pc7-10-16-23.test delete mode 100644 test/old-elf/Mips/rel-sub-micro.test delete mode 100644 test/old-elf/Mips/rel-sub.test delete mode 100644 test/old-elf/Mips/rld_map.test delete mode 100644 test/old-elf/Mips/sign-rela.test delete mode 100644 test/old-elf/Mips/st-other.test delete mode 100644 test/old-elf/Mips/static-01.test delete mode 100644 test/old-elf/Mips/tls-1-micro.test delete mode 100644 test/old-elf/Mips/tls-1.test delete mode 100644 test/old-elf/Mips/tls-2-64-static.test delete mode 100644 test/old-elf/Mips/tls-2-64.test delete mode 100644 test/old-elf/Mips/tls-2-micro.test delete mode 100644 test/old-elf/Mips/tls-2-static.test delete mode 100644 test/old-elf/Mips/tls-2.test delete mode 100644 test/old-elf/Mips/tls-3-64-static.test delete mode 100644 test/old-elf/Mips/tls-3-micro.test delete mode 100644 test/old-elf/Mips/tls-3-static.test delete mode 100644 test/old-elf/Mips/tls-3.test delete mode 100644 test/old-elf/Mips/tls-4-64-static.test delete mode 100644 test/old-elf/Mips/tls-4-micro.test delete mode 100644 test/old-elf/Mips/tls-4-static.test delete mode 100644 test/old-elf/Mips/tls-4.test delete mode 100644 test/old-elf/Mips/tls-5-64.test delete mode 100644 test/old-elf/Mips/tls-5-micro.test delete mode 100644 test/old-elf/Mips/tls-5.test delete mode 100644 test/old-elf/Mips/validate-rel-01.test delete mode 100644 test/old-elf/Mips/validate-rel-03.test delete mode 100644 test/old-elf/X86_64/ExampleTarget/triple.test delete mode 100644 test/old-elf/X86_64/Inputs/constint.c delete mode 100644 test/old-elf/X86_64/Inputs/constint.o delete mode 100644 test/old-elf/X86_64/Inputs/debug0.c delete mode 100644 test/old-elf/X86_64/Inputs/debug0.x86-64 delete mode 100644 test/old-elf/X86_64/Inputs/debug1.c delete mode 100644 test/old-elf/X86_64/Inputs/debug1.x86-64 delete mode 100644 test/old-elf/X86_64/Inputs/externtls.c delete mode 100644 test/old-elf/X86_64/Inputs/externtls.x86-64 delete mode 100644 test/old-elf/X86_64/Inputs/fn.c delete mode 100644 test/old-elf/X86_64/Inputs/fn.o delete mode 100644 test/old-elf/X86_64/Inputs/generaltls-so.o.yaml delete mode 100644 test/old-elf/X86_64/Inputs/group/1.c delete mode 100644 test/old-elf/X86_64/Inputs/group/1.o delete mode 100644 test/old-elf/X86_64/Inputs/group/fn.c delete mode 100644 test/old-elf/X86_64/Inputs/group/fn.o delete mode 100644 test/old-elf/X86_64/Inputs/group/fn1.c delete mode 100644 test/old-elf/X86_64/Inputs/group/fn1.o delete mode 100644 test/old-elf/X86_64/Inputs/group/fn2.c delete mode 100644 test/old-elf/X86_64/Inputs/group/fn2.o delete mode 100755 test/old-elf/X86_64/Inputs/group/group.sh delete mode 100644 test/old-elf/X86_64/Inputs/group/libfn.a delete mode 100755 test/old-elf/X86_64/Inputs/group/libfn.so delete mode 100644 test/old-elf/X86_64/Inputs/group/libfn1.a delete mode 100755 test/old-elf/X86_64/Inputs/group/libfn2.so delete mode 100644 test/old-elf/X86_64/Inputs/initfini-option.c delete mode 100644 test/old-elf/X86_64/Inputs/initfini-option.o delete mode 100644 test/old-elf/X86_64/Inputs/initfini.c delete mode 100644 test/old-elf/X86_64/Inputs/initfini.o delete mode 100644 test/old-elf/X86_64/Inputs/largebss.c delete mode 100644 test/old-elf/X86_64/Inputs/largebss.o delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/1.c delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/1.o delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/2.c delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/2.o delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/3.c delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/3.o delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/lib2.a delete mode 100644 test/old-elf/X86_64/Inputs/libfn.a delete mode 100755 test/old-elf/X86_64/Inputs/libfn.so delete mode 100644 test/old-elf/X86_64/Inputs/main.c delete mode 100644 test/old-elf/X86_64/Inputs/main.o delete mode 100644 test/old-elf/X86_64/Inputs/multi-ovrd.c delete mode 100644 test/old-elf/X86_64/Inputs/multi-ovrd.o delete mode 100644 test/old-elf/X86_64/Inputs/multi-weak.c delete mode 100644 test/old-elf/X86_64/Inputs/multi-weak.o delete mode 100644 test/old-elf/X86_64/Inputs/multiweaksyms.o delete mode 100644 test/old-elf/X86_64/Inputs/nmagic.c delete mode 100644 test/old-elf/X86_64/Inputs/nmagic.o delete mode 100644 test/old-elf/X86_64/Inputs/no-interp-section.c delete mode 100644 test/old-elf/X86_64/Inputs/no-interp-section.o delete mode 100644 test/old-elf/X86_64/Inputs/note.o delete mode 100644 test/old-elf/X86_64/Inputs/note.s delete mode 100644 test/old-elf/X86_64/Inputs/note_ro_rw.o delete mode 100644 test/old-elf/X86_64/Inputs/note_ro_rw.s delete mode 100644 test/old-elf/X86_64/Inputs/ovrd.c delete mode 100644 test/old-elf/X86_64/Inputs/ovrd.o delete mode 100644 test/old-elf/X86_64/Inputs/rodata.c delete mode 100644 test/old-elf/X86_64/Inputs/rodata.o delete mode 100644 test/old-elf/X86_64/Inputs/rodata.s delete mode 100644 test/old-elf/X86_64/Inputs/rwint.c delete mode 100644 test/old-elf/X86_64/Inputs/rwint.o delete mode 100644 test/old-elf/X86_64/Inputs/sectionmap.c delete mode 100644 test/old-elf/X86_64/Inputs/sectionmap.o delete mode 100644 test/old-elf/X86_64/Inputs/undefcpp.c delete mode 100644 test/old-elf/X86_64/Inputs/undefcpp.o delete mode 100644 test/old-elf/X86_64/Inputs/weak-zero-sized.o delete mode 100644 test/old-elf/X86_64/Inputs/weak.c delete mode 100644 test/old-elf/X86_64/Inputs/weak.o delete mode 100644 test/old-elf/X86_64/Inputs/weak.s delete mode 100644 test/old-elf/X86_64/Inputs/zerosizedsection.o delete mode 100644 test/old-elf/X86_64/Inputs/zerosizedsection.s delete mode 100644 test/old-elf/X86_64/alignoffset.test delete mode 100644 test/old-elf/X86_64/debug.test delete mode 100644 test/old-elf/X86_64/defsym.test delete mode 100644 test/old-elf/X86_64/demangle.test delete mode 100644 test/old-elf/X86_64/dontignorezerosize-sections.test delete mode 100644 test/old-elf/X86_64/dynamicvars.test delete mode 100644 test/old-elf/X86_64/dynlib-nointerp-section.test delete mode 100644 test/old-elf/X86_64/dynlib-search.test delete mode 100644 test/old-elf/X86_64/dynsym-weak.test delete mode 100644 test/old-elf/X86_64/extern-tls.test delete mode 100644 test/old-elf/X86_64/general-dynamic-tls.test delete mode 100644 test/old-elf/X86_64/imagebase.test delete mode 100644 test/old-elf/X86_64/initfini-order.test delete mode 100644 test/old-elf/X86_64/initfini.test delete mode 100644 test/old-elf/X86_64/largebss.test delete mode 100644 test/old-elf/X86_64/layoutpass-order.test delete mode 100644 test/old-elf/X86_64/maxpagesize.test delete mode 100644 test/old-elf/X86_64/mergesimilarstrings.test delete mode 100644 test/old-elf/X86_64/multi-weak-layout.test delete mode 100644 test/old-elf/X86_64/multi-weak-override.test delete mode 100644 test/old-elf/X86_64/multi-weak-syms-order.test delete mode 100644 test/old-elf/X86_64/nmagic.test delete mode 100644 test/old-elf/X86_64/noalignsegments.test delete mode 100644 test/old-elf/X86_64/note-sections-ro_plus_rw.test delete mode 100644 test/old-elf/X86_64/note-sections.test delete mode 100644 test/old-elf/X86_64/omagic.test delete mode 100644 test/old-elf/X86_64/outputsegments.test delete mode 100644 test/old-elf/X86_64/reloc_r_x86_64_16.test delete mode 100644 test/old-elf/X86_64/reloc_r_x86_64_pc16.test delete mode 100644 test/old-elf/X86_64/reloc_r_x86_64_pc64.test delete mode 100644 test/old-elf/X86_64/rodata.test delete mode 100644 test/old-elf/X86_64/sectionchoice.test delete mode 100644 test/old-elf/X86_64/sectionmap.test delete mode 100644 test/old-elf/X86_64/startGroupEndGroup.test delete mode 100644 test/old-elf/X86_64/startGroupEndGroupWithDynlib.test delete mode 100644 test/old-elf/X86_64/staticlib-search.test delete mode 100644 test/old-elf/X86_64/undef.test delete mode 100644 test/old-elf/X86_64/underscore-end.test delete mode 100644 test/old-elf/X86_64/weak-override.test delete mode 100644 test/old-elf/X86_64/weak-zero-sized.test delete mode 100644 test/old-elf/X86_64/weaksym.test delete mode 100644 test/old-elf/X86_64/yamlinput.test delete mode 100644 test/old-elf/abs-dup.objtxt delete mode 100644 test/old-elf/abs.test delete mode 100644 test/old-elf/allowduplicates.objtxt delete mode 100644 test/old-elf/archive-elf-forceload.test delete mode 100644 test/old-elf/archive-elf.test delete mode 100644 test/old-elf/as-needed.test delete mode 100644 test/old-elf/branch.test delete mode 100644 test/old-elf/check.test delete mode 100644 test/old-elf/checkrodata.test delete mode 100644 test/old-elf/common.test delete mode 100644 test/old-elf/consecutive-weak-sym-defs.test delete mode 100644 test/old-elf/defsym.objtxt delete mode 100644 test/old-elf/discard-all.test delete mode 100644 test/old-elf/discard-locals.test delete mode 100644 test/old-elf/dynamic-segorder.test delete mode 100644 test/old-elf/dynamic-undef.test delete mode 100644 test/old-elf/dynamic.test delete mode 100644 test/old-elf/eh_frame_hdr.test delete mode 100644 test/old-elf/entry.objtxt delete mode 100644 test/old-elf/export-dynamic.test delete mode 100644 test/old-elf/filenotfound.test delete mode 100644 test/old-elf/gnulinkonce/gnulinkonce-report-discarded-reference.test delete mode 100644 test/old-elf/gnulinkonce/gnulinkonce-report-undef.test delete mode 100644 test/old-elf/gnulinkonce/gnulinkonce.test delete mode 100644 test/old-elf/gotpcrel.test delete mode 100644 test/old-elf/gottpoff.test delete mode 100644 test/old-elf/group-cmd-search.test delete mode 100644 test/old-elf/hexagon-quickdata-sort.test delete mode 100644 test/old-elf/hexagon-quickdata-sortcommon.test delete mode 100644 test/old-elf/ifunc.test delete mode 100644 test/old-elf/ignore-unknownoption.test delete mode 100644 test/old-elf/init_array-order.test delete mode 100644 test/old-elf/init_array.test delete mode 100644 test/old-elf/initfini-options.test-1.test delete mode 100644 test/old-elf/initfini-options.test-2.test delete mode 100644 test/old-elf/initfini-options.test-3.test delete mode 100644 test/old-elf/librarynotfound.test delete mode 100644 test/old-elf/linker-as-ld.test delete mode 100644 test/old-elf/linkerscript/Inputs/externs.ls delete mode 100644 test/old-elf/linkerscript/Inputs/invalid.ls delete mode 100644 test/old-elf/linkerscript/Inputs/prog1.o.yaml delete mode 100644 test/old-elf/linkerscript/Inputs/prog2.o.yaml delete mode 100644 test/old-elf/linkerscript/Inputs/prog3.o.yaml delete mode 100644 test/old-elf/linkerscript/Inputs/simple-pic.o.yaml delete mode 100644 test/old-elf/linkerscript/Inputs/simple.o.yaml delete mode 100644 test/old-elf/linkerscript/Inputs/valid.ls delete mode 100644 test/old-elf/linkerscript/externs.objtxt delete mode 100644 test/old-elf/linkerscript/filename-with-wildcards.test delete mode 100644 test/old-elf/linkerscript/invalid-script-cli-1.test delete mode 100644 test/old-elf/linkerscript/invalid-script-cli-2.test delete mode 100644 test/old-elf/linkerscript/invalid.test delete mode 100644 test/old-elf/linkerscript/phdrs-all-none.test delete mode 100644 test/old-elf/linkerscript/phdrs-custom-none.test delete mode 100644 test/old-elf/linkerscript/phdrs-default.test delete mode 100644 test/old-elf/linkerscript/phdrs-different.test delete mode 100644 test/old-elf/linkerscript/phdrs-extra-program.test delete mode 100644 test/old-elf/linkerscript/phdrs-flags.test delete mode 100644 test/old-elf/linkerscript/phdrs-has-program.test delete mode 100644 test/old-elf/linkerscript/phdrs-invalid.test delete mode 100644 test/old-elf/linkerscript/phdrs-misplaced-program.test delete mode 100644 test/old-elf/linkerscript/phdrs-no-program.test delete mode 100644 test/old-elf/linkerscript/phdrs-one-none.test delete mode 100644 test/old-elf/linkerscript/phdrs-program-flags.test delete mode 100644 test/old-elf/linkerscript/phdrs-program-good-phdrs.test delete mode 100644 test/old-elf/linkerscript/phdrs-program-no-phdrs.test delete mode 100644 test/old-elf/linkerscript/phdrs-program-wrong-phdrs.test delete mode 100644 test/old-elf/linkerscript/phdrs-same-flags.test delete mode 100644 test/old-elf/linkerscript/phdrs-same.test delete mode 100644 test/old-elf/linkerscript/phdrs/sections-empty-phdrs.script delete mode 100644 test/old-elf/linkerscript/phdrs/sections-no-phdrs.script delete mode 100644 test/old-elf/linkerscript/phdrs/sections-none-phdrs.script delete mode 100644 test/old-elf/linkerscript/phdrs/undef-empty-phdrs.script delete mode 100644 test/old-elf/linkerscript/phdrs/undef-id-phdrs.script delete mode 100644 test/old-elf/linkerscript/phdrs/undef-no-phdrs.script delete mode 100644 test/old-elf/linkerscript/sections-order.test delete mode 100644 test/old-elf/linkerscript/sections-with-wildcards.test delete mode 100644 test/old-elf/linkerscript/symbol-definition-so.test delete mode 100644 test/old-elf/linkerscript/symbol-definition.test delete mode 100644 test/old-elf/linkerscript/valid-script-cli.objtxt delete mode 100644 test/old-elf/loginputfiles.test delete mode 100644 test/old-elf/mergeatoms.test delete mode 100644 test/old-elf/mergeconstants.test delete mode 100644 test/old-elf/mergeglobalatoms.test delete mode 100644 test/old-elf/no-unique-section-names.test delete mode 100644 test/old-elf/note.test delete mode 100644 test/old-elf/options/dynamic-linker.test delete mode 100644 test/old-elf/options/target-specific-args.test delete mode 100644 test/old-elf/phdr.test delete mode 100644 test/old-elf/quickdata.test delete mode 100644 test/old-elf/reloc.test delete mode 100644 test/old-elf/responsefile.test delete mode 100644 test/old-elf/rodata.test delete mode 100644 test/old-elf/rosegment.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-new-members.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-simple.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-undef-member-other.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-undef-member.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-with-globalsymbols.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-with-undef-external-reference.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-with-undef-signature.test delete mode 100644 test/old-elf/sections.test delete mode 100644 test/old-elf/sh_addralign.test delete mode 100644 test/old-elf/shndx.test delete mode 100644 test/old-elf/soname.test delete mode 100644 test/old-elf/start-stop-sym.test delete mode 100644 test/old-elf/strip-all.test delete mode 100644 test/old-elf/stripped-empty.test delete mode 100644 test/old-elf/symbols.test delete mode 100644 test/old-elf/tls-tbss-size.test delete mode 100644 test/old-elf/tls.test delete mode 100644 test/old-elf/tlsAddr.test delete mode 100644 test/old-elf/undef-from-dso-to-main.test delete mode 100644 test/old-elf/undef-from-main-dso.test delete mode 100644 test/old-elf/weaksym.test delete mode 100644 test/old-elf/wrap.test delete mode 100644 test/old-elf/x86-64-dynamic-relocs.test delete mode 100644 test/old-elf/x86-64-dynamic.test delete mode 100644 test/old-elf/x86.test delete mode 100644 test/old-elf/x86_64-kinds.test delete mode 100644 test/old-elf/zoption_dtflags.test delete mode 100644 tools/CMakeLists.txt delete mode 100644 tools/linker-script-test/CMakeLists.txt delete mode 100644 tools/linker-script-test/linker-script-test.cpp delete mode 100644 tools/lld/TODO.txt delete mode 100644 unittests/CoreTests/RangeTest.cpp delete mode 100644 unittests/DriverTests/DriverTest.h delete mode 100644 unittests/DriverTests/GnuLdDriverTest.cpp delete mode 100644 unittests/DriverTests/UniversalDriverTest.cpp diff --git a/.arcconfig b/.arcconfig index 787b339a9f20..ebf4a4a6f8b7 100644 --- a/.arcconfig +++ b/.arcconfig @@ -1,4 +1,4 @@ { "project_id" : "lld", - "conduit_uri" : "http://reviews.llvm.org/" + "conduit_uri" : "https://reviews.llvm.org/" } diff --git a/CMakeLists.txt b/CMakeLists.txt index 7458de08fc16..46ca748f8fac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,7 +94,7 @@ endmacro(add_lld_library) add_subdirectory(lib) -add_subdirectory(tools) +add_subdirectory(tools/lld) if (LLVM_INCLUDE_TESTS) add_subdirectory(test) diff --git a/COFF/CMakeLists.txt b/COFF/CMakeLists.txt index 3f31ba9ba1fb..3319f392efe1 100644 --- a/COFF/CMakeLists.txt +++ b/COFF/CMakeLists.txt @@ -10,6 +10,7 @@ add_lld_library(lldCOFF Error.cpp ICF.cpp InputFiles.cpp + Librarian.cpp MarkLive.cpp ModuleDef.cpp PDB.cpp @@ -28,6 +29,8 @@ add_lld_library(lldCOFF Target Option Support + + LINK_LIBS ${PTHREAD_LIB} ) add_dependencies(lldCOFF COFFOptionsTableGen) diff --git a/COFF/Chunks.cpp b/COFF/Chunks.cpp index f9f768d69866..1c1b18176aa2 100644 --- a/COFF/Chunks.cpp +++ b/COFF/Chunks.cpp @@ -34,10 +34,7 @@ SectionChunk::SectionChunk(ObjectFile *F, const coff_section *H) // 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); + Align = Header->getAlignment(); // Only COMDAT sections are subject of dead-stripping. Live = !isCOMDAT(); @@ -64,7 +61,7 @@ void SectionChunk::applyRelX64(uint8_t *Off, uint16_t Type, Defined *Sym, 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"); + fatal("unsupported relocation type"); } } @@ -79,7 +76,7 @@ void SectionChunk::applyRelX86(uint8_t *Off, uint16_t Type, Defined *Sym, 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"); + fatal("unsupported relocation type"); } } @@ -123,7 +120,7 @@ void SectionChunk::applyRelARM(uint8_t *Off, uint16_t Type, Defined *Sym, 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"); + fatal("unsupported relocation type"); } } @@ -310,7 +307,7 @@ void SEHTableChunk::writeTo(uint8_t *Buf) const { 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(align((End - Begin) * 2 + 8, 4)); + Data.resize(alignTo((End - Begin) * 2 + 8, 4)); uint8_t *P = Data.data(); write32le(P, Page); write32le(P + 4, Data.size()); diff --git a/COFF/Chunks.h b/COFF/Chunks.h index 274135516eb9..cd0e2e69ef5d 100644 --- a/COFF/Chunks.h +++ b/COFF/Chunks.h @@ -18,6 +18,7 @@ #include "llvm/ADT/iterator_range.h" #include "llvm/Object/COFF.h" #include +#include #include namespace lld { @@ -138,6 +139,7 @@ public: 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; } + ArrayRef getContents() const; void writeTo(uint8_t *Buf) const override; bool hasData() const override; uint32_t getPermissions() const override; @@ -186,8 +188,6 @@ public: uint32_t Checksum = 0; private: - ArrayRef getContents() const; - // A file this chunk was created from. ObjectFile *File; @@ -295,7 +295,7 @@ private: // functions. x86-only. class SEHTableChunk : public Chunk { public: - explicit SEHTableChunk(std::set S) : Syms(S) {} + explicit SEHTableChunk(std::set S) : Syms(std::move(S)) {} size_t getSize() const override { return Syms.size() * 4; } void writeTo(uint8_t *Buf) const override; @@ -326,10 +326,6 @@ public: uint8_t Type; }; -inline uint64_t align(uint64_t Value, uint64_t Align) { - return llvm::RoundUpToAlignment(Value, Align); -} - } // namespace coff } // namespace lld diff --git a/COFF/Config.h b/COFF/Config.h index 9cfccadba5fa..a5472e937fa1 100644 --- a/COFF/Config.h +++ b/COFF/Config.h @@ -106,11 +106,15 @@ struct Configuration { // Used for /merge:from=to (e.g. /merge:.rdata=.text) std::map Merge; + // Used for /section=.name,{DEKPRSW} to set section attributes. + std::map Section; + // Options for manifest files. ManifestKind Manifest = SideBySide; int ManifestID = 1; StringRef ManifestDependency; bool ManifestUAC = true; + std::vector ManifestInput; StringRef ManifestLevel = "'asInvoker'"; StringRef ManifestUIAccess = "'false'"; StringRef ManifestFile; diff --git a/COFF/DLL.cpp b/COFF/DLL.cpp index 8f3383d75c7b..9ac370c11d59 100644 --- a/COFF/DLL.cpp +++ b/COFF/DLL.cpp @@ -45,7 +45,7 @@ public: 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 align(Name.size() + 3, 2); + return alignTo(Name.size() + 3, 2); } void writeTo(uint8_t *Buf) const override { diff --git a/COFF/Driver.cpp b/COFF/Driver.cpp index 4cacf0ff552a..bb6a60e4fc4c 100644 --- a/COFF/Driver.cpp +++ b/COFF/Driver.cpp @@ -14,6 +14,7 @@ #include "SymbolTable.h" #include "Symbols.h" #include "Writer.h" +#include "lld/Driver/Driver.h" #include "llvm/ADT/Optional.h" #include "llvm/LibDriver/LibDriver.h" #include "llvm/Option/Arg.h" @@ -40,27 +41,28 @@ namespace coff { Configuration *Config; LinkerDriver *Driver; -void link(llvm::ArrayRef Args) { +bool link(llvm::ArrayRef Args) { Configuration C; LinkerDriver D; Config = &C; Driver = &D; - return Driver->link(Args); + Driver->link(Args); + return true; } -// Drop directory components and replace extension with ".exe". +// Drop directory components and replace extension with ".exe" or ".dll". 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(); + const char* E = Config->DLL ? ".dll" : ".exe"; + return (S.substr(0, S.rfind('.')) + E).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 &MB = *MBOrErr; + std::unique_ptr MB = + check(MemoryBuffer::getFile(Path), "could not open " + Path); MemoryBufferRef MBRef = MB->getMemBufferRef(); OwningMBs.push_back(std::move(MB)); // take ownership return MBRef; @@ -116,12 +118,16 @@ void LinkerDriver::parseDirectives(StringRef S) { case OPT_nodefaultlib: Config->NoDefaultLibs.insert(doFindLib(Arg->getValue())); break; + case OPT_section: + parseSection(Arg->getValue()); + break; case OPT_editandcontinue: + case OPT_fastfail: case OPT_guardsym: case OPT_throwingnew: break; default: - error(Twine(Arg->getSpelling()) + " is not allowed in .drectve"); + fatal(Arg->getSpelling() + " is not allowed in .drectve"); } } } @@ -246,7 +252,7 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { // 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"); + fatal("lib failed"); return; } @@ -268,7 +274,7 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { } if (Args.filtered_begin(OPT_INPUT) == Args.filtered_end()) - error("no input files."); + fatal("no input files"); // Construct search path list. SearchPaths.push_back(""); @@ -295,7 +301,7 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { // Handle /noentry if (Args.hasArg(OPT_noentry)) { if (!Args.hasArg(OPT_dll)) - error("/noentry must be specified with /dll"); + fatal("/noentry must be specified with /dll"); Config->NoEntry = true; } @@ -308,7 +314,7 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { // Handle /fixed if (Args.hasArg(OPT_fixed)) { if (Args.hasArg(OPT_dynamicbase)) - error("/fixed must not be specified with /dynamicbase"); + fatal("/fixed must not be specified with /dynamicbase"); Config->Relocatable = false; Config->DynamicBase = false; } @@ -382,17 +388,17 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { StringRef OptLevel = StringRef(S).substr(7); if (OptLevel.getAsInteger(10, Config->LTOOptLevel) || Config->LTOOptLevel > 3) - error("/opt:lldlto: invalid optimization level: " + OptLevel); + fatal("/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); + fatal("/opt:lldltojobs: invalid job count: " + Jobs); continue; } if (S != "ref" && S != "lbr" && S != "nolbr") - error(Twine("/opt: unknown option: ") + S); + fatal("/opt: unknown option: " + S); } } @@ -404,6 +410,10 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { for (auto *Arg : Args.filtered(OPT_merge)) parseMerge(Arg->getValue()); + // Handle /section + for (auto *Arg : Args.filtered(OPT_section)) + parseSection(Arg->getValue()); + // Handle /manifest if (auto *Arg = Args.getLastArg(OPT_manifest_colon)) parseManifest(Arg->getValue()); @@ -420,6 +430,10 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { if (auto *Arg = Args.getLastArg(OPT_manifestfile)) Config->ManifestFile = Arg->getValue(); + // Handle /manifestinput + for (auto *Arg : Args.filtered(OPT_manifestinput)) + Config->ManifestInput.push_back(Arg->getValue()); + // Handle miscellaneous boolean flags. if (Args.hasArg(OPT_allowbind_no)) Config->AllowBind = false; @@ -485,7 +499,7 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { continue; } if (Config->Machine != MT) - error(Twine(File->getShortName()) + ": machine type " + machineToStr(MT) + + fatal(File->getShortName() + ": machine type " + machineToStr(MT) + " conflicts with " + machineToStr(Config->Machine)); } if (Config->Machine == IMAGE_FILE_MACHINE_UNKNOWN) { @@ -520,7 +534,7 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { // infer that from user-defined entry name. StringRef S = findDefaultEntry(); if (S.empty()) - error("entry point must be defined"); + fatal("entry point must be defined"); Config->Entry = addUndefined(S); if (Config->Verbose) llvm::outs() << "Entry name inferred: " << S << "\n"; @@ -627,14 +641,14 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) { Config->Subsystem = inferSubsystem(); if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) - error("subsystem must be defined"); + fatal("subsystem must be defined"); } // Handle /safeseh. if (Args.hasArg(OPT_safeseh)) for (ObjectFile *File : Symtab.ObjectFiles) if (!File->SEHCompat) - error("/safeseh: " + File->getName() + " is not compatible with SEH"); + fatal("/safeseh: " + File->getName() + " is not compatible with SEH"); // Windows specific -- when we are creating a .dll file, we also // need to create a .lib file. @@ -668,7 +682,8 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { if (auto *Arg = Args.getLastArg(OPT_lldmap)) { std::error_code EC; llvm::raw_fd_ostream Out(Arg->getValue(), EC, OpenFlags::F_Text); - error(EC, "Could not create the symbol map"); + if (EC) + fatal(EC, "could not create the symbol map"); Symtab.printMap(Out); } // Call exit to avoid calling destructors. diff --git a/COFF/Driver.h b/COFF/Driver.h index e50da20cbb04..23969ee802fb 100644 --- a/COFF/Driver.h +++ b/COFF/Driver.h @@ -34,9 +34,6 @@ using llvm::COFF::WindowsSubsystem; using llvm::Optional; class InputFile; -// Entry point of the COFF linker. -void link(llvm::ArrayRef Args); - // Implemented in MarkLive.cpp. void markLive(const std::vector &Chunks); @@ -136,6 +133,7 @@ void parseSubsystem(StringRef Arg, WindowsSubsystem *Sys, uint32_t *Major, void parseAlternateName(StringRef); void parseMerge(StringRef); +void parseSection(StringRef); // Parses a string in the form of "EMBED[,=]|NO". void parseManifest(StringRef Arg); @@ -163,7 +161,6 @@ void checkFailIfMismatch(StringRef Arg); std::unique_ptr convertResToCOFF(const std::vector &MBs); -void touchFile(StringRef Path); void createPDB(StringRef Path); // Create enum with OPT_xxx values for each option in Options.td diff --git a/COFF/DriverUtils.cpp b/COFF/DriverUtils.cpp index 014fee7fefd7..5d7dc2bc65af 100644 --- a/COFF/DriverUtils.cpp +++ b/COFF/DriverUtils.cpp @@ -19,15 +19,12 @@ #include "Symbols.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/StringSwitch.h" -#include "llvm/Object/Archive.h" -#include "llvm/Object/ArchiveWriter.h" #include "llvm/Object/COFF.h" #include "llvm/Option/Arg.h" #include "llvm/Option/ArgList.h" #include "llvm/Option/Option.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileUtilities.h" -#include "llvm/Support/Path.h" #include "llvm/Support/Process.h" #include "llvm/Support/Program.h" #include "llvm/Support/raw_ostream.h" @@ -53,7 +50,8 @@ public: void run() { ErrorOr ExeOrErr = llvm::sys::findProgramByName(Prog); - error(ExeOrErr, Twine("unable to find ") + Prog + " in PATH: "); + if (auto EC = ExeOrErr.getError()) + fatal(EC, "unable to find " + Prog + " in PATH: "); const char *Exe = Saver.save(*ExeOrErr); Args.insert(Args.begin(), Exe); Args.push_back(nullptr); @@ -61,7 +59,7 @@ public: for (const char *S : Args) if (S) llvm::errs() << S << " "; - error("failed"); + fatal("ExecuteAndWait failed"); } } @@ -85,7 +83,7 @@ MachineTypes getMachineType(StringRef S) { .Default(IMAGE_FILE_MACHINE_UNKNOWN); if (MT != IMAGE_FILE_MACHINE_UNKNOWN) return MT; - error(Twine("unknown /machine argument: ") + S); + fatal("unknown /machine argument: " + S); } StringRef machineToStr(MachineTypes MT) { @@ -106,9 +104,9 @@ void parseNumbers(StringRef Arg, uint64_t *Addr, uint64_t *Size) { StringRef S1, S2; std::tie(S1, S2) = Arg.split(','); if (S1.getAsInteger(0, *Addr)) - error(Twine("invalid number: ") + S1); + fatal("invalid number: " + S1); if (Size && !S2.empty() && S2.getAsInteger(0, *Size)) - error(Twine("invalid number: ") + S2); + fatal("invalid number: " + S2); } // Parses a string in the form of "[.]". @@ -117,10 +115,10 @@ void parseVersion(StringRef Arg, uint32_t *Major, uint32_t *Minor) { StringRef S1, S2; std::tie(S1, S2) = Arg.split('.'); if (S1.getAsInteger(0, *Major)) - error(Twine("invalid number: ") + S1); + fatal("invalid number: " + S1); *Minor = 0; if (!S2.empty() && S2.getAsInteger(0, *Minor)) - error(Twine("invalid number: ") + S2); + fatal("invalid number: " + S2); } // Parses a string in the form of "[,[.]]". @@ -140,7 +138,7 @@ void parseSubsystem(StringRef Arg, WindowsSubsystem *Sys, uint32_t *Major, .Case("windows", IMAGE_SUBSYSTEM_WINDOWS_GUI) .Default(IMAGE_SUBSYSTEM_UNKNOWN); if (*Sys == IMAGE_SUBSYSTEM_UNKNOWN) - error(Twine("unknown subsystem: ") + SysStr); + fatal("unknown subsystem: " + SysStr); if (!Ver.empty()) parseVersion(Ver, Major, Minor); } @@ -151,10 +149,10 @@ void parseAlternateName(StringRef S) { StringRef From, To; std::tie(From, To) = S.split('='); if (From.empty() || To.empty()) - error(Twine("/alternatename: invalid argument: ") + S); + fatal("/alternatename: invalid argument: " + S); auto It = Config->AlternateNames.find(From); if (It != Config->AlternateNames.end() && It->second != To) - error(Twine("/alternatename: conflicts: ") + S); + fatal("/alternatename: conflicts: " + S); Config->AlternateNames.insert(It, std::make_pair(From, To)); } @@ -164,7 +162,7 @@ void parseMerge(StringRef S) { StringRef From, To; std::tie(From, To) = S.split('='); if (From.empty() || To.empty()) - error(Twine("/merge: invalid argument: ") + S); + fatal("/merge: invalid argument: " + S); auto Pair = Config->Merge.insert(std::make_pair(From, To)); bool Inserted = Pair.second; if (!Inserted) { @@ -175,6 +173,47 @@ void parseMerge(StringRef S) { } } +static uint32_t parseSectionAttributes(StringRef S) { + uint32_t Ret = 0; + for (char C : S.lower()) { + switch (C) { + case 'd': + Ret |= IMAGE_SCN_MEM_DISCARDABLE; + break; + case 'e': + Ret |= IMAGE_SCN_MEM_EXECUTE; + break; + case 'k': + Ret |= IMAGE_SCN_MEM_NOT_CACHED; + break; + case 'p': + Ret |= IMAGE_SCN_MEM_NOT_PAGED; + break; + case 'r': + Ret |= IMAGE_SCN_MEM_READ; + break; + case 's': + Ret |= IMAGE_SCN_MEM_SHARED; + break; + case 'w': + Ret |= IMAGE_SCN_MEM_WRITE; + break; + default: + fatal("/section: invalid argument: " + S); + } + } + return Ret; +} + +// Parses /section option argument. +void parseSection(StringRef S) { + StringRef Name, Attrs; + std::tie(Name, Attrs) = S.split(','); + if (Name.empty() || Attrs.empty()) + fatal("/section: invalid argument: " + S); + Config->Section[Name] = parseSectionAttributes(Attrs); +} + // Parses a string in the form of "EMBED[,=]|NO". // Results are directly written to Config. void parseManifest(StringRef Arg) { @@ -183,16 +222,16 @@ void parseManifest(StringRef Arg) { return; } if (!Arg.startswith_lower("embed")) - error(Twine("Invalid option ") + Arg); + fatal("invalid option " + Arg); Config->Manifest = Configuration::Embed; Arg = Arg.substr(strlen("embed")); if (Arg.empty()) return; if (!Arg.startswith_lower(",id=")) - error(Twine("Invalid option ") + Arg); + fatal("invalid option " + Arg); Arg = Arg.substr(strlen(",id=")); if (Arg.getAsInteger(0, Config->ManifestID)) - error(Twine("Invalid option ") + Arg); + fatal("invalid option " + Arg); } // Parses a string in the form of "level=|uiAccess=|NO". @@ -216,7 +255,7 @@ void parseManifestUAC(StringRef Arg) { std::tie(Config->ManifestUIAccess, Arg) = Arg.split(" "); continue; } - error(Twine("Invalid option ") + Arg); + fatal("invalid option " + Arg); } } @@ -240,10 +279,19 @@ static void quoteAndPrint(raw_ostream &Out, StringRef S) { } } -// Create a manifest file contents. -static std::string createManifestXml() { - std::string S; - llvm::raw_string_ostream OS(S); +// Create the default manifest file as a temporary file. +static std::string createDefaultXml() { + // Create a temporary file. + SmallString<128> Path; + if (auto EC = sys::fs::createTemporaryFile("tmp", "manifest", Path)) + fatal(EC, "cannot create a temporary file"); + + // Open the temporary file for writing. + std::error_code EC; + llvm::raw_fd_ostream OS(Path, EC, sys::fs::F_Text); + if (EC) + fatal(EC, "failed to open " + Path); + // Emit the XML. Note that we do *not* verify that the XML attributes are // syntactically correct. This is intentional for link.exe compatibility. OS << "\n" @@ -267,21 +315,57 @@ static std::string createManifestXml() { } } OS << "\n"; - OS.flush(); - return S; + OS.close(); + return StringRef(Path); +} + +static std::string readFile(StringRef Path) { + std::unique_ptr MB = + check(MemoryBuffer::getFile(Path), "could not open " + Path); + std::unique_ptr Buf(std::move(MB)); + return Buf->getBuffer(); +} + +static std::string createManifestXml() { + // Create the default manifest file. + std::string Path1 = createDefaultXml(); + if (Config->ManifestInput.empty()) + return readFile(Path1); + + // If manifest files are supplied by the user using /MANIFESTINPUT + // option, we need to merge them with the default manifest. + SmallString<128> Path2; + if (auto EC = sys::fs::createTemporaryFile("tmp", "manifest", Path2)) + fatal(EC, "cannot create a temporary file"); + FileRemover Remover1(Path1); + FileRemover Remover2(Path2); + + Executor E("mt.exe"); + E.add("/manifest"); + E.add(Path1); + for (StringRef Filename : Config->ManifestInput) { + E.add("/manifest"); + E.add(Filename); + } + E.add("/nologo"); + E.add("/out:" + StringRef(Path2)); + E.run(); + return readFile(Path2); } // Create a resource file containing a manifest XML. std::unique_ptr createManifestRes() { // Create a temporary file for the resource script file. SmallString<128> RCPath; - std::error_code EC = sys::fs::createTemporaryFile("tmp", "rc", RCPath); - error(EC, "cannot create a temporary file"); + if (auto EC = sys::fs::createTemporaryFile("tmp", "rc", RCPath)) + fatal(EC, "cannot create a temporary file"); FileRemover RCRemover(RCPath); // Open the temporary file for writing. + std::error_code EC; llvm::raw_fd_ostream Out(RCPath, EC, sys::fs::F_Text); - error(EC, Twine("failed to open ") + RCPath); + if (EC) + fatal(EC, "failed to open " + RCPath); // Write resource script to the RC file. Out << "#define LANG_ENGLISH 9\n" @@ -296,8 +380,8 @@ std::unique_ptr createManifestRes() { // Create output resource file. SmallString<128> ResPath; - EC = sys::fs::createTemporaryFile("tmp", "res", ResPath); - error(EC, "cannot create a temporary file"); + if (auto EC = sys::fs::createTemporaryFile("tmp", "res", ResPath)) + fatal(EC, "cannot create a temporary file"); Executor E("rc.exe"); E.add("/fo"); @@ -305,18 +389,17 @@ std::unique_ptr createManifestRes() { E.add("/nologo"); E.add(RCPath.str()); E.run(); - ErrorOr> Ret = MemoryBuffer::getFile(ResPath); - error(Ret, Twine("Could not open ") + ResPath); - return std::move(*Ret); + return check(MemoryBuffer::getFile(ResPath), "could not open " + ResPath); } void createSideBySideManifest() { std::string Path = Config->ManifestFile; if (Path == "") - Path = (Twine(Config->OutputFile) + ".manifest").str(); + Path = Config->OutputFile + ".manifest"; std::error_code EC; llvm::raw_fd_ostream Out(Path, EC, llvm::sys::fs::F_Text); - error(EC, "failed to create manifest"); + if (EC) + fatal(EC, "failed to create manifest"); Out << createManifestXml(); } @@ -380,7 +463,7 @@ Export parseExport(StringRef Arg) { return E; err: - error(Twine("invalid /export: ") + Arg); + fatal("invalid /export: " + Arg); } static StringRef undecorate(StringRef Sym) { @@ -398,7 +481,7 @@ void fixupExports() { if (E.Ordinal == 0) continue; if (!Ords.insert(E.Ordinal).second) - error("duplicate export ordinal: " + E.Name); + fatal("duplicate export ordinal: " + E.Name); } for (Export &E : Config->Exports) { @@ -459,11 +542,11 @@ void checkFailIfMismatch(StringRef Arg) { StringRef K, V; std::tie(K, V) = Arg.split('='); if (K.empty() || V.empty()) - error(Twine("/failifmismatch: invalid argument: ") + Arg); + fatal("/failifmismatch: invalid argument: " + Arg); StringRef Existing = Config->MustMatch[K]; if (!Existing.empty() && V != Existing) - error(Twine("/failifmismatch: mismatch detected: ") + Existing + " and " + - V + " for key " + K); + fatal("/failifmismatch: mismatch detected: " + Existing + " and " + V + + " for key " + K); Config->MustMatch[K] = V; } @@ -473,8 +556,8 @@ std::unique_ptr convertResToCOFF(const std::vector &MBs) { // Create an output file path. SmallString<128> Path; - if (llvm::sys::fs::createTemporaryFile("resource", "obj", Path)) - error("Could not create temporary file"); + if (auto EC = llvm::sys::fs::createTemporaryFile("resource", "obj", Path)) + fatal(EC, "could not create temporary file"); // Execute cvtres.exe. Executor E("cvtres.exe"); @@ -485,170 +568,7 @@ convertResToCOFF(const std::vector &MBs) { for (MemoryBufferRef MB : MBs) E.add(MB.getBufferIdentifier()); E.run(); - ErrorOr> Ret = MemoryBuffer::getFile(Path); - error(Ret, Twine("Could not open ") + Path); - return std::move(*Ret); -} - -static std::string writeToTempFile(StringRef Contents) { - SmallString<128> Path; - int FD; - if (llvm::sys::fs::createTemporaryFile("tmp", "def", FD, Path)) { - llvm::errs() << "failed to create a temporary file\n"; - return ""; - } - llvm::raw_fd_ostream OS(FD, /*shouldClose*/ true); - OS << Contents; - return Path.str(); -} - -void touchFile(StringRef Path) { - int FD; - std::error_code EC = sys::fs::openFileForWrite(Path, FD, sys::fs::F_Append); - error(EC, "failed to create a file"); - sys::Process::SafelyCloseFileDescriptor(FD); -} - -static std::string getImplibPath() { - if (!Config->Implib.empty()) - return Config->Implib; - SmallString<128> Out = StringRef(Config->OutputFile); - sys::path::replace_extension(Out, ".lib"); - return Out.str(); -} - -static std::unique_ptr createEmptyImportLibrary() { - std::string S = (Twine("LIBRARY \"") + - llvm::sys::path::filename(Config->OutputFile) + "\"\n") - .str(); - std::string Path1 = writeToTempFile(S); - std::string Path2 = getImplibPath(); - llvm::FileRemover Remover1(Path1); - llvm::FileRemover Remover2(Path2); - - Executor E("lib.exe"); - E.add("/nologo"); - E.add("/machine:" + machineToStr(Config->Machine)); - E.add(Twine("/def:") + Path1); - E.add(Twine("/out:") + Path2); - E.run(); - - ErrorOr> BufOrErr = - MemoryBuffer::getFile(Path2, -1, false); - error(BufOrErr, Twine("Failed to open ") + Path2); - return MemoryBuffer::getMemBufferCopy((*BufOrErr)->getBuffer()); -} - -static std::vector -readMembers(const object::Archive &Archive) { - std::vector V; - for (const auto &ChildOrErr : Archive.children()) { - error(ChildOrErr, "Archive::Child::getName failed"); - const object::Archive::Child C(*ChildOrErr); - ErrorOr NameOrErr = C.getName(); - error(NameOrErr, "Archive::Child::getName failed"); - V.emplace_back(C, *NameOrErr); - } - return V; -} - -// This class creates short import files which is described in -// PE/COFF spec 7. Import Library Format. -class ShortImportCreator { -public: - ShortImportCreator(object::Archive *A, StringRef S) : Parent(A), DLLName(S) {} - - NewArchiveIterator create(StringRef Sym, uint16_t Ordinal, - ImportNameType NameType, bool isData) { - size_t ImpSize = DLLName.size() + Sym.size() + 2; // +2 for NULs - size_t Size = sizeof(object::ArchiveMemberHeader) + - sizeof(coff_import_header) + ImpSize; - char *Buf = Alloc.Allocate(Size); - memset(Buf, 0, Size); - char *P = Buf; - - // Write archive member header - auto *Hdr = reinterpret_cast(P); - P += sizeof(*Hdr); - sprintf(Hdr->Name, "%-12s", "dummy"); - sprintf(Hdr->LastModified, "%-12d", 0); - sprintf(Hdr->UID, "%-6d", 0); - sprintf(Hdr->GID, "%-6d", 0); - sprintf(Hdr->AccessMode, "%-8d", 0644); - sprintf(Hdr->Size, "%-10d", int(sizeof(coff_import_header) + ImpSize)); - - // Write short import library. - auto *Imp = reinterpret_cast(P); - P += sizeof(*Imp); - Imp->Sig2 = 0xFFFF; - Imp->Machine = Config->Machine; - Imp->SizeOfData = ImpSize; - if (Ordinal > 0) - Imp->OrdinalHint = Ordinal; - Imp->TypeInfo = (isData ? IMPORT_DATA : IMPORT_CODE); - Imp->TypeInfo |= NameType << 2; - - // Write symbol name and DLL name. - memcpy(P, Sym.data(), Sym.size()); - P += Sym.size() + 1; - memcpy(P, DLLName.data(), DLLName.size()); - - std::error_code EC; - object::Archive::Child C(Parent, Buf, &EC); - assert(!EC && "We created an invalid buffer"); - return NewArchiveIterator(C, DLLName); - } - -private: - BumpPtrAllocator Alloc; - object::Archive *Parent; - StringRef DLLName; -}; - -static ImportNameType getNameType(StringRef Sym, StringRef ExtName) { - if (Sym != ExtName) - return IMPORT_NAME_UNDECORATE; - if (Config->Machine == I386 && Sym.startswith("_")) - return IMPORT_NAME_NOPREFIX; - return IMPORT_NAME; -} - -static std::string replace(StringRef S, StringRef From, StringRef To) { - size_t Pos = S.find(From); - assert(Pos != StringRef::npos); - return (Twine(S.substr(0, Pos)) + To + S.substr(Pos + From.size())).str(); -} - -// Creates an import library for a DLL. In this function, we first -// create an empty import library using lib.exe and then adds short -// import files to that file. -void writeImportLibrary() { - std::unique_ptr Buf = createEmptyImportLibrary(); - std::error_code EC; - object::Archive Archive(Buf->getMemBufferRef(), EC); - error(EC, "Error reading an empty import file"); - std::vector Members = readMembers(Archive); - - std::string DLLName = llvm::sys::path::filename(Config->OutputFile); - ShortImportCreator ShortImport(&Archive, DLLName); - for (Export &E : Config->Exports) { - if (E.Private) - continue; - if (E.ExtName.empty()) { - Members.push_back(ShortImport.create( - E.SymbolName, E.Ordinal, getNameType(E.SymbolName, E.Name), E.Data)); - } else { - Members.push_back(ShortImport.create( - replace(E.SymbolName, E.Name, E.ExtName), E.Ordinal, - getNameType(E.SymbolName, E.Name), E.Data)); - } - } - - std::string Path = getImplibPath(); - std::pair Result = - writeArchive(Path, Members, /*WriteSymtab*/ true, object::Archive::K_GNU, - /*Deterministic*/ true, /*Thin*/ false); - error(Result.second, Twine("Failed to write ") + Path); + return check(MemoryBuffer::getFile(Path), "could not open " + Path); } // Create OptTable @@ -695,7 +615,7 @@ llvm::opt::InputArgList ArgParser::parse(ArrayRef ArgsArr) { } if (MissingCount) - error(Twine("missing arg value for \"") + Args.getArgString(MissingIndex) + + fatal("missing arg value for \"" + Twine(Args.getArgString(MissingIndex)) + "\", expected " + Twine(MissingCount) + (MissingCount == 1 ? " argument." : " arguments.")); for (auto *Arg : Args.filtered(OPT_UNKNOWN)) diff --git a/COFF/Error.cpp b/COFF/Error.cpp index 255d9bbad9d8..602a8544ce2b 100644 --- a/COFF/Error.cpp +++ b/COFF/Error.cpp @@ -10,20 +10,23 @@ #include "Error.h" #include "llvm/ADT/Twine.h" +#include "llvm/Support/Error.h" #include "llvm/Support/raw_ostream.h" namespace lld { namespace coff { -void error(const Twine &Msg) { +void fatal(const Twine &Msg) { llvm::errs() << Msg << "\n"; exit(1); } -void error(std::error_code EC, const Twine &Prefix) { - if (!EC) - return; - error(Prefix + ": " + EC.message()); +void fatal(std::error_code EC, const Twine &Msg) { + fatal(Msg + ": " + EC.message()); +} + +void fatal(llvm::Error &Err, const Twine &Msg) { + fatal(errorToErrorCode(std::move(Err)), Msg); } } // namespace coff diff --git a/COFF/Error.h b/COFF/Error.h index cb0a185f0917..c9f64c662580 100644 --- a/COFF/Error.h +++ b/COFF/Error.h @@ -11,15 +11,25 @@ #define LLD_COFF_ERROR_H #include "lld/Core/LLVM.h" +#include "llvm/Support/Error.h" namespace lld { namespace coff { -LLVM_ATTRIBUTE_NORETURN void error(const Twine &Msg); -void error(std::error_code EC, const Twine &Prefix); +LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &Msg); +LLVM_ATTRIBUTE_NORETURN void fatal(std::error_code EC, const Twine &Prefix); +LLVM_ATTRIBUTE_NORETURN void fatal(llvm::Error &Err, const Twine &Prefix); -template void error(const ErrorOr &V, const Twine &Prefix) { - error(V.getError(), Prefix); +template T check(ErrorOr &&V, const Twine &Prefix) { + if (auto EC = V.getError()) + fatal(EC, Prefix); + return std::move(*V); +} + +template T check(Expected E, const Twine &Prefix) { + if (llvm::Error Err = E.takeError()) + fatal(Err, Prefix); + return std::move(*E); } } // namespace coff diff --git a/COFF/ICF.cpp b/COFF/ICF.cpp index f99b41624a84..a2c5a90334d0 100644 --- a/COFF/ICF.cpp +++ b/COFF/ICF.cpp @@ -70,7 +70,7 @@ private: static bool equalsConstant(const SectionChunk *A, const SectionChunk *B); static bool equalsVariable(const SectionChunk *A, const SectionChunk *B); bool forEachGroup(std::vector &Chunks, Comparator Eq); - bool partition(ChunkIterator Begin, ChunkIterator End, Comparator Eq); + bool segregate(ChunkIterator Begin, ChunkIterator End, Comparator Eq); std::atomic NextID = { 1 }; }; @@ -148,7 +148,7 @@ bool ICF::equalsVariable(const SectionChunk *A, const SectionChunk *B) { return std::equal(A->Relocs.begin(), A->Relocs.end(), B->Relocs.begin(), Eq); } -bool ICF::partition(ChunkIterator Begin, ChunkIterator End, Comparator Eq) { +bool ICF::segregate(ChunkIterator Begin, ChunkIterator End, Comparator Eq) { bool R = false; for (auto It = Begin;;) { SectionChunk *Head = *It; @@ -171,7 +171,7 @@ bool ICF::forEachGroup(std::vector &Chunks, Comparator Eq) { auto Bound = std::find_if(It + 1, End, [&](SectionChunk *SC) { return SC->GroupID != Head->GroupID; }); - if (partition(It, Bound, Eq)) + if (segregate(It, Bound, Eq)) R = true; It = Bound; } diff --git a/COFF/InputFiles.cpp b/COFF/InputFiles.cpp index 23af1e89c34d..ff26826371fa 100644 --- a/COFF/InputFiles.cpp +++ b/COFF/InputFiles.cpp @@ -8,30 +8,41 @@ //===----------------------------------------------------------------------===// #include "Chunks.h" +#include "Config.h" #include "Error.h" #include "InputFiles.h" #include "Symbols.h" -#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/Triple.h" +#include "llvm/ADT/Twine.h" #include "llvm/IR/LLVMContext.h" -#include "llvm/LTO/LTOModule.h" +#include "llvm/LTO/legacy/LTOModule.h" +#include "llvm/Object/Binary.h" #include "llvm/Object/COFF.h" #include "llvm/Support/COFF.h" -#include "llvm/Support/Debug.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/Endian.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/ErrorOr.h" +#include "llvm/Support/FileSystem.h" +#include "llvm/Target/TargetOptions.h" +#include "llvm-c/lto.h" +#include +#include +#include using namespace llvm::COFF; using namespace llvm::object; using namespace llvm::support::endian; + using llvm::Triple; using llvm::support::ulittle32_t; -using llvm::sys::fs::file_magic; -using llvm::sys::fs::identify_magic; namespace lld { namespace coff { int InputFile::NextIndex = 0; +llvm::LLVMContext BitcodeFile::Context; // Returns the last element of a path, which is supposed to be a filename. static StringRef getBasename(StringRef Path) { @@ -52,9 +63,7 @@ std::string InputFile::getShortName() { void ArchiveFile::parse() { // Parse a MemoryBufferRef as an archive file. - auto ArchiveOrErr = Archive::create(MB); - error(ArchiveOrErr, "Failed to parse static library"); - File = std::move(*ArchiveOrErr); + File = check(Archive::create(MB), "failed to parse static library"); // Allocate a buffer for Lazy objects. size_t NumSyms = File->getNumberOfSymbols(); @@ -67,40 +76,38 @@ void ArchiveFile::parse() { // Seen is a map from member files to boolean values. Initially // all members are mapped to false, which indicates all these files // are not read yet. - for (auto &ChildOrErr : File->children()) { - error(ChildOrErr, "Failed to parse static library"); - const Archive::Child &Child = *ChildOrErr; + Error Err; + for (auto &Child : File->children(Err)) Seen[Child.getChildOffset()].clear(); - } + if (Err) + fatal(Err, "failed to parse static library"); } // Returns a buffer pointing to a member file containing a given symbol. // This function is thread-safe. MemoryBufferRef ArchiveFile::getMember(const Archive::Symbol *Sym) { - auto COrErr = Sym->getMember(); - error(COrErr, Twine("Could not get the member for symbol ") + Sym->getName()); - const Archive::Child &C = *COrErr; + const Archive::Child &C = + check(Sym->getMember(), + "could not get the member for symbol " + Sym->getName()); // Return an empty buffer if we have already returned the same buffer. if (Seen[C.getChildOffset()].test_and_set()) return MemoryBufferRef(); - ErrorOr Ret = C.getMemoryBufferRef(); - error(Ret, Twine("Could not get the buffer for the member defining symbol ") + - Sym->getName()); - return *Ret; + return check(C.getMemoryBufferRef(), + "could not get the buffer for the member defining symbol " + + Sym->getName()); } void ObjectFile::parse() { // Parse a memory buffer as a COFF file. - auto BinOrErr = createBinary(MB); - error(BinOrErr, "Failed to parse object file"); - std::unique_ptr Bin = std::move(*BinOrErr); + std::unique_ptr Bin = + check(createBinary(MB), "failed to parse object file"); if (auto *Obj = dyn_cast(Bin.get())) { Bin.release(); COFFObj.reset(Obj); } else { - error(Twine(getName()) + " is not a COFF file."); + fatal(getName() + " is not a COFF file"); } // Read section and symbol tables. @@ -116,10 +123,10 @@ void ObjectFile::initializeChunks() { for (uint32_t I = 1; I < NumSections + 1; ++I) { const coff_section *Sec; StringRef Name; - std::error_code EC = COFFObj->getSection(I, Sec); - error(EC, Twine("getSection failed: #") + Twine(I)); - EC = COFFObj->getSectionName(Sec, Name); - error(EC, Twine("getSectionName failed: #") + Twine(I)); + if (auto EC = COFFObj->getSection(I, Sec)) + fatal(EC, "getSection failed: #" + Twine(I)); + if (auto EC = COFFObj->getSectionName(Sec, Name)) + fatal(EC, "getSectionName failed: #" + Twine(I)); if (Name == ".sxdata") { SXData = Sec; continue; @@ -149,14 +156,12 @@ void ObjectFile::initializeSymbols() { uint32_t NumSymbols = COFFObj->getNumberOfSymbols(); SymbolBodies.reserve(NumSymbols); SparseSymbolBodies.resize(NumSymbols); - llvm::SmallVector WeakAliases; + llvm::SmallVector, 8> WeakAliases; int32_t LastSectionNumber = 0; for (uint32_t I = 0; I < NumSymbols; ++I) { // Get a COFFSymbolRef object. - auto SymOrErr = COFFObj->getSymbol(I); - error(SymOrErr, Twine("broken object file: ") + getName()); - - COFFSymbolRef Sym = *SymOrErr; + COFFSymbolRef Sym = + check(COFFObj->getSymbol(I), "broken object file: " + getName()); const void *AuxP = nullptr; if (Sym.getNumberOfAuxSymbols()) @@ -167,8 +172,10 @@ void ObjectFile::initializeSymbols() { if (Sym.isUndefined()) { Body = createUndefined(Sym); } else if (Sym.isWeakExternal()) { - Body = createWeakExternal(Sym, AuxP); - WeakAliases.push_back((Undefined *)Body); + Body = createUndefined(Sym); + uint32_t TagIndex = + static_cast(AuxP)->TagIndex; + WeakAliases.emplace_back((Undefined *)Body, TagIndex); } else { Body = createDefined(Sym, AuxP, IsFirst); } @@ -179,8 +186,8 @@ void ObjectFile::initializeSymbols() { I += Sym.getNumberOfAuxSymbols(); LastSectionNumber = Sym.getSectionNumber(); } - for (Undefined *U : WeakAliases) - U->WeakAlias = SparseSymbolBodies[(uintptr_t)U->WeakAlias]; + for (auto WeakAlias : WeakAliases) + WeakAlias.first->WeakAlias = SparseSymbolBodies[WeakAlias.second]; } Undefined *ObjectFile::createUndefined(COFFSymbolRef Sym) { @@ -189,15 +196,6 @@ Undefined *ObjectFile::createUndefined(COFFSymbolRef Sym) { return new (Alloc) Undefined(Name); } -Undefined *ObjectFile::createWeakExternal(COFFSymbolRef Sym, const void *AuxP) { - StringRef Name; - COFFObj->getSymbolName(Sym, Name); - auto *U = new (Alloc) Undefined(Name); - auto *Aux = (const coff_aux_weak_external *)AuxP; - U->WeakAlias = (Undefined *)(uintptr_t)Aux->TagIndex; - return U; -} - Defined *ObjectFile::createDefined(COFFSymbolRef Sym, const void *AuxP, bool IsFirst) { StringRef Name; @@ -219,11 +217,21 @@ Defined *ObjectFile::createDefined(COFFSymbolRef Sym, const void *AuxP, } return new (Alloc) DefinedAbsolute(Name, Sym); } - if (Sym.getSectionNumber() == llvm::COFF::IMAGE_SYM_DEBUG) + int32_t SectionNumber = Sym.getSectionNumber(); + if (SectionNumber == llvm::COFF::IMAGE_SYM_DEBUG) return nullptr; + // Reserved sections numbers don't have contents. + if (llvm::COFF::isReservedSectionNumber(SectionNumber)) + fatal("broken object file: " + getName()); + + // This symbol references a section which is not present in the section + // header. + if ((uint32_t)SectionNumber >= SparseChunks.size()) + fatal("broken object file: " + getName()); + // Nothing else to do without a section chunk. - auto *SC = cast_or_null(SparseChunks[Sym.getSectionNumber()]); + auto *SC = cast_or_null(SparseChunks[SectionNumber]); if (!SC) return nullptr; @@ -250,7 +258,7 @@ void ObjectFile::initializeSEH() { ArrayRef A; COFFObj->getSectionContents(SXData, A); if (A.size() % 4 != 0) - error(".sxdata must be an array of symbol table indices"); + fatal(".sxdata must be an array of symbol table indices"); auto *I = reinterpret_cast(A.data()); auto *E = reinterpret_cast(A.data() + A.size()); for (; I != E; ++I) @@ -276,11 +284,11 @@ void ImportFile::parse() { // Check if the total size is valid. if ((size_t)(End - Buf) != (sizeof(*Hdr) + Hdr->SizeOfData)) - error("broken import library"); + fatal("broken import library"); // Read names and create an __imp_ symbol. StringRef Name = StringAlloc.save(StringRef(Buf + sizeof(*Hdr))); - StringRef ImpName = StringAlloc.save(Twine("__imp_") + Name); + StringRef ImpName = StringAlloc.save("__imp_" + Name); const char *NameStart = Buf + sizeof(coff_import_header) + Name.size() + 1; DLLName = StringRef(NameStart); StringRef ExtName; @@ -315,11 +323,10 @@ void BitcodeFile::parse() { // Usually parse() is thread-safe, but bitcode file is an exception. std::lock_guard Lock(Mu); - ErrorOr> ModOrErr = - LTOModule::createFromBuffer(llvm::getGlobalContext(), MB.getBufferStart(), - MB.getBufferSize(), llvm::TargetOptions()); - error(ModOrErr, "Could not create lto module"); - M = std::move(*ModOrErr); + Context.enableDebugTypeODRUniquing(); + ErrorOr> ModOrErr = LTOModule::createFromBuffer( + Context, MB.getBufferStart(), MB.getBufferSize(), llvm::TargetOptions()); + M = check(std::move(ModOrErr), "could not create LTO module"); llvm::StringSaver Saver(Alloc); for (unsigned I = 0, E = M->getSymbolCount(); I != E; ++I) { diff --git a/COFF/InputFiles.h b/COFF/InputFiles.h index 6a263fbaddf6..0ec01b5075f9 100644 --- a/COFF/InputFiles.h +++ b/COFF/InputFiles.h @@ -12,7 +12,8 @@ #include "lld/Core/LLVM.h" #include "llvm/ADT/ArrayRef.h" -#include "llvm/LTO/LTOModule.h" +#include "llvm/IR/LLVMContext.h" +#include "llvm/LTO/legacy/LTOModule.h" #include "llvm/Object/Archive.h" #include "llvm/Object/COFF.h" #include "llvm/Support/StringSaver.h" @@ -103,7 +104,7 @@ public: // All symbols returned by ArchiveFiles are of Lazy type. std::vector &getSymbols() override { - llvm_unreachable("internal error"); + llvm_unreachable("internal fatal"); } private: @@ -147,7 +148,6 @@ private: Defined *createDefined(COFFSymbolRef Sym, const void *Aux, bool IsFirst); Undefined *createUndefined(COFFSymbolRef Sym); - Undefined *createWeakExternal(COFFSymbolRef Sym, const void *Aux); std::unique_ptr COFFObj; llvm::BumpPtrAllocator Alloc; @@ -204,9 +204,10 @@ public: static bool classof(const InputFile *F) { return F->kind() == BitcodeKind; } std::vector &getSymbols() override { return SymbolBodies; } MachineTypes getMachineType() override; - std::unique_ptr takeModule() { return std::move(M); } + static llvm::LLVMContext Context; + private: void parse() override; diff --git a/COFF/Librarian.cpp b/COFF/Librarian.cpp new file mode 100644 index 000000000000..25fb4a87b3eb --- /dev/null +++ b/COFF/Librarian.cpp @@ -0,0 +1,489 @@ +//===- Librarian.cpp ------------------------------------------------------===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains functions for the Librarian. The librarian creates and +// manages libraries of the Common Object File Format (COFF) object files. It +// primarily is used for creating static libraries and import libraries. +// +//===----------------------------------------------------------------------===// + +#include "Config.h" +#include "Driver.h" +#include "Error.h" +#include "Symbols.h" +#include "llvm/Object/Archive.h" +#include "llvm/Object/ArchiveWriter.h" +#include "llvm/Object/COFF.h" +#include "llvm/Support/Path.h" + +#include + +using namespace lld::coff; +using namespace llvm::COFF; +using namespace llvm::object; +using namespace llvm; + +static bool is32bit() { + switch (Config->Machine) { + default: + llvm_unreachable("unsupported machine"); + case IMAGE_FILE_MACHINE_AMD64: + return false; + case IMAGE_FILE_MACHINE_ARMNT: + case IMAGE_FILE_MACHINE_I386: + return true; + } +} + +static uint16_t getImgRelRelocation() { + switch (Config->Machine) { + default: + llvm_unreachable("unsupported machine"); + case IMAGE_FILE_MACHINE_AMD64: + return IMAGE_REL_AMD64_ADDR32NB; + case IMAGE_FILE_MACHINE_ARMNT: + return IMAGE_REL_ARM_ADDR32NB; + case IMAGE_FILE_MACHINE_I386: + return IMAGE_REL_I386_DIR32NB; + } +} + +template void append(std::vector &B, const T &Data) { + size_t S = B.size(); + B.resize(S + sizeof(T)); + memcpy(&B[S], &Data, sizeof(T)); +} + +static void writeStringTable(std::vector &B, + ArrayRef Strings) { + // The COFF string table consists of a 4-byte value which is the size of the + // table, including the length field itself. This value is followed by the + // string content itself, which is an array of null-terminated C-style + // strings. The termination is important as they are referenced to by offset + // by the symbol entity in the file format. + + std::vector::size_type Pos = B.size(); + std::vector::size_type Offset = B.size(); + + // Skip over the length field, we will fill it in later as we will have + // computed the length while emitting the string content itself. + Pos += sizeof(uint32_t); + + for (const auto &S : Strings) { + B.resize(Pos + S.length() + 1); + strcpy(reinterpret_cast(&B[Pos]), S.c_str()); + Pos += S.length() + 1; + } + + // Backfill the length of the table now that it has been computed. + support::ulittle32_t Length(B.size() - Offset); + memcpy(&B[Offset], &Length, sizeof(Length)); +} + +static std::string getImplibPath() { + if (!Config->Implib.empty()) + return Config->Implib; + SmallString<128> Out = StringRef(Config->OutputFile); + sys::path::replace_extension(Out, ".lib"); + return Out.str(); +} + +static ImportNameType getNameType(StringRef Sym, StringRef ExtName) { + if (Sym != ExtName) + return IMPORT_NAME_UNDECORATE; + if (Config->Machine == I386 && Sym.startswith("_")) + return IMPORT_NAME_NOPREFIX; + return IMPORT_NAME; +} + +static std::string replace(StringRef S, StringRef From, StringRef To) { + size_t Pos = S.find(From); + assert(Pos != StringRef::npos); + return (Twine(S.substr(0, Pos)) + To + S.substr(Pos + From.size())).str(); +} + +static const std::string NullImportDescriptorSymbolName = + "__NULL_IMPORT_DESCRIPTOR"; + +namespace { +// This class constructs various small object files necessary to support linking +// symbols imported from a DLL. The contents are pretty strictly defined and +// nearly entirely static. The details of the structures files are defined in +// WINNT.h and the PE/COFF specification. +class ObjectFactory { + using u16 = support::ulittle16_t; + using u32 = support::ulittle32_t; + + BumpPtrAllocator Alloc; + StringRef DLLName; + StringRef Library; + std::string ImportDescriptorSymbolName; + std::string NullThunkSymbolName; + +public: + ObjectFactory(StringRef S) + : DLLName(S), Library(S.drop_back(4)), + ImportDescriptorSymbolName(("__IMPORT_DESCRIPTOR_" + Library).str()), + NullThunkSymbolName(("\x7f" + Library + "_NULL_THUNK_DATA").str()) {} + + // Creates an Import Descriptor. This is a small object file which contains a + // reference to the terminators and contains the library name (entry) for the + // import name table. It will force the linker to construct the necessary + // structure to import symbols from the DLL. + NewArchiveMember createImportDescriptor(std::vector &Buffer); + + // Creates a NULL import descriptor. This is a small object file whcih + // contains a NULL import descriptor. It is used to terminate the imports + // from a specific DLL. + NewArchiveMember createNullImportDescriptor(std::vector &Buffer); + + // Create a NULL Thunk Entry. This is a small object file which contains a + // NULL Import Address Table entry and a NULL Import Lookup Table Entry. It + // is used to terminate the IAT and ILT. + NewArchiveMember createNullThunk(std::vector &Buffer); + + // Create a short import file which is described in PE/COFF spec 7. Import + // Library Format. + NewArchiveMember createShortImport(StringRef Sym, uint16_t Ordinal, + ImportNameType NameType, bool isData); +}; +} + +NewArchiveMember +ObjectFactory::createImportDescriptor(std::vector &Buffer) { + static const uint32_t NumberOfSections = 2; + static const uint32_t NumberOfSymbols = 7; + static const uint32_t NumberOfRelocations = 3; + + // COFF Header + coff_file_header Header{ + u16(Config->Machine), u16(NumberOfSections), u32(0), + u32(sizeof(Header) + (NumberOfSections * sizeof(coff_section)) + + // .idata$2 + sizeof(coff_import_directory_table_entry) + + NumberOfRelocations * sizeof(coff_relocation) + + // .idata$4 + (DLLName.size() + 1)), + u32(NumberOfSymbols), u16(0), + u16(is32bit() ? IMAGE_FILE_32BIT_MACHINE : 0), + }; + append(Buffer, Header); + + // Section Header Table + static const coff_section SectionTable[NumberOfSections] = { + {{'.', 'i', 'd', 'a', 't', 'a', '$', '2'}, + u32(0), + u32(0), + u32(sizeof(coff_import_directory_table_entry)), + u32(sizeof(coff_file_header) + NumberOfSections * sizeof(coff_section)), + u32(sizeof(coff_file_header) + NumberOfSections * sizeof(coff_section) + + sizeof(coff_import_directory_table_entry)), + u32(0), + u16(NumberOfRelocations), + u16(0), + u32(IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_CNT_INITIALIZED_DATA | + IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE)}, + {{'.', 'i', 'd', 'a', 't', 'a', '$', '6'}, + u32(0), + u32(0), + u32(DLLName.size() + 1), + u32(sizeof(coff_file_header) + NumberOfSections * sizeof(coff_section) + + sizeof(coff_import_directory_table_entry) + + NumberOfRelocations * sizeof(coff_relocation)), + u32(0), + u32(0), + u16(0), + u16(0), + u32(IMAGE_SCN_ALIGN_2BYTES | IMAGE_SCN_CNT_INITIALIZED_DATA | + IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE)}, + }; + append(Buffer, SectionTable); + + // .idata$2 + static const coff_import_directory_table_entry ImportDescriptor{ + u32(0), u32(0), u32(0), u32(0), u32(0), + }; + append(Buffer, ImportDescriptor); + + static const coff_relocation RelocationTable[NumberOfRelocations] = { + {u32(offsetof(coff_import_directory_table_entry, NameRVA)), u32(2), + u16(getImgRelRelocation())}, + {u32(offsetof(coff_import_directory_table_entry, ImportLookupTableRVA)), + u32(3), u16(getImgRelRelocation())}, + {u32(offsetof(coff_import_directory_table_entry, ImportAddressTableRVA)), + u32(4), u16(getImgRelRelocation())}, + }; + append(Buffer, RelocationTable); + + // .idata$6 + auto S = Buffer.size(); + Buffer.resize(S + DLLName.size() + 1); + memcpy(&Buffer[S], DLLName.data(), DLLName.size()); + Buffer[S + DLLName.size()] = '\0'; + + // Symbol Table + coff_symbol16 SymbolTable[NumberOfSymbols] = { + {{{0, 0, 0, 0, 0, 0, 0, 0}}, + u32(0), + u16(1), + u16(0), + IMAGE_SYM_CLASS_EXTERNAL, + 0}, + {{{'.', 'i', 'd', 'a', 't', 'a', '$', '2'}}, + u32(0), + u16(1), + u16(0), + IMAGE_SYM_CLASS_SECTION, + 0}, + {{{'.', 'i', 'd', 'a', 't', 'a', '$', '6'}}, + u32(0), + u16(2), + u16(0), + IMAGE_SYM_CLASS_STATIC, + 0}, + {{{'.', 'i', 'd', 'a', 't', 'a', '$', '4'}}, + u32(0), + u16(0), + u16(0), + IMAGE_SYM_CLASS_SECTION, + 0}, + {{{'.', 'i', 'd', 'a', 't', 'a', '$', '5'}}, + u32(0), + u16(0), + u16(0), + IMAGE_SYM_CLASS_SECTION, + 0}, + {{{0, 0, 0, 0, 0, 0, 0, 0}}, + u32(0), + u16(0), + u16(0), + IMAGE_SYM_CLASS_EXTERNAL, + 0}, + {{{0, 0, 0, 0, 0, 0, 0, 0}}, + u32(0), + u16(0), + u16(0), + IMAGE_SYM_CLASS_EXTERNAL, + 0}, + }; + reinterpret_cast(SymbolTable[0].Name).Offset = + sizeof(uint32_t); + reinterpret_cast(SymbolTable[5].Name).Offset = + sizeof(uint32_t) + ImportDescriptorSymbolName.length() + 1; + reinterpret_cast(SymbolTable[6].Name).Offset = + sizeof(uint32_t) + ImportDescriptorSymbolName.length() + 1 + + NullImportDescriptorSymbolName.length() + 1; + append(Buffer, SymbolTable); + + // String Table + writeStringTable(Buffer, + {ImportDescriptorSymbolName, NullImportDescriptorSymbolName, + NullThunkSymbolName}); + + StringRef F{reinterpret_cast(Buffer.data()), Buffer.size()}; + return {MemoryBufferRef(F, DLLName)}; +} + +NewArchiveMember +ObjectFactory::createNullImportDescriptor(std::vector &Buffer) { + static const uint32_t NumberOfSections = 1; + static const uint32_t NumberOfSymbols = 1; + + // COFF Header + coff_file_header Header{ + u16(Config->Machine), u16(NumberOfSections), u32(0), + u32(sizeof(Header) + (NumberOfSections * sizeof(coff_section)) + + // .idata$3 + sizeof(coff_import_directory_table_entry)), + u32(NumberOfSymbols), u16(0), + u16(is32bit() ? IMAGE_FILE_32BIT_MACHINE : 0), + }; + append(Buffer, Header); + + // Section Header Table + static const coff_section SectionTable[NumberOfSections] = { + {{'.', 'i', 'd', 'a', 't', 'a', '$', '3'}, + u32(0), + u32(0), + u32(sizeof(coff_import_directory_table_entry)), + u32(sizeof(coff_file_header) + + (NumberOfSections * sizeof(coff_section))), + u32(0), + u32(0), + u16(0), + u16(0), + u32(IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_CNT_INITIALIZED_DATA | + IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE)}, + }; + append(Buffer, SectionTable); + + // .idata$3 + static const coff_import_directory_table_entry ImportDescriptor{ + u32(0), u32(0), u32(0), u32(0), u32(0), + }; + append(Buffer, ImportDescriptor); + + // Symbol Table + coff_symbol16 SymbolTable[NumberOfSymbols] = { + {{{0, 0, 0, 0, 0, 0, 0, 0}}, + u32(0), + u16(1), + u16(0), + IMAGE_SYM_CLASS_EXTERNAL, + 0}, + }; + reinterpret_cast(SymbolTable[0].Name).Offset = + sizeof(uint32_t); + append(Buffer, SymbolTable); + + // String Table + writeStringTable(Buffer, {NullImportDescriptorSymbolName}); + + StringRef F{reinterpret_cast(Buffer.data()), Buffer.size()}; + return {MemoryBufferRef(F, DLLName)}; +} + +NewArchiveMember ObjectFactory::createNullThunk(std::vector &Buffer) { + static const uint32_t NumberOfSections = 2; + static const uint32_t NumberOfSymbols = 1; + + // COFF Header + coff_file_header Header{ + u16(Config->Machine), u16(NumberOfSections), u32(0), + u32(sizeof(Header) + (NumberOfSections * sizeof(coff_section)) + + // .idata$5 + sizeof(export_address_table_entry) + + // .idata$4 + sizeof(export_address_table_entry)), + u32(NumberOfSymbols), u16(0), + u16(is32bit() ? IMAGE_FILE_32BIT_MACHINE : 0), + }; + append(Buffer, Header); + + // Section Header Table + static const coff_section SectionTable[NumberOfSections] = { + {{'.', 'i', 'd', 'a', 't', 'a', '$', '5'}, + u32(0), + u32(0), + u32(sizeof(export_address_table_entry)), + u32(sizeof(coff_file_header) + NumberOfSections * sizeof(coff_section)), + u32(0), + u32(0), + u16(0), + u16(0), + u32(IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_CNT_INITIALIZED_DATA | + IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE)}, + {{'.', 'i', 'd', 'a', 't', 'a', '$', '4'}, + u32(0), + u32(0), + u32(sizeof(export_address_table_entry)), + u32(sizeof(coff_file_header) + NumberOfSections * sizeof(coff_section) + + sizeof(export_address_table_entry)), + u32(0), + u32(0), + u16(0), + u16(0), + u32(IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_CNT_INITIALIZED_DATA | + IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE)}, + }; + append(Buffer, SectionTable); + + // .idata$5 + static const export_address_table_entry ILT{u32(0)}; + append(Buffer, ILT); + + // .idata$4 + static const export_address_table_entry IAT{u32(0)}; + append(Buffer, IAT); + + // Symbol Table + coff_symbol16 SymbolTable[NumberOfSymbols] = { + {{{0, 0, 0, 0, 0, 0, 0, 0}}, + u32(0), + u16(1), + u16(0), + IMAGE_SYM_CLASS_EXTERNAL, + 0}, + }; + reinterpret_cast(SymbolTable[0].Name).Offset = + sizeof(uint32_t); + append(Buffer, SymbolTable); + + // String Table + writeStringTable(Buffer, {NullThunkSymbolName}); + + StringRef F{reinterpret_cast(Buffer.data()), Buffer.size()}; + return {MemoryBufferRef{F, DLLName}}; +} + +NewArchiveMember ObjectFactory::createShortImport(StringRef Sym, + uint16_t Ordinal, + ImportNameType NameType, + bool isData) { + size_t ImpSize = DLLName.size() + Sym.size() + 2; // +2 for NULs + size_t Size = sizeof(coff_import_header) + ImpSize; + char *Buf = Alloc.Allocate(Size); + memset(Buf, 0, Size); + char *P = Buf; + + // Write short import library. + auto *Imp = reinterpret_cast(P); + P += sizeof(*Imp); + Imp->Sig2 = 0xFFFF; + Imp->Machine = Config->Machine; + Imp->SizeOfData = ImpSize; + if (Ordinal > 0) + Imp->OrdinalHint = Ordinal; + Imp->TypeInfo = (isData ? IMPORT_DATA : IMPORT_CODE); + Imp->TypeInfo |= NameType << 2; + + // Write symbol name and DLL name. + memcpy(P, Sym.data(), Sym.size()); + P += Sym.size() + 1; + memcpy(P, DLLName.data(), DLLName.size()); + + return {MemoryBufferRef(StringRef(Buf, Size), DLLName)}; +} + +// Creates an import library for a DLL. In this function, we first +// create an empty import library using lib.exe and then adds short +// import files to that file. +void lld::coff::writeImportLibrary() { + std::vector Members; + + std::string Path = getImplibPath(); + std::string DLLName = llvm::sys::path::filename(Config->OutputFile); + ObjectFactory OF(DLLName); + + std::vector ImportDescriptor; + Members.push_back(OF.createImportDescriptor(ImportDescriptor)); + + std::vector NullImportDescriptor; + Members.push_back(OF.createNullImportDescriptor(NullImportDescriptor)); + + std::vector NullThunk; + Members.push_back(OF.createNullThunk(NullThunk)); + + for (Export &E : Config->Exports) { + if (E.Private) + continue; + + ImportNameType Type = getNameType(E.SymbolName, E.Name); + std::string Name = E.ExtName.empty() + ? std::string(E.SymbolName) + : replace(E.SymbolName, E.Name, E.ExtName); + Members.push_back(OF.createShortImport(Name, E.Ordinal, Type, E.Data)); + } + + std::pair Result = + writeArchive(Path, Members, /*WriteSymtab*/ true, object::Archive::K_GNU, + /*Deterministic*/ true, /*Thin*/ false); + if (auto EC = Result.second) + fatal(EC, "failed to write " + Path); +} diff --git a/COFF/ModuleDef.cpp b/COFF/ModuleDef.cpp index d117e961f89a..5e393f45d184 100644 --- a/COFF/ModuleDef.cpp +++ b/COFF/ModuleDef.cpp @@ -134,13 +134,13 @@ private: void readAsInt(uint64_t *I) { read(); if (Tok.K != Identifier || Tok.Value.getAsInteger(10, *I)) - error("integer expected"); + fatal("integer expected"); } void expect(Kind Expected, StringRef Msg) { read(); if (Tok.K != Expected) - error(Msg); + fatal(Msg); } void unget() { Stack.push_back(Tok); } @@ -177,7 +177,7 @@ private: parseVersion(&Config->MajorImageVersion, &Config->MinorImageVersion); return; default: - error(Twine("unknown directive: ") + Tok.Value); + fatal("unknown directive: " + Tok.Value); } } @@ -188,7 +188,7 @@ private: if (Tok.K == Equal) { read(); if (Tok.K != Identifier) - error(Twine("identifier expected, but got ") + Tok.Value); + fatal("identifier expected, but got " + Tok.Value); E.ExtName = E.Name; E.Name = Tok.Value; } else { @@ -264,15 +264,15 @@ private: void parseVersion(uint32_t *Major, uint32_t *Minor) { read(); if (Tok.K != Identifier) - error(Twine("identifier expected, but got ") + Tok.Value); + fatal("identifier expected, but got " + Tok.Value); StringRef V1, V2; std::tie(V1, V2) = Tok.Value.split('.'); if (V1.getAsInteger(10, *Major)) - error(Twine("integer expected, but got ") + Tok.Value); + fatal("integer expected, but got " + Tok.Value); if (V2.empty()) *Minor = 0; else if (V2.getAsInteger(10, *Minor)) - error(Twine("integer expected, but got ") + Tok.Value); + fatal("integer expected, but got " + Tok.Value); } Lexer Lex; diff --git a/COFF/Options.td b/COFF/Options.td index a21b8de76afb..e5c9c5b4635b 100644 --- a/COFF/Options.td +++ b/COFF/Options.td @@ -48,6 +48,7 @@ def manifestuac : P<"manifestuac", "User access control">; def manifestfile : P<"manifestfile", "Manifest file path">; def manifestdependency : P<"manifestdependency", "Attributes for in manifest file">; +def manifestinput : P<"manifestinput", "Specify manifest file">; // We cannot use multiclass P because class name "incl" is different // from its command line option name. We do this because "include" is @@ -110,6 +111,7 @@ def no_incremental : F<"incremental:no">; def nologo : F<"nologo">; def throwingnew : F<"throwingnew">; def editandcontinue : F<"editandcontinue">; +def fastfail : F<"fastfail">; def delay : QF<"delay">; def errorreport : QF<"errorreport">; diff --git a/COFF/PDB.cpp b/COFF/PDB.cpp index 786d28798bab..7606ccc680d3 100644 --- a/COFF/PDB.cpp +++ b/COFF/PDB.cpp @@ -38,7 +38,8 @@ void lld::coff::createPDB(StringRef Path) { size_t FileSize = PageSize * 3; ErrorOr> BufferOrErr = FileOutputBuffer::create(Path, FileSize); - error(BufferOrErr, Twine("failed to open ") + Path); + if (auto EC = BufferOrErr.getError()) + fatal(EC, "failed to open " + Path); std::unique_ptr Buffer = std::move(*BufferOrErr); // Write the file header. diff --git a/COFF/README.md b/COFF/README.md index c1be560f4405..f1bfc9c15263 100644 --- a/COFF/README.md +++ b/COFF/README.md @@ -1,265 +1 @@ -The PE/COFF Linker -================== - -This directory contains a linker for Windows operating system. -Because the fundamental design of this port is different from -the other ports of LLD, this port is separated to this directory. - -The linker is command-line compatible with MSVC linker and is -generally 2x faster than that. It can be used to link real-world -programs such as LLD itself or Clang, or even web browsers which -are probably the largest open-source programs for Windows. - -This document is also applicable to ELF linker because the linker -shares the same design as this COFF linker. - -Overall Design --------------- - -This is a list of important data types in this linker. - -* SymbolBody - - SymbolBody is a class for symbols. They may be created for symbols - in object files or in archive file headers. The linker may create - them out of nothing. - - There are mainly three types of SymbolBodies: Defined, Undefined, or - Lazy. Defined symbols are for all symbols that are considered as - "resolved", including real defined symbols, COMDAT symbols, common - symbols, absolute symbols, linker-created symbols, etc. Undefined - symbols are for undefined symbols, which need to be replaced by - Defined symbols by the resolver. Lazy symbols represent symbols we - found in archive file headers -- which can turn into Defined symbols - if we read archieve members, but we haven't done that yet. - -* Symbol - - Symbol is a pointer to a SymbolBody. There's only one Symbol for - each unique symbol name (this uniqueness is guaranteed by the symbol - table). Because SymbolBodies are created for each file - independently, there can be many SymbolBodies for the same - name. Thus, the relationship between Symbols and SymbolBodies is 1:N. - - The resolver keeps the Symbol's pointer to always point to the "best" - SymbolBody. Pointer mutation is the resolve operation in this - linker. - - SymbolBodies have pointers to their Symbols. That means you can - always find the best SymbolBody from any SymbolBody by following - pointers twice. This structure makes it very easy to find - replacements for symbols. For example, if you have an Undefined - SymbolBody, you can find a Defined SymbolBody for that symbol just - by going to its Symbol and then to SymbolBody, assuming the resolver - have successfully resolved all undefined symbols. - -* Chunk - - Chunk represents a chunk of data that will occupy space in an - output. Each regular section becomes a chunk. - Chunks created for common or BSS symbols are not backed by sections. - The linker may create chunks out of nothing to append additional - data to an output. - - Chunks know about their size, how to copy their data to mmap'ed - outputs, and how to apply relocations to them. Specifically, - section-based chunks know how to read relocation tables and how to - apply them. - -* SymbolTable - - SymbolTable is basically a hash table from strings to Symbols, with - a logic to resolve symbol conflicts. It resolves conflicts by symbol - type. For example, if we add Undefined and Defined symbols, the - symbol table will keep the latter. If we add Defined and Lazy - symbols, it will keep the former. If we add Lazy and Undefined, it - will keep the former, but it will also trigger the Lazy symbol to - load the archive member to actually resolve the symbol. - -* OutputSection - - OutputSection is a container of Chunks. A Chunk belongs to at most - one OutputSection. - -There are mainly three actors in this linker. - -* InputFile - - InputFile is a superclass of file readers. We have a different - subclass for each input file type, such as regular object file, - archive file, etc. They are responsible for creating and owning - SymbolBodies and Chunks. - -* Writer - - The writer is responsible for writing file headers and Chunks to a - file. It creates OutputSections, put all Chunks into them, assign - unique, non-overlapping addresses and file offsets to them, and then - write them down to a file. - -* Driver - - The linking process is drived by the driver. The driver - - - processes command line options, - - creates a symbol table, - - creates an InputFile for each input file and put all symbols in it - into the symbol table, - - checks if there's no remaining undefined symbols, - - creates a writer, - - and passes the symbol table to the writer to write the result to a - file. - -Performance ------------ - -It's generally 2x faster than MSVC link.exe. It takes 3.5 seconds to -self-host on my Xeon 2580 machine. MSVC linker takes 7.0 seconds to -link the same executable. The resulting output is 65MB. -The old LLD is buggy that it produces 120MB executable for some reason, -and it takes 30 seconds to do that. - -We believe the performance difference comes from simplification and -optimizations we made to the new port. Notable differences are listed -below. - -* Reduced number of relocation table reads - - In the old design, relocation tables are read from beginning to - construct graphs because they consist of graph edges. In the new - design, they are not read until we actually apply relocations. - - This simplification has two benefits. One is that we don't create - additional objects for relocations but instead consume relocation - tables directly. The other is that it reduces number of relocation - entries we have to read, because we won't read relocations for - dead-stripped COMDAT sections. Large C++ programs tend to consist of - lots of COMDAT sections. In the old design, the time to process - relocation table is linear to size of input. In this new model, it's - linear to size of output. - -* Reduced number of symbol table lookup - - Symbol table lookup can be a heavy operation because number of - symbols can be very large and each symbol name can be very long - (think of C++ mangled symbols -- time to compute a hash value for a - string is linear to the length.) - - We look up the symbol table exactly only once for each symbol in the - new design. This is I believe the minimum possible number. This is - achieved by the separation of Symbol and SymbolBody. Once you get a - pointer to a Symbol by looking up the symbol table, you can always - get the latest symbol resolution result by just dereferencing a - pointer. (I'm not sure if the idea is new to the linker. At least, - all other linkers I've investigated so far seem to look up hash - tables or sets more than once for each new symbol, but I may be - wrong.) - -* Reduced number of file visits - - The symbol table implements the Windows linker semantics. We treat - the symbol table as a bucket of all known symbols, including symbols - in archive file headers. We put all symbols into one bucket as we - visit new files. That means we visit each file only once. - - This is different from the Unix linker semantics, in which we only - keep undefined symbols and visit each file one by one until we - resolve all undefined symbols. In the Unix model, we have to visit - archive files many times if there are circular dependencies between - archives. - -* Avoiding creating additional objects or copying data - - The data structures described in the previous section are all thin - wrappers for classes that LLVM libObject provides. We avoid copying - data from libObject's objects to our objects. We read much less data - than before. For example, we don't read symbol values until we apply - relocations because these values are not relevant to symbol - resolution. Again, COMDAT symbols may be discarded during symbol - resolution, so reading their attributes too early could result in a - waste. We use underlying objects directly where doing so makes - sense. - -Parallelism ------------ - -The abovementioned data structures are also chosen with -multi-threading in mind. It should relatively be easy to make the -symbol table a concurrent hash map, so that we let multiple workers -work on symbol table concurrently. Symbol resolution in this design is -a single pointer mutation, which allows the resolver work concurrently -in a lock-free manner using atomic pointer compare-and-swap. - -It should also be easy to apply relocations and write chunks concurrently. - -We created an experimental multi-threaded linker using the Microsoft -ConcRT concurrency library, and it was able to link itself in 0.5 -seconds, so we think the design is promising. - -Link-Time Optimization ----------------------- - -LTO is implemented by handling LLVM bitcode files as object files. -The linker resolves symbols in bitcode files normally. If all symbols -are successfully resolved, it then calls an LLVM libLTO function -with all bitcode files to convert them to one big regular COFF file. -Finally, the linker replaces bitcode symbols with COFF symbols, -so that we can link the input files as if they were in the native -format from the beginning. - -The details are described in this document. -http://llvm.org/docs/LinkTimeOptimization.html - -Glossary --------- - -* RVA - - Short for Relative Virtual Address. - - Windows executables or DLLs are not position-independent; they are - linked against a fixed address called an image base. RVAs are - offsets from an image base. - - Default image bases are 0x140000000 for executables and 0x18000000 - for DLLs. For example, when we are creating an executable, we assume - that the executable will be loaded at address 0x140000000 by the - loader, so we apply relocations accordingly. Result texts and data - will contain raw absolute addresses. - -* VA - - Short for Virtual Address. Equivalent to RVA + image base. It is - rarely used. We almost always use RVAs instead. - -* Base relocations - - Relocation information for the loader. If the loader decides to map - an executable or a DLL to a different address than their image - bases, it fixes up binaries using information contained in the base - relocation table. A base relocation table consists of a list of - locations containing addresses. The loader adds a difference between - RVA and actual load address to all locations listed there. - - Note that this run-time relocation mechanism is much simpler than ELF. - There's no PLT or GOT. Images are relocated as a whole just - by shifting entire images in memory by some offsets. Although doing - this breaks text sharing, I think this mechanism is not actually bad - on today's computers. - -* ICF - - Short for Identical COMDAT Folding. - - ICF is an optimization to reduce output size by merging COMDAT sections - by not only their names but by their contents. If two COMDAT sections - happen to have the same metadata, actual contents and relocations, - they are merged by ICF. It is known as an effective technique, - and it usually reduces C++ program's size by a few percent or more. - - Note that this is not entirely sound optimization. C/C++ require - different functions have different addresses. If a program depends on - that property, it would fail at runtime. However, that's not really an - issue on Windows because MSVC link.exe enabled the optimization by - default. As long as your program works with the linker's default - settings, your program should be safe with ICF. +See docs/NewLLD.rst diff --git a/COFF/SymbolTable.cpp b/COFF/SymbolTable.cpp index 5b7b89cd360a..df9da4c36650 100644 --- a/COFF/SymbolTable.cpp +++ b/COFF/SymbolTable.cpp @@ -14,7 +14,7 @@ #include "Symbols.h" #include "lld/Core/Parallel.h" #include "llvm/IR/LLVMContext.h" -#include "llvm/LTO/LTOCodeGenerator.h" +#include "llvm/LTO/legacy/LTOCodeGenerator.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include @@ -164,7 +164,7 @@ void SymbolTable::reportRemainingUndefines(bool Resolve) { llvm::errs() << File->getShortName() << ": undefined symbol: " << Sym->getName() << "\n"; if (!Config->Force) - error("Link failed"); + fatal("link failed"); } void SymbolTable::addLazy(Lazy *New, std::vector *Accum) { @@ -211,7 +211,7 @@ void SymbolTable::addSymbol(SymbolBody *New) { // equivalent (conflicting), or more preferable, respectively. int Comp = Existing->compare(New); if (Comp == 0) - error(Twine("duplicate symbol: ") + Existing->getDebugName() + " and " + + fatal("duplicate symbol: " + Existing->getDebugName() + " and " + New->getDebugName()); if (Comp < 0) Sym->Body = New; @@ -338,21 +338,25 @@ void SymbolTable::addCombinedLTOObject(ObjectFile *Obj) { // diagnose them later in reportRemainingUndefines(). StringRef Name = Body->getName(); Symbol *Sym = insert(Body); + SymbolBody *Existing = Sym->Body; + + if (Existing == Body) + continue; - if (isa(Sym->Body)) { + if (isa(Existing)) { Sym->Body = Body; continue; } - if (auto *L = dyn_cast(Sym->Body)) { + if (auto *L = dyn_cast(Existing)) { // We may see new references to runtime library symbols such as __chkstk // here. These symbols must be wholly defined in non-bitcode files. addMemberFile(L); continue; } - SymbolBody *Existing = Sym->Body; + int Comp = Existing->compare(Body); if (Comp == 0) - error(Twine("LTO: unexpected duplicate symbol: ") + Name); + fatal("LTO: unexpected duplicate symbol: " + Name); if (Comp < 0) Sym->Body = Body; } @@ -369,7 +373,7 @@ void SymbolTable::addCombinedLTOObjects() { // Create an object file and add it to the symbol table by replacing any // DefinedBitcode symbols with the definitions in the object file. - LTOCodeGenerator CG(getGlobalContext()); + LTOCodeGenerator CG(BitcodeFile::Context); CG.setOptLevel(Config->LTOOptLevel); std::vector Objs = createLTOObjects(&CG); @@ -379,7 +383,7 @@ void SymbolTable::addCombinedLTOObjects() { size_t NumBitcodeFiles = BitcodeFiles.size(); run(); if (BitcodeFiles.size() != NumBitcodeFiles) - error("LTO: late loaded symbol created new bitcode reference"); + fatal("LTO: late loaded symbol created new bitcode reference"); } // Combine and compile bitcode files and then return the result @@ -414,24 +418,23 @@ std::vector SymbolTable::createLTOObjects(LTOCodeGenerator *CG) { DisableVerify = false; #endif if (!CG->optimize(DisableVerify, false, false, false)) - error(""); // optimize() should have emitted any error message. + fatal(""); // optimize() should have emitted any error message. Objs.resize(Config->LTOJobs); // Use std::list to avoid invalidation of pointers in OSPtrs. std::list OSs; std::vector OSPtrs; - for (SmallVector &Obj : Objs) { + for (SmallString<0> &Obj : Objs) { OSs.emplace_back(Obj); OSPtrs.push_back(&OSs.back()); } if (!CG->compileOptimized(OSPtrs)) - error(""); // compileOptimized() should have emitted any error message. + fatal(""); // compileOptimized() should have emitted any error message. std::vector ObjFiles; - for (SmallVector &Obj : Objs) { - auto *ObjFile = new ObjectFile( - MemoryBufferRef(StringRef(Obj.data(), Obj.size()), "")); + for (SmallString<0> &Obj : Objs) { + auto *ObjFile = new ObjectFile(MemoryBufferRef(Obj, "")); Files.emplace_back(ObjFile); ObjectFiles.push_back(ObjFile); ObjFile->parse(); diff --git a/COFF/SymbolTable.h b/COFF/SymbolTable.h index ce305bfa8743..8bf4387cdfff 100644 --- a/COFF/SymbolTable.h +++ b/COFF/SymbolTable.h @@ -115,7 +115,7 @@ private: std::vector> ObjectQueue; std::vector BitcodeFiles; - std::vector> Objs; + std::vector> Objs; llvm::BumpPtrAllocator Alloc; }; diff --git a/COFF/Symbols.cpp b/COFF/Symbols.cpp index d732d76cfb06..6e2db6631ce7 100644 --- a/COFF/Symbols.cpp +++ b/COFF/Symbols.cpp @@ -162,32 +162,6 @@ std::string SymbolBody::getDebugName() { return N; } -uint64_t Defined::getFileOff() { - switch (kind()) { - case DefinedImportDataKind: - return cast(this)->getFileOff(); - case DefinedImportThunkKind: - return cast(this)->getFileOff(); - case DefinedLocalImportKind: - return cast(this)->getFileOff(); - case DefinedCommonKind: - return cast(this)->getFileOff(); - case DefinedRegularKind: - return cast(this)->getFileOff(); - - case DefinedBitcodeKind: - llvm_unreachable("There is no file offset for a bitcode symbol."); - case DefinedAbsoluteKind: - llvm_unreachable("Cannot get a file offset for an absolute symbol."); - case DefinedRelativeKind: - llvm_unreachable("Cannot get a file offset for a relative symbol."); - case LazyKind: - case UndefinedKind: - llvm_unreachable("Cannot get a file offset for an undefined symbol."); - } - llvm_unreachable("unknown symbol kind"); -} - COFFSymbolRef DefinedCOFF::getCOFFSymbol() { size_t SymSize = File->getCOFFObj()->getSymbolTableEntrySize(); if (SymSize == sizeof(coff_symbol16)) @@ -225,7 +199,7 @@ std::unique_ptr Lazy::getMember() { else if (Magic == file_magic::bitcode) Obj.reset(new BitcodeFile(MBRef)); else - error(Twine(File->getName()) + ": unknown file type"); + fatal("unknown file type: " + File->getName()); Obj->setParentName(File->getName()); return Obj; diff --git a/COFF/Symbols.h b/COFF/Symbols.h index 7059fbc8bb15..f96c1fb3cc1d 100644 --- a/COFF/Symbols.h +++ b/COFF/Symbols.h @@ -125,10 +125,6 @@ public: // writer sets and uses RVAs. uint64_t getRVA(); - // Returns the file offset of this symbol in the final executable. - // The writer uses this information to apply relocations. - uint64_t getFileOff(); - // Returns the RVA relative to the beginning of the output section. // Used to implement SECREL relocation type. uint64_t getSecrel(); diff --git a/COFF/Writer.cpp b/COFF/Writer.cpp index 5575c8d6b320..d8077df95701 100644 --- a/COFF/Writer.cpp +++ b/COFF/Writer.cpp @@ -59,6 +59,7 @@ private: void openFile(StringRef OutputPath); template void writeHeader(); void fixSafeSEHSymbols(); + void setSectionPermissions(); void writeSections(); void sortExceptionTable(); void applyRelocations(); @@ -114,6 +115,7 @@ public: StringRef getName() { return Name; } std::vector &getChunks() { return Chunks; } void addPermissions(uint32_t C); + void setPermissions(uint32_t C); uint32_t getPermissions() { return Header.Characteristics & PermMask; } uint32_t getCharacteristics() { return Header.Characteristics; } uint64_t getRVA() { return Header.VirtualAddress; } @@ -163,19 +165,23 @@ void OutputSection::addChunk(Chunk *C) { Chunks.push_back(C); C->setOutputSection(this); uint64_t Off = Header.VirtualSize; - Off = align(Off, C->getAlign()); + Off = alignTo(Off, C->getAlign()); C->setRVA(Off); C->setOutputSectionOff(Off); Off += C->getSize(); Header.VirtualSize = Off; if (C->hasData()) - Header.SizeOfRawData = align(Off, SectorSize); + Header.SizeOfRawData = alignTo(Off, SectorSize); } void OutputSection::addPermissions(uint32_t C) { Header.Characteristics |= C & PermMask; } +void OutputSection::setPermissions(uint32_t C) { + Header.Characteristics = C & PermMask; +} + // Write the section header to a given buffer. void OutputSection::writeHeaderTo(uint8_t *Buf) { auto *Hdr = reinterpret_cast(Buf); @@ -193,13 +199,13 @@ void OutputSection::writeHeaderTo(uint8_t *Buf) { uint64_t Defined::getSecrel() { if (auto *D = dyn_cast(this)) return getRVA() - D->getChunk()->getOutputSection()->getRVA(); - error("SECREL relocation points to a non-regular symbol"); + fatal("SECREL relocation points to a non-regular symbol"); } uint64_t Defined::getSectionIndex() { if (auto *D = dyn_cast(this)) return D->getChunk()->getOutputSection()->SectionIndex; - error("SECTION relocation points to a non-regular symbol"); + fatal("SECTION relocation points to a non-regular symbol"); } bool Defined::isExecutable() { @@ -222,6 +228,7 @@ void Writer::run() { createSection(".reloc"); assignAddresses(); removeEmptySections(); + setSectionPermissions(); createSymbolAndStringTable(); openFile(Config->OutputFile); if (Config->is64()) { @@ -232,7 +239,8 @@ void Writer::run() { fixSafeSEHSymbols(); writeSections(); sortExceptionTable(); - error(Buffer->commit(), "Failed to write the output file"); + if (auto EC = Buffer->commit()) + fatal(EC, "failed to write the output file"); } static StringRef getOutputSection(StringRef Name) { @@ -447,15 +455,15 @@ void Writer::createSymbolAndStringTable() { OutputSection *LastSection = OutputSections.back(); // We position the symbol table to be adjacent to the end of the last section. - uint64_t FileOff = - LastSection->getFileOff() + align(LastSection->getRawSize(), SectorSize); + uint64_t FileOff = LastSection->getFileOff() + + alignTo(LastSection->getRawSize(), SectorSize); if (!OutputSymtab.empty()) { PointerToSymbolTable = FileOff; FileOff += OutputSymtab.size() * sizeof(coff_symbol16); } if (!Strtab.empty()) FileOff += Strtab.size() + 4; - FileSize = align(FileOff, SectorSize); + FileSize = alignTo(FileOff, SectorSize); } // Visits all sections to assign incremental, non-overlapping RVAs and @@ -466,7 +474,7 @@ void Writer::assignAddresses() { sizeof(coff_section) * OutputSections.size(); SizeOfHeaders += Config->is64() ? sizeof(pe32plus_header) : sizeof(pe32_header); - SizeOfHeaders = align(SizeOfHeaders, SectorSize); + SizeOfHeaders = alignTo(SizeOfHeaders, SectorSize); uint64_t RVA = 0x1000; // The first page is kept unmapped. FileSize = SizeOfHeaders; // Move DISCARDABLE (or non-memory-mapped) sections to the end of file because @@ -480,10 +488,10 @@ void Writer::assignAddresses() { addBaserels(Sec); Sec->setRVA(RVA); Sec->setFileOffset(FileSize); - RVA += align(Sec->getVirtualSize(), PageSize); - FileSize += align(Sec->getRawSize(), SectorSize); + RVA += alignTo(Sec->getVirtualSize(), PageSize); + FileSize += alignTo(Sec->getRawSize(), SectorSize); } - SizeOfImage = SizeOfHeaders + align(RVA - 0x1000, PageSize); + SizeOfImage = SizeOfHeaders + alignTo(RVA - 0x1000, PageSize); } template void Writer::writeHeader() { @@ -596,13 +604,26 @@ template void Writer::writeHeader() { if (Symbol *Sym = Symtab->findUnderscore("_tls_used")) { if (Defined *B = dyn_cast(Sym->Body)) { Dir[TLS_TABLE].RelativeVirtualAddress = B->getRVA(); - Dir[TLS_TABLE].Size = 40; + Dir[TLS_TABLE].Size = Config->is64() + ? sizeof(object::coff_tls_directory64) + : sizeof(object::coff_tls_directory32); } } if (Symbol *Sym = Symtab->findUnderscore("_load_config_used")) { - if (Defined *B = dyn_cast(Sym->Body)) { + if (auto *B = dyn_cast(Sym->Body)) { + SectionChunk *SC = B->getChunk(); + assert(B->getRVA() >= SC->getRVA()); + uint64_t OffsetInChunk = B->getRVA() - SC->getRVA(); + if (!SC->hasData() || OffsetInChunk + 4 > SC->getSize()) + fatal("_load_config_used is malformed"); + + ArrayRef SecContents = SC->getContents(); + uint32_t LoadConfigSize = + *reinterpret_cast(&SecContents[OffsetInChunk]); + if (OffsetInChunk + LoadConfigSize > SC->getSize()) + fatal("_load_config_used is too large"); Dir[LOAD_CONFIG_TABLE].RelativeVirtualAddress = B->getRVA(); - Dir[LOAD_CONFIG_TABLE].Size = Config->is64() ? 112 : 64; + Dir[LOAD_CONFIG_TABLE].Size = LoadConfigSize; } } @@ -626,14 +647,14 @@ template void Writer::writeHeader() { // The first 4 bytes is length including itself. Buf = reinterpret_cast(&SymbolTable[NumberOfSymbols]); write32le(Buf, Strtab.size() + 4); - memcpy(Buf + 4, Strtab.data(), Strtab.size()); + if (!Strtab.empty()) + memcpy(Buf + 4, Strtab.data(), Strtab.size()); } void Writer::openFile(StringRef Path) { - ErrorOr> BufferOrErr = - FileOutputBuffer::create(Path, FileSize, FileOutputBuffer::F_executable); - error(BufferOrErr, Twine("failed to open ") + Path); - Buffer = std::move(*BufferOrErr); + Buffer = check( + FileOutputBuffer::create(Path, FileSize, FileOutputBuffer::F_executable), + "failed to open " + Path); } void Writer::fixSafeSEHSymbols() { @@ -643,6 +664,17 @@ void Writer::fixSafeSEHSymbols() { Config->SEHCount->setVA(SEHTable->getSize() / 4); } +// Handles /section options to allow users to overwrite +// section attributes. +void Writer::setSectionPermissions() { + for (auto &P : Config->Section) { + StringRef Name = P.first; + uint32_t Perm = P.second; + if (auto *Sec = findSection(Name)) + Sec->setPermissions(Perm); + } +} + // Write section contents to a mmap'ed file. void Writer::writeSections() { uint8_t *Buf = Buffer->getBufferStart(); diff --git a/ELF/CMakeLists.txt b/ELF/CMakeLists.txt index 3dcb65ff8957..a1b65adc7400 100644 --- a/ELF/CMakeLists.txt +++ b/ELF/CMakeLists.txt @@ -2,25 +2,49 @@ set(LLVM_TARGET_DEFINITIONS Options.td) tablegen(LLVM Options.inc -gen-opt-parser-defs) add_public_tablegen_target(ELFOptionsTableGen) -add_lld_library(lldELF2 +add_lld_library(lldELF Driver.cpp DriverUtils.cpp + EhFrame.cpp Error.cpp + ICF.cpp InputFiles.cpp InputSection.cpp + LTO.cpp LinkerScript.cpp MarkLive.cpp OutputSections.cpp + Relocations.cpp + ScriptParser.cpp + Strings.cpp + SymbolListFile.cpp SymbolTable.cpp Symbols.cpp Target.cpp + Thunks.cpp Writer.cpp LINK_COMPONENTS + ${LLVM_TARGETS_TO_BUILD} + Analysis + BitReader + BitWriter + Codegen + Core + IPO + Linker + LTO Object Option + Passes MC Support + Target + TransformUtils + + LINK_LIBS + lldConfig + ${PTHREAD_LIB} ) -add_dependencies(lldELF2 ELFOptionsTableGen) +add_dependencies(lldELF intrinsics_gen ELFOptionsTableGen) diff --git a/ELF/Config.h b/ELF/Config.h index c279b99b43c1..2ccd95e88775 100644 --- a/ELF/Config.h +++ b/ELF/Config.h @@ -17,10 +17,10 @@ #include namespace lld { -namespace elf2 { +namespace elf { class InputFile; -class SymbolBody; +struct Symbol; enum ELFKind { ELFNoneKind, @@ -30,60 +30,105 @@ enum ELFKind { ELF64BEKind }; +enum class BuildIdKind { None, Fnv1, Md5, Sha1, Hexstring }; + +enum class UnresolvedPolicy { NoUndef, Error, Warn, Ignore }; + +struct SymbolVersion { + llvm::StringRef Name; + bool IsExternCpp; +}; + +// This struct contains symbols version definition that +// can be found in version script if it is used for link. +struct VersionDefinition { + VersionDefinition(llvm::StringRef Name, size_t Id) : Name(Name), Id(Id) {} + llvm::StringRef Name; + size_t Id; + std::vector Globals; + size_t NameOff; // Offset in string table. +}; + // This struct contains the global configuration for the linker. // Most fields are direct mapping from the command line options // and such fields have the same name as the corresponding options. // Most fields are initialized by the driver. struct Configuration { - SymbolBody *EntrySym = nullptr; - SymbolBody *MipsGpDisp = nullptr; + Symbol *EntrySym = nullptr; InputFile *FirstElf = nullptr; llvm::StringRef DynamicLinker; llvm::StringRef Entry; llvm::StringRef Emulation; llvm::StringRef Fini; llvm::StringRef Init; + llvm::StringRef LtoAAPipeline; + llvm::StringRef LtoNewPmPasses; llvm::StringRef OutputFile; llvm::StringRef SoName; llvm::StringRef Sysroot; std::string RPath; - llvm::MapVector> OutputSections; + std::vector VersionDefinitions; + std::vector DynamicList; std::vector SearchPaths; std::vector Undefined; + std::vector VersionScriptGlobals; + std::vector BuildIdVector; bool AllowMultipleDefinition; bool AsNeeded = false; bool Bsymbolic; + bool BsymbolicFunctions; + bool Demangle = true; + bool DisableVerify; bool DiscardAll; bool DiscardLocals; bool DiscardNone; + bool EhFrameHdr; bool EnableNewDtags; bool ExportDynamic; + bool FatalWarnings; bool GcSections; bool GnuHash = false; + bool ICF; bool Mips64EL = false; - bool NoInhibitExec; - bool NoUndefined; + bool NoGnuUnique; + bool NoUndefinedVersion; + bool Pic; + bool Pie; bool PrintGcSections; + bool Rela; + bool Relocatable; + bool SaveTemps; bool Shared; bool Static = false; bool StripAll; + bool StripDebug; bool SysvHash = true; + bool Threads; + bool Trace; bool Verbose; + bool WarnCommon; + bool ZCombreloc; bool ZExecStack; bool ZNodelete; bool ZNow; bool ZOrigin; bool ZRelro; + UnresolvedPolicy UnresolvedSymbols; + BuildIdKind BuildId = BuildIdKind::None; ELFKind EKind = ELFNoneKind; + uint16_t DefaultSymbolVersion = llvm::ELF::VER_NDX_GLOBAL; uint16_t EMachine = llvm::ELF::EM_NONE; uint64_t EntryAddr = -1; - unsigned Optimize = 0; + uint64_t ImageBase; + unsigned LtoJobs; + unsigned LtoO; + unsigned Optimize; }; // The only instance of Configuration struct. extern Configuration *Config; -} // namespace elf2 +} // namespace elf } // namespace lld #endif diff --git a/ELF/Driver.cpp b/ELF/Driver.cpp index f00d97851e4a..c6ca2639236f 100644 --- a/ELF/Driver.cpp +++ b/ELF/Driver.cpp @@ -10,119 +10,218 @@ #include "Driver.h" #include "Config.h" #include "Error.h" +#include "ICF.h" #include "InputFiles.h" +#include "InputSection.h" +#include "LinkerScript.h" +#include "Strings.h" +#include "SymbolListFile.h" #include "SymbolTable.h" #include "Target.h" #include "Writer.h" -#include "llvm/ADT/STLExtras.h" +#include "lld/Driver/Driver.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringSwitch.h" +#include "llvm/Support/TargetSelect.h" #include "llvm/Support/raw_ostream.h" +#include #include using namespace llvm; using namespace llvm::ELF; using namespace llvm::object; +using namespace llvm::sys; using namespace lld; -using namespace lld::elf2; +using namespace lld::elf; -Configuration *elf2::Config; -LinkerDriver *elf2::Driver; +Configuration *elf::Config; +LinkerDriver *elf::Driver; + +bool elf::link(ArrayRef Args, raw_ostream &Error) { + HasError = false; + ErrorOS = &Error; -void elf2::link(ArrayRef Args) { Configuration C; LinkerDriver D; + ScriptConfiguration SC; Config = &C; Driver = &D; - Driver->main(Args.slice(1)); + ScriptConfig = &SC; + + Driver->main(Args); + return !HasError; } +// Parses a linker -m option. static std::pair parseEmulation(StringRef S) { - if (S == "elf32btsmip") - return {ELF32BEKind, EM_MIPS}; - if (S == "elf32ltsmip") - return {ELF32LEKind, EM_MIPS}; - if (S == "elf32ppc" || S == "elf32ppc_fbsd") - return {ELF32BEKind, EM_PPC}; - if (S == "elf64ppc" || S == "elf64ppc_fbsd") - return {ELF64BEKind, EM_PPC64}; - if (S == "elf_i386") - return {ELF32LEKind, EM_386}; - if (S == "elf_x86_64") - return {ELF64LEKind, EM_X86_64}; - if (S == "aarch64linux") - return {ELF64LEKind, EM_AARCH64}; - if (S == "i386pe" || S == "i386pep" || S == "thumb2pe") - error("Windows targets are not supported on the ELF frontend: " + S); - error("Unknown emulation: " + S); + if (S.endswith("_fbsd")) + S = S.drop_back(5); + + std::pair Ret = + StringSwitch>(S) + .Case("aarch64linux", {ELF64LEKind, EM_AARCH64}) + .Case("armelf_linux_eabi", {ELF32LEKind, EM_ARM}) + .Case("elf32_x86_64", {ELF32LEKind, EM_X86_64}) + .Case("elf32btsmip", {ELF32BEKind, EM_MIPS}) + .Case("elf32ltsmip", {ELF32LEKind, EM_MIPS}) + .Case("elf32ppc", {ELF32BEKind, EM_PPC}) + .Case("elf64btsmip", {ELF64BEKind, EM_MIPS}) + .Case("elf64ltsmip", {ELF64LEKind, EM_MIPS}) + .Case("elf64ppc", {ELF64BEKind, EM_PPC64}) + .Case("elf_i386", {ELF32LEKind, EM_386}) + .Case("elf_x86_64", {ELF64LEKind, EM_X86_64}) + .Default({ELFNoneKind, EM_NONE}); + + if (Ret.first == ELFNoneKind) { + if (S == "i386pe" || S == "i386pep" || S == "thumb2pe") + error("Windows targets are not supported on the ELF frontend: " + S); + else + error("unknown emulation: " + S); + } + return Ret; } // Returns slices of MB by parsing MB as an archive file. // Each slice consists of a member file in the archive. -static std::vector getArchiveMembers(MemoryBufferRef MB) { - ErrorOr> FileOrErr = Archive::create(MB); - error(FileOrErr, "Failed to parse archive"); - std::unique_ptr File = std::move(*FileOrErr); +std::vector +LinkerDriver::getArchiveMembers(MemoryBufferRef MB) { + std::unique_ptr File = + check(Archive::create(MB), "failed to parse archive"); std::vector V; - for (const ErrorOr &C : File->children()) { - error(C, "Could not get the child of the archive " + File->getFileName()); - ErrorOr MbOrErr = C->getMemoryBufferRef(); - error(MbOrErr, "Could not get the buffer for a child of the archive " + - File->getFileName()); - V.push_back(*MbOrErr); + Error Err; + for (const ErrorOr &COrErr : File->children(Err)) { + Archive::Child C = check(COrErr, "could not get the child of the archive " + + File->getFileName()); + MemoryBufferRef MBRef = + check(C.getMemoryBufferRef(), + "could not get the buffer for a child of the archive " + + File->getFileName()); + V.push_back(MBRef); } + if (Err) + Error(Err); + + // Take ownership of memory buffers created for members of thin archives. + for (std::unique_ptr &MB : File->takeThinBuffers()) + OwningMBs.push_back(std::move(MB)); + return V; } // Opens and parses a file. Path has to be resolved already. // Newly created memory buffers are owned by this driver. void LinkerDriver::addFile(StringRef Path) { - using namespace llvm::sys::fs; + using namespace sys::fs; if (Config->Verbose) - llvm::outs() << Path << "\n"; - auto MBOrErr = MemoryBuffer::getFile(Path); - error(MBOrErr, "cannot open " + Path); - std::unique_ptr &MB = *MBOrErr; - MemoryBufferRef MBRef = MB->getMemBufferRef(); - OwningMBs.push_back(std::move(MB)); // take MB ownership + outs() << Path << "\n"; + + Optional Buffer = readFile(Path); + if (!Buffer.hasValue()) + return; + MemoryBufferRef MBRef = *Buffer; switch (identify_magic(MBRef.getBuffer())) { case file_magic::unknown: - readLinkerScript(&Alloc, MBRef); + readLinkerScript(MBRef); return; case file_magic::archive: if (WholeArchive) { for (MemoryBufferRef MB : getArchiveMembers(MBRef)) - Files.push_back(createObjectFile(MB)); + Files.push_back(createObjectFile(MB, Path)); return; } Files.push_back(make_unique(MBRef)); return; case file_magic::elf_shared_object: + if (Config->Relocatable) { + error("attempted static link of dynamic object " + Path); + return; + } Files.push_back(createSharedFile(MBRef)); return; default: - Files.push_back(createObjectFile(MBRef)); + if (InLib) + Files.push_back(make_unique(MBRef)); + else + Files.push_back(createObjectFile(MBRef)); + } +} + +Optional LinkerDriver::readFile(StringRef Path) { + auto MBOrErr = MemoryBuffer::getFile(Path); + if (auto EC = MBOrErr.getError()) { + error(EC, "cannot open " + Path); + return None; } + std::unique_ptr &MB = *MBOrErr; + MemoryBufferRef MBRef = MB->getMemBufferRef(); + OwningMBs.push_back(std::move(MB)); // take MB ownership + + if (Cpio) + Cpio->append(relativeToRoot(Path), MBRef.getBuffer()); + + return MBRef; +} + +// Add a given library by searching it from input search paths. +void LinkerDriver::addLibrary(StringRef Name) { + std::string Path = searchLibrary(Name); + if (Path.empty()) + error("unable to find library -l" + Name); + else + addFile(Path); +} + +// This function is called on startup. We need this for LTO since +// LTO calls LLVM functions to compile bitcode files to native code. +// Technically this can be delayed until we read bitcode files, but +// we don't bother to do lazily because the initialization is fast. +static void initLLVM(opt::InputArgList &Args) { + InitializeAllTargets(); + InitializeAllTargetMCs(); + InitializeAllAsmPrinters(); + InitializeAllAsmParsers(); + + // This is a flag to discard all but GlobalValue names. + // We want to enable it by default because it saves memory. + // Disable it only when a developer option (-save-temps) is given. + Driver->Context.setDiscardValueNames(!Config->SaveTemps); + Driver->Context.enableDebugTypeODRUniquing(); + + // Parse and evaluate -mllvm options. + std::vector V; + V.push_back("lld (LLVM option parsing)"); + for (auto *Arg : Args.filtered(OPT_mllvm)) + V.push_back(Arg->getValue()); + cl::ParseCommandLineOptions(V.size(), V.data()); } // Some command line options or some combinations of them are not allowed. // This function checks for such errors. static void checkOptions(opt::InputArgList &Args) { - // Traditional linkers can generate re-linkable object files instead - // of executables or DSOs. We don't support that since the feature - // does not seem to provide more value than the static archiver. - if (Args.hasArg(OPT_relocatable)) - error("-r option is not supported. Use 'ar' command instead."); - // The MIPS ABI as of 2016 does not support the GNU-style symbol lookup // table which is a relatively new feature. if (Config->EMachine == EM_MIPS && Config->GnuHash) - error("The .gnu.hash section is not compatible with the MIPS target."); + error("the .gnu.hash section is not compatible with the MIPS target."); if (Config->EMachine == EM_AMDGPU && !Config->Entry.empty()) error("-e option is not valid for AMDGPU."); + + if (Config->Pie && Config->Shared) + error("-shared and -pie may not be used together"); + + if (Config->Relocatable) { + if (Config->Shared) + error("-r and -shared may not be used together"); + if (Config->GcSections) + error("-r and --gc-sections may not be used together"); + if (Config->ICF) + error("-r and --icf may not be used together"); + if (Config->Pie) + error("-r and -pie may not be used together"); + } } static StringRef @@ -132,6 +231,22 @@ getString(opt::InputArgList &Args, unsigned Key, StringRef Default = "") { return Default; } +static int getInteger(opt::InputArgList &Args, unsigned Key, int Default) { + int V = Default; + if (auto *Arg = Args.getLastArg(Key)) { + StringRef S = Arg->getValue(); + if (S.getAsInteger(10, V)) + error(Arg->getSpelling() + ": number expected, but got " + S); + } + return V; +} + +static const char *getReproduceOption(opt::InputArgList &Args) { + if (auto *Arg = Args.getLastArg(OPT_reproduce)) + return Arg->getValue(); + return getenv("LLD_REPRODUCE"); +} + static bool hasZOption(opt::InputArgList &Args, StringRef Key) { for (auto *Arg : Args.filtered(OPT_z)) if (Key == Arg->getValue()) @@ -140,12 +255,33 @@ static bool hasZOption(opt::InputArgList &Args, StringRef Key) { } void LinkerDriver::main(ArrayRef ArgsArr) { - initSymbols(); + ELFOptTable Parser; + opt::InputArgList Args = Parser.parse(ArgsArr.slice(1)); + if (Args.hasArg(OPT_help)) { + printHelp(ArgsArr[0]); + return; + } + if (Args.hasArg(OPT_version)) { + outs() << getVersionString(); + return; + } + + if (const char *Path = getReproduceOption(Args)) { + // Note that --reproduce is a debug option so you can ignore it + // if you are trying to understand the whole picture of the code. + Cpio.reset(CpioFile::create(Path)); + if (Cpio) { + Cpio->append("response.txt", createResponseFile(Args)); + Cpio->append("version.txt", getVersionString()); + } + } - opt::InputArgList Args = parseArgs(&Alloc, ArgsArr); readConfigs(Args); + initLLVM(Args); createFiles(Args); checkOptions(Args); + if (HasError) + return; switch (Config->EKind) { case ELF32LEKind: @@ -165,6 +301,25 @@ void LinkerDriver::main(ArrayRef ArgsArr) { } } +static UnresolvedPolicy getUnresolvedSymbolOption(opt::InputArgList &Args) { + if (Args.hasArg(OPT_noinhibit_exec)) + return UnresolvedPolicy::Warn; + if (Args.hasArg(OPT_no_undefined) || hasZOption(Args, "defs")) + return UnresolvedPolicy::NoUndef; + if (Config->Relocatable) + return UnresolvedPolicy::Ignore; + + if (auto *Arg = Args.getLastArg(OPT_unresolved_symbols)) { + StringRef S = Arg->getValue(); + if (S == "ignore-all" || S == "ignore-in-object-files") + return UnresolvedPolicy::Ignore; + if (S == "ignore-in-shared-libs" || S == "report-all") + return UnresolvedPolicy::Error; + error("unknown --unresolved-symbols value: " + S); + } + return UnresolvedPolicy::Error; +} + // Initializes Config members by the command line options. void LinkerDriver::readConfigs(opt::InputArgList &Args) { for (auto *Arg : Args.filtered(OPT_L)) @@ -185,38 +340,66 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { Config->AllowMultipleDefinition = Args.hasArg(OPT_allow_multiple_definition); Config->Bsymbolic = Args.hasArg(OPT_Bsymbolic); + Config->BsymbolicFunctions = Args.hasArg(OPT_Bsymbolic_functions); + Config->Demangle = !Args.hasArg(OPT_no_demangle); + Config->DisableVerify = Args.hasArg(OPT_disable_verify); Config->DiscardAll = Args.hasArg(OPT_discard_all); Config->DiscardLocals = Args.hasArg(OPT_discard_locals); Config->DiscardNone = Args.hasArg(OPT_discard_none); + Config->EhFrameHdr = Args.hasArg(OPT_eh_frame_hdr); Config->EnableNewDtags = !Args.hasArg(OPT_disable_new_dtags); Config->ExportDynamic = Args.hasArg(OPT_export_dynamic); + Config->FatalWarnings = Args.hasArg(OPT_fatal_warnings); Config->GcSections = Args.hasArg(OPT_gc_sections); - Config->NoInhibitExec = Args.hasArg(OPT_noinhibit_exec); - Config->NoUndefined = Args.hasArg(OPT_no_undefined); + Config->ICF = Args.hasArg(OPT_icf); + Config->NoGnuUnique = Args.hasArg(OPT_no_gnu_unique); + Config->NoUndefinedVersion = Args.hasArg(OPT_no_undefined_version); + Config->Pie = Args.hasArg(OPT_pie); Config->PrintGcSections = Args.hasArg(OPT_print_gc_sections); + Config->Relocatable = Args.hasArg(OPT_relocatable); + Config->SaveTemps = Args.hasArg(OPT_save_temps); Config->Shared = Args.hasArg(OPT_shared); Config->StripAll = Args.hasArg(OPT_strip_all); + Config->StripDebug = Args.hasArg(OPT_strip_debug); + Config->Threads = Args.hasArg(OPT_threads); + Config->Trace = Args.hasArg(OPT_trace); Config->Verbose = Args.hasArg(OPT_verbose); + Config->WarnCommon = Args.hasArg(OPT_warn_common); Config->DynamicLinker = getString(Args, OPT_dynamic_linker); Config->Entry = getString(Args, OPT_entry); Config->Fini = getString(Args, OPT_fini, "_fini"); Config->Init = getString(Args, OPT_init, "_init"); + Config->LtoAAPipeline = getString(Args, OPT_lto_aa_pipeline); + Config->LtoNewPmPasses = getString(Args, OPT_lto_newpm_passes); Config->OutputFile = getString(Args, OPT_o); Config->SoName = getString(Args, OPT_soname); Config->Sysroot = getString(Args, OPT_sysroot); + Config->Optimize = getInteger(Args, OPT_O, 1); + Config->LtoO = getInteger(Args, OPT_lto_O, 2); + if (Config->LtoO > 3) + error("invalid optimization level for LTO: " + getString(Args, OPT_lto_O)); + Config->LtoJobs = getInteger(Args, OPT_lto_jobs, 1); + if (Config->LtoJobs == 0) + error("number of threads must be > 0"); + + Config->ZCombreloc = !hasZOption(Args, "nocombreloc"); Config->ZExecStack = hasZOption(Args, "execstack"); Config->ZNodelete = hasZOption(Args, "nodelete"); Config->ZNow = hasZOption(Args, "now"); Config->ZOrigin = hasZOption(Args, "origin"); Config->ZRelro = !hasZOption(Args, "norelro"); - if (auto *Arg = Args.getLastArg(OPT_O)) { - StringRef Val = Arg->getValue(); - if (Val.getAsInteger(10, Config->Optimize)) - error("Invalid optimization level"); - } + if (Config->Relocatable) + Config->StripAll = false; + + // --strip-all implies --strip-debug. + if (Config->StripAll) + Config->StripDebug = true; + + // Config->Pic is true if we are generating position-independent code. + Config->Pic = Config->Pie || Config->Shared; if (auto *Arg = Args.getLastArg(OPT_hash_style)) { StringRef S = Arg->getValue(); @@ -226,19 +409,52 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { } else if (S == "both") { Config->GnuHash = true; } else if (S != "sysv") - error("Unknown hash style: " + S); + error("unknown hash style: " + S); + } + + // Parse --build-id or --build-id=