Index: llvm/trunk/utils/gn/build/libs/xml/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/build/libs/xml/BUILD.gn +++ llvm/trunk/utils/gn/build/libs/xml/BUILD.gn @@ -6,7 +6,7 @@ defines = [ "LLVM_LIBXML2_ENABLED" ] libs = [ "xml2" ] if (host_os == "mac") { - include_dirs = [ "$mac_sdk/usr/include/libxml2" ] + include_dirs = [ "$mac_sdk_path/usr/include/libxml2" ] } else { include_dirs = [ "/usr/include/libxml2" ] } Index: llvm/trunk/utils/gn/secondary/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/BUILD.gn +++ llvm/trunk/utils/gn/secondary/BUILD.gn @@ -1,6 +1,6 @@ group("default") { deps = [ - "//llvm/lib/LTO", + "//lld/tools/lld", "//llvm/tools/llc", "//llvm/tools/llvm-undname", ] Index: llvm/trunk/utils/gn/secondary/lld/COFF/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/lld/COFF/BUILD.gn +++ llvm/trunk/utils/gn/secondary/lld/COFF/BUILD.gn @@ -0,0 +1,44 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("Options") { + visibility = [ ":COFF" ] + args = [ "-gen-opt-parser-defs" ] +} + +static_library("COFF") { + output_name = "lldCOFF" + configs += [ "//llvm/utils/gn/build:lld_code" ] + deps = [ + ":Options", + "//lld/Common", + "//llvm/lib/BinaryFormat", + "//llvm/lib/DebugInfo/CodeView", + "//llvm/lib/DebugInfo/MSF", + "//llvm/lib/DebugInfo/PDB", + "//llvm/lib/IR", + "//llvm/lib/LTO", + "//llvm/lib/MC", + "//llvm/lib/Object", + "//llvm/lib/Option", + "//llvm/lib/Support", + "//llvm/lib/Target:TargetsToBuild", + "//llvm/lib/ToolDrivers/llvm-lib:LibDriver", + "//llvm/lib/WindowsManifest", + ] + sources = [ + "Chunks.cpp", + "DLL.cpp", + "Driver.cpp", + "DriverUtils.cpp", + "ICF.cpp", + "InputFiles.cpp", + "LTO.cpp", + "MapFile.cpp", + "MarkLive.cpp", + "MinGW.cpp", + "PDB.cpp", + "SymbolTable.cpp", + "Symbols.cpp", + "Writer.cpp", + ] +} Index: llvm/trunk/utils/gn/secondary/lld/Common/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/lld/Common/BUILD.gn +++ llvm/trunk/utils/gn/secondary/lld/Common/BUILD.gn @@ -0,0 +1,28 @@ +static_library("Common") { + output_name = "lldCommon" + configs += [ "//llvm/utils/gn/build:lld_code" ] + public_deps = [ + # public_dep because public header Version.h includes generated Version.inc. + "//lld/include/lld/Common:version", + ] + deps = [ + "//llvm/lib/CodeGen", + "//llvm/lib/Demangle", + "//llvm/lib/IR", + "//llvm/lib/MC", + "//llvm/lib/Option", + "//llvm/lib/Support", + "//llvm/lib/Target", + ] + sources = [ + "Args.cpp", + "ErrorHandler.cpp", + "Memory.cpp", + "Reproduce.cpp", + "Strings.cpp", + "TargetOptionsCommandFlags.cpp", + "Threads.cpp", + "Timer.cpp", + "Version.cpp", + ] +} Index: llvm/trunk/utils/gn/secondary/lld/ELF/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/lld/ELF/BUILD.gn +++ llvm/trunk/utils/gn/secondary/lld/ELF/BUILD.gn @@ -0,0 +1,64 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("Options") { + visibility = [ ":ELF" ] + args = [ "-gen-opt-parser-defs" ] +} + +static_library("ELF") { + output_name = "lldELF" + configs += [ "//llvm/utils/gn/build:lld_code" ] + deps = [ + ":Options", + "//lld/Common", + "//llvm/lib/BinaryFormat", + "//llvm/lib/DebugInfo/DWARF", + "//llvm/lib/IR", + "//llvm/lib/LTO", + "//llvm/lib/MC", + "//llvm/lib/Object", + "//llvm/lib/Option", + "//llvm/lib/Support", + "//llvm/lib/Target:TargetsToBuild", + ] + include_dirs = [ "." ] + sources = [ + "AArch64ErrataFix.cpp", + "Arch/AArch64.cpp", + "Arch/AMDGPU.cpp", + "Arch/ARM.cpp", + "Arch/AVR.cpp", + "Arch/Hexagon.cpp", + "Arch/Mips.cpp", + "Arch/MipsArchTree.cpp", + "Arch/PPC.cpp", + "Arch/PPC64.cpp", + "Arch/RISCV.cpp", + "Arch/SPARCV9.cpp", + "Arch/X86.cpp", + "Arch/X86_64.cpp", + "CallGraphSort.cpp", + "DWARF.cpp", + "Driver.cpp", + "DriverUtils.cpp", + "EhFrame.cpp", + "Filesystem.cpp", + "ICF.cpp", + "InputFiles.cpp", + "InputSection.cpp", + "LTO.cpp", + "LinkerScript.cpp", + "MapFile.cpp", + "MarkLive.cpp", + "OutputSections.cpp", + "Relocations.cpp", + "ScriptLexer.cpp", + "ScriptParser.cpp", + "SymbolTable.cpp", + "Symbols.cpp", + "SyntheticSections.cpp", + "Target.cpp", + "Thunks.cpp", + "Writer.cpp", + ] +} Index: llvm/trunk/utils/gn/secondary/lld/MinGW/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/lld/MinGW/BUILD.gn +++ llvm/trunk/utils/gn/secondary/lld/MinGW/BUILD.gn @@ -0,0 +1,21 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("Options") { + visibility = [ ":MinGW" ] + args = [ "-gen-opt-parser-defs" ] +} + +static_library("MinGW") { + output_name = "lldMinGW" + configs += [ "//llvm/utils/gn/build:lld_code" ] + deps = [ + ":Options", + "//lld/COFF", + "//lld/Common", + "//llvm/lib/Option", + "//llvm/lib/Support", + ] + sources = [ + "Driver.cpp", + ] +} Index: llvm/trunk/utils/gn/secondary/lld/include/lld/Common/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/lld/include/lld/Common/BUILD.gn +++ llvm/trunk/utils/gn/secondary/lld/include/lld/Common/BUILD.gn @@ -0,0 +1,26 @@ +import("//llvm/version.gni") + +action("version") { + script = "//llvm/utils/gn/build/write_cmake_config.py" + + sources = [ + "Version.inc.in", + ] + outputs = [ + "$target_gen_dir/Version.inc", + ] + args = [ + "-o", + rebase_path(outputs[0], root_out_dir), + + rebase_path(sources[0], root_out_dir), + + "LLD_VERSION=$llvm_version", + "LLD_VERSION_MAJOR=$llvm_version_major", + "LLD_VERSION_MINOR=$llvm_version_minor", + + # FIXME: Real values for these: + "LLD_REVISION=", + "LLD_REPOSITORY=", + ] +} Index: llvm/trunk/utils/gn/secondary/lld/lib/Core/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/lld/lib/Core/BUILD.gn +++ llvm/trunk/utils/gn/secondary/lld/lib/Core/BUILD.gn @@ -0,0 +1,20 @@ +static_library("Core") { + output_name = "lldCore" + configs += [ "//llvm/utils/gn/build:lld_code" ] + deps = [ + "//llvm/lib/BinaryFormat", + "//llvm/lib/MC", + "//llvm/lib/Support", + "//llvm/utils/gn/build/libs/pthread", + ] + sources = [ + "DefinedAtom.cpp", + "Error.cpp", + "File.cpp", + "LinkingContext.cpp", + "Reader.cpp", + "Resolver.cpp", + "SymbolTable.cpp", + "Writer.cpp", + ] +} Index: llvm/trunk/utils/gn/secondary/lld/lib/Driver/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/lld/lib/Driver/BUILD.gn +++ llvm/trunk/utils/gn/secondary/lld/lib/Driver/BUILD.gn @@ -0,0 +1,24 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("DarwinLdOptions") { + visibility = [ ":Driver" ] + args = [ "-gen-opt-parser-defs" ] +} + +static_library("Driver") { + output_name = "lldDriver" + configs += [ "//llvm/utils/gn/build:lld_code" ] + deps = [ + ":DarwinLdOptions", + "//lld/Common", + "//lld/lib/Core", + "//lld/lib/ReaderWriter", + "//lld/lib/ReaderWriter/MachO", + "//lld/lib/ReaderWriter/YAML", + "//llvm/lib/Option", + "//llvm/lib/Support", + ] + sources = [ + "DarwinLdDriver.cpp", + ] +} Index: llvm/trunk/utils/gn/secondary/lld/lib/ReaderWriter/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/lld/lib/ReaderWriter/BUILD.gn +++ llvm/trunk/utils/gn/secondary/lld/lib/ReaderWriter/BUILD.gn @@ -0,0 +1,17 @@ +static_library("ReaderWriter") { + output_name = "lldReaderWriter" + configs += [ "//llvm/utils/gn/build:lld_code" ] + deps = [ + "//lld/lib/Core", + "//llvm/lib/Object", + "//llvm/lib/Support", + ] + sources = [ + "FileArchive.cpp", + ] + + # FIXME: + # if (is_msvc) { + # cflags = [ "-wd4062" ] + # } +} Index: llvm/trunk/utils/gn/secondary/lld/lib/ReaderWriter/MachO/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/lld/lib/ReaderWriter/MachO/BUILD.gn +++ llvm/trunk/utils/gn/secondary/lld/lib/ReaderWriter/MachO/BUILD.gn @@ -0,0 +1,33 @@ +static_library("MachO") { + output_name = "lldMachO" + configs += [ "//llvm/utils/gn/build:lld_code" ] + deps = [ + "//lld/lib/Core", + "//lld/lib/ReaderWriter/YAML", + "//llvm/lib/DebugInfo/DWARF", + "//llvm/lib/Demangle", + "//llvm/lib/Object", + "//llvm/lib/Support", + ] + sources = [ + "ArchHandler.cpp", + "ArchHandler_arm.cpp", + "ArchHandler_arm64.cpp", + "ArchHandler_x86.cpp", + "ArchHandler_x86_64.cpp", + "CompactUnwindPass.cpp", + "GOTPass.cpp", + "LayoutPass.cpp", + "MachOLinkingContext.cpp", + "MachONormalizedFileBinaryReader.cpp", + "MachONormalizedFileBinaryWriter.cpp", + "MachONormalizedFileFromAtoms.cpp", + "MachONormalizedFileToAtoms.cpp", + "MachONormalizedFileYAML.cpp", + "ObjCPass.cpp", + "ShimPass.cpp", + "StubsPass.cpp", + "TLVPass.cpp", + "WriterMachO.cpp", + ] +} Index: llvm/trunk/utils/gn/secondary/lld/lib/ReaderWriter/YAML/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/lld/lib/ReaderWriter/YAML/BUILD.gn +++ llvm/trunk/utils/gn/secondary/lld/lib/ReaderWriter/YAML/BUILD.gn @@ -0,0 +1,11 @@ +static_library("YAML") { + output_name = "lldYAML" + configs += [ "//llvm/utils/gn/build:lld_code" ] + deps = [ + "//lld/lib/Core", + "//llvm/lib/Support", + ] + sources = [ + "ReaderWriterYAML.cpp", + ] +} Index: llvm/trunk/utils/gn/secondary/lld/tools/lld/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/lld/tools/lld/BUILD.gn +++ llvm/trunk/utils/gn/secondary/lld/tools/lld/BUILD.gn @@ -0,0 +1,16 @@ +# FIXME: Set up symlinks pointing to lld. + +executable("lld") { + configs += [ "//llvm/utils/gn/build:lld_code" ] + deps = [ + "//lld/COFF", + "//lld/ELF", + "//lld/MinGW", + "//lld/lib/Driver", + "//lld/wasm", + "//llvm/lib/Support", + ] + sources = [ + "lld.cpp", + ] +} Index: llvm/trunk/utils/gn/secondary/lld/wasm/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/lld/wasm/BUILD.gn +++ llvm/trunk/utils/gn/secondary/lld/wasm/BUILD.gn @@ -0,0 +1,32 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("Options") { + visibility = [ ":wasm" ] + args = [ "-gen-opt-parser-defs" ] +} + +static_library("wasm") { + output_name = "lldWasm" + configs += [ "//llvm/utils/gn/build:lld_code" ] + deps = [ + ":Options", + "//lld/Common", + "//llvm/lib/BinaryFormat", + "//llvm/lib/Demangle", + "//llvm/lib/IR", + "//llvm/lib/Object", + "//llvm/lib/Option", + ] + sources = [ + "Driver.cpp", + "InputChunks.cpp", + "InputFiles.cpp", + "LTO.cpp", + "MarkLive.cpp", + "OutputSections.cpp", + "SymbolTable.cpp", + "Symbols.cpp", + "Writer.cpp", + "WriterUtils.cpp", + ] +}