[PATCH] D33843: Create a new library called ObjectLayout, and move headers from Support to there.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 11:23:38 PDT 2017


I'm still missing some of the motivation as to 'why', here.

If there are significant uses of a library that don't use most of it -
yeah, i think there's merit in separating things out (eg: if lld, lldb,
etc, use, say, the DWARF constants but not the rest of Support/ADT - yeah,
it'd be nice if they didn't have to rebuild whenever SmallString changed,
for example). (though even then, Ninja's pretty efficient about only
rebuilding what it has to, so I'm not sure that even the library
granularity changes much about the build performance here - header
dependency could be something to care about there, for sure (fewer long
chains of dependent headers, breaking a header into two if there's
functionality that is used broadly next to functionality that has a narrow
use, etc).

What's the goal/metric/benefit?

On Fri, Jun 2, 2017 at 11:01 AM Zachary Turner via Phabricator <
reviews at reviews.llvm.org> wrote:

> zturner created this revision.
> Herald added subscribers: jgravelle-google, sbc100, javed.absar, aprantl,
> mgorny, nhaehnle, nemanjai, emaste, jyknight, dschuff, arsenm, jfb.
>
> Based on the list discussion from the other day, this does the following:
>
> 1. Moves `Dwarf.h`, `ELF.h`, `COFF.h`, `Wasm.h`, `MachO.h`, all
> corresponding `.def` files, and all `xxxReloc` folders out of `Support` and
> into `ObjectLayout`.
> 2. Moves the `file_magic` structure and `identify_magic` functions from
> `Support` to `ObjectLayout`.
> 3. Moves corresponding unit tests from `SupportTests` to a new unit test
> target named `ObjectLayoutTests`.
> 4. Updates all relevant `LLVMBuild.txt` files.
> 5. Updates all code in llvm, clang, lld, and lldb to use the new header
> locations.
>
> Sorry this patch is so large, but there is really no good way around it.
>
>
> https://reviews.llvm.org/D33843
>
> Files:
>   lld/COFF/Chunks.cpp
>   lld/COFF/Driver.cpp
>   lld/COFF/InputFiles.cpp
>   lld/ELF/Config.h
>   lld/ELF/EhFrame.cpp
>   lld/ELF/ICF.cpp
>   lld/ELF/LTO.cpp
>   lld/ELF/LinkerScript.cpp
>   lld/ELF/Mips.cpp
>   lld/ELF/OutputSections.cpp
>   lld/ELF/ScriptParser.cpp
>   lld/ELF/SyntheticSections.cpp
>   lld/ELF/Target.cpp
>   lld/ELF/Thunks.cpp
>   lld/include/lld/Core/Reader.h
>   lld/include/lld/ReaderWriter/MachOLinkingContext.h
>   lld/lib/Core/Reader.cpp
>   lld/lib/Driver/DarwinLdDriver.cpp
>   lld/lib/ReaderWriter/FileArchive.cpp
>   lld/lib/ReaderWriter/MachO/ExecutableAtoms.h
>   lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
>   lld/lib/ReaderWriter/MachO/MachONormalizedFile.h
>   lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
>   lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
>   lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
>   lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
>   lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
>   lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
>   lld/lib/ReaderWriter/MachO/WriterMachO.cpp
>   lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
>   lld/unittests/DriverTests/DarwinLdDriverTest.cpp
>   lld/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp
>   lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp
>   lld/unittests/MachOTests/MachONormalizedFileToAtomsTests.cpp
>   lld/unittests/MachOTests/MachONormalizedFileYAMLTests.cpp
>   lldb/include/lldb/Core/dwarf.h
>   lldb/include/lldb/Utility/SafeMachO.h
>   lldb/source/Core/ArchSpec.cpp
>   lldb/source/Core/CMakeLists.txt
>   lldb/source/Plugins/ObjectFile/ELF/CMakeLists.txt
>   lldb/source/Plugins/ObjectFile/ELF/ELFHeader.h
>   lldb/source/Plugins/ObjectFile/PECOFF/CMakeLists.txt
>   lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
>   lldb/source/Plugins/Process/elf-core/CMakeLists.txt
>   lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
>   lldb/source/Utility/CMakeLists.txt
>   lldb/unittests/Core/ArchSpecTest.cpp
>   lldb/unittests/Core/StructuredDataTest.cpp
>   llvm/examples/ExceptionDemo/ExceptionDemo.cpp
>   llvm/include/llvm/CodeGen/DIE.h
>   llvm/include/llvm/CodeGen/MachineModuleInfoImpls.h
>   llvm/include/llvm/DebugInfo/CodeView/EnumTables.h
>   llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
>   llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
>   llvm/include/llvm/DebugInfo/DWARF/DWARFAttribute.h
>   llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
>   llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
>   llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
>   llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
>   llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
>   llvm/include/llvm/IR/DebugInfoMetadata.h
>   llvm/include/llvm/LinkAllIR.h
>   llvm/include/llvm/MC/MCContext.h
>   llvm/include/llvm/MC/MCELFObjectWriter.h
>   llvm/include/llvm/MC/MCMachObjectWriter.h
>   llvm/include/llvm/MC/MCSectionMachO.h
>   llvm/include/llvm/MC/MCSymbolWasm.h
>   llvm/include/llvm/Object/COFF.h
>   llvm/include/llvm/Object/ELF.h
>   llvm/include/llvm/Object/ELFObjectFile.h
>   llvm/include/llvm/Object/ELFTypes.h
>   llvm/include/llvm/Object/MachO.h
>   llvm/include/llvm/Object/MachOUniversal.h
>   llvm/include/llvm/Object/ObjectFile.h
>   llvm/include/llvm/Object/RelocVisitor.h
>   llvm/include/llvm/Object/SymbolicFile.h
>   llvm/include/llvm/Object/Wasm.h
>   llvm/include/llvm/Object/WindowsResource.h
>   llvm/include/llvm/ObjectLayout/COFF.h
>   llvm/include/llvm/ObjectLayout/Dwarf.def
>   llvm/include/llvm/ObjectLayout/Dwarf.h
>   llvm/include/llvm/ObjectLayout/ELF.h
>   llvm/include/llvm/ObjectLayout/ELFRelocs/AArch64.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/AMDGPU.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/ARM.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/AVR.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/BPF.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/Hexagon.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/Lanai.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/Mips.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/PowerPC.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/PowerPC64.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/RISCV.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/Sparc.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/SystemZ.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/WebAssembly.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/i386.def
>   llvm/include/llvm/ObjectLayout/ELFRelocs/x86_64.def
>   llvm/include/llvm/ObjectLayout/MachO.def
>   llvm/include/llvm/ObjectLayout/MachO.h
>   llvm/include/llvm/ObjectLayout/Magic.h
>   llvm/include/llvm/ObjectLayout/Wasm.h
>   llvm/include/llvm/ObjectLayout/WasmRelocs/WebAssembly.def
>   llvm/include/llvm/ObjectYAML/COFFYAML.h
>   llvm/include/llvm/ObjectYAML/DWARFYAML.h
>   llvm/include/llvm/ObjectYAML/ELFYAML.h
>   llvm/include/llvm/ObjectYAML/MachOYAML.h
>   llvm/include/llvm/ObjectYAML/WasmYAML.h
>   llvm/include/llvm/Support/COFF.h
>   llvm/include/llvm/Support/Dwarf.def
>   llvm/include/llvm/Support/Dwarf.h
>   llvm/include/llvm/Support/ELF.h
>   llvm/include/llvm/Support/ELFRelocs/AArch64.def
>   llvm/include/llvm/Support/ELFRelocs/AMDGPU.def
>   llvm/include/llvm/Support/ELFRelocs/ARM.def
>   llvm/include/llvm/Support/ELFRelocs/AVR.def
>   llvm/include/llvm/Support/ELFRelocs/BPF.def
>   llvm/include/llvm/Support/ELFRelocs/Hexagon.def
>   llvm/include/llvm/Support/ELFRelocs/Lanai.def
>   llvm/include/llvm/Support/ELFRelocs/Mips.def
>   llvm/include/llvm/Support/ELFRelocs/PowerPC.def
>   llvm/include/llvm/Support/ELFRelocs/PowerPC64.def
>   llvm/include/llvm/Support/ELFRelocs/RISCV.def
>   llvm/include/llvm/Support/ELFRelocs/Sparc.def
>   llvm/include/llvm/Support/ELFRelocs/SystemZ.def
>   llvm/include/llvm/Support/ELFRelocs/WebAssembly.def
>   llvm/include/llvm/Support/ELFRelocs/i386.def
>   llvm/include/llvm/Support/ELFRelocs/x86_64.def
>   llvm/include/llvm/Support/FileSystem.h
>   llvm/include/llvm/Support/MachO.def
>   llvm/include/llvm/Support/MachO.h
>   llvm/include/llvm/Support/Wasm.h
>   llvm/include/llvm/Support/WasmRelocs/WebAssembly.def
>   llvm/lib/AsmParser/LLParser.cpp
>   llvm/lib/CMakeLists.txt
>   llvm/lib/CodeGen/AsmPrinter/ARMException.cpp
>   llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
>   llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
>   llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
>   llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
>   llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
>   llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
>   llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
>   llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>   llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
>   llvm/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp
>   llvm/lib/CodeGen/AsmPrinter/WinException.cpp
>   llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
>   llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
>   llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
>   llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
>   llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
>   llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
>   llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp
>   llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
>   llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
>   llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
>   llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
>   llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
>   llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
>   llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
>   llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
>   llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h
>   llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h
>   llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
>   llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldELFMips.cpp
>   llvm/lib/IR/AsmWriter.cpp
>   llvm/lib/IR/DIBuilder.cpp
>   llvm/lib/IR/LLVMBuild.txt
>   llvm/lib/IR/LLVMContextImpl.h
>   llvm/lib/IR/Verifier.cpp
>   llvm/lib/LLVMBuild.txt
>   llvm/lib/MC/ELFObjectWriter.cpp
>   llvm/lib/MC/MCAsmInfo.cpp
>   llvm/lib/MC/MCAsmInfoDarwin.cpp
>   llvm/lib/MC/MCAsmInfoELF.cpp
>   llvm/lib/MC/MCCodeView.cpp
>   llvm/lib/MC/MCContext.cpp
>   llvm/lib/MC/MCDwarf.cpp
>   llvm/lib/MC/MCELFStreamer.cpp
>   llvm/lib/MC/MCObjectFileInfo.cpp
>   llvm/lib/MC/MCParser/AsmParser.cpp
>   llvm/lib/MC/MCParser/COFFAsmParser.cpp
>   llvm/lib/MC/MCParser/DarwinAsmParser.cpp
>   llvm/lib/MC/MCParser/ELFAsmParser.cpp
>   llvm/lib/MC/MCSectionCOFF.cpp
>   llvm/lib/MC/MCSectionELF.cpp
>   llvm/lib/MC/MCStreamer.cpp
>   llvm/lib/MC/MCSymbolELF.cpp
>   llvm/lib/MC/MCWinEH.cpp
>   llvm/lib/MC/MachObjectWriter.cpp
>   llvm/lib/MC/StringTableBuilder.cpp
>   llvm/lib/MC/WasmObjectWriter.cpp
>   llvm/lib/MC/WinCOFFObjectWriter.cpp
>   llvm/lib/MC/WinCOFFStreamer.cpp
>   llvm/lib/Object/ArchiveWriter.cpp
>   llvm/lib/Object/Binary.cpp
>   llvm/lib/Object/COFFObjectFile.cpp
>   llvm/lib/Object/Decompressor.cpp
>   llvm/lib/Object/ELF.cpp
>   llvm/lib/Object/ELFObjectFile.cpp
>   llvm/lib/Object/IRObjectFile.cpp
>   llvm/lib/Object/LLVMBuild.txt
>   llvm/lib/Object/MachOObjectFile.cpp
>   llvm/lib/Object/ObjectFile.cpp
>   llvm/lib/Object/SymbolicFile.cpp
>   llvm/lib/Object/WasmObjectFile.cpp
>   llvm/lib/Object/WindowsResource.cpp
>   llvm/lib/ObjectLayout/CMakeLists.txt
>   llvm/lib/ObjectLayout/Dwarf.cpp
>   llvm/lib/ObjectLayout/LLVMBuild.txt
>   llvm/lib/ObjectLayout/Magic.cpp
>   llvm/lib/ObjectYAML/DWARFVisitor.h
>   llvm/lib/ObjectYAML/ELFYAML.cpp
>   llvm/lib/ObjectYAML/MachOYAML.cpp
>   llvm/lib/ObjectYAML/WasmYAML.cpp
>   llvm/lib/Support/CMakeLists.txt
>   llvm/lib/Support/Dwarf.cpp
>   llvm/lib/Support/Path.cpp
>   llvm/lib/Target/AArch64/AArch64TargetObjectFile.cpp
>   llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
>   llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
>   llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
>   llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
>   llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
>   llvm/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
>   llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
>   llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
>   llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
>   llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
>   llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
>   llvm/lib/Target/ARM/ARMAsmPrinter.cpp
>   llvm/lib/Target/ARM/ARMTargetObjectFile.cpp
>   llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
>   llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
>   llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackendDarwin.h
>   llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
>   llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
>   llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
>   llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp
>   llvm/lib/Target/AVR/AVRSubtarget.cpp
>   llvm/lib/Target/AVR/AVRTargetObjectFile.cpp
>   llvm/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp
>   llvm/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp
>   llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
>   llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp
>   llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
>   llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp
>   llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
>   llvm/lib/Target/Lanai/LanaiTargetObjectFile.cpp
>   (55 more files...)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170602/3d60c5f9/attachment.html>


More information about the llvm-commits mailing list