1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00

[gn build] Add build files for llvm-ar, llvm-nm, llvm-objdump, llvm-readelf

Also add build files for deps DebugInfo/Symbolize, ToolDrivers/dll-tool.
Also add gn/build/libs/xar (needed by llvm-objdump).

Also delete an incorrect part of the symlink description in //BUILD.gn (it used
to be true before I made the symlink step write a stamp file; now it's no
longer true).

These are all binaries needed by check-lld that need symlinks.

Differential Revision: https://reviews.llvm.org/D55743

llvm-svn: 349486
This commit is contained in:
Nico Weber 2018-12-18 13:52:21 +00:00
parent 9fa93bcc8d
commit d5d6c165b5
11 changed files with 267 additions and 4 deletions

View File

@ -0,0 +1,12 @@
import("//llvm/utils/gn/build/libs/xar/enable.gni")
config("xar_config") {
visibility = [ ":xar" ]
libs = [ "xar" ]
}
group("xar") {
if (llvm_enable_libxar) {
public_configs = [ ":xar_config" ]
}
}

View File

@ -0,0 +1,3 @@
declare_args() {
llvm_enable_libxar = host_os == "mac"
}

View File

@ -2,10 +2,14 @@ group("default") {
deps = [
":lld",
"//llvm/tools/llc",
"//llvm/tools/llvm-ar:symlinks",
"//llvm/tools/llvm-as",
"//llvm/tools/llvm-dis",
"//llvm/tools/llvm-dwarfdump",
"//llvm/tools/llvm-mc",
"//llvm/tools/llvm-nm:symlinks",
"//llvm/tools/llvm-objdump:symlinks",
"//llvm/tools/llvm-readobj:symlinks",
"//llvm/tools/llvm-undname",
"//llvm/tools/obj2yaml",
"//llvm/tools/opt",
@ -36,14 +40,33 @@ group("default") {
# executable. This has the effect that `ninja lld` builds lld and then creates
# symlinks (via this target), while `ninja bin/lld` only builds lld and doesn't
# update symlinks (in particular, on Windows it doesn't copy the new lld to its
# new locations); also `ninja lld-link` will build lld and copy it (on Windows)
# to lld-link, but it won't copy it to ld.lld.
# new locations).
# That seems simpler, more explicit, and good enough.
group("lld") {
deps = [
"//lld/tools/lld:symlinks",
]
}
group("llvm-ar") {
deps = [
"//llvm/tools/llvm-ar:symlinks",
]
}
group("llvm-nm") {
deps = [
"//llvm/tools/llvm-nm:symlinks",
]
}
group("llvm-objdump") {
deps = [
"//llvm/tools/llvm-objdump:symlinks",
]
}
group("llvm-readobj") {
deps = [
"//llvm/tools/llvm-readobj:symlinks",
]
}
# A pool called "console" in the root BUILD.gn is magic and represents ninja's
# built-in console pool. (Requires a GN with `gn --version` >= 552353.)

View File

@ -3,6 +3,7 @@ import("//llvm/triples.gni")
import("//llvm/utils/gn/build/buildflags.gni")
import("//llvm/utils/gn/build/libs/pthread/enable.gni")
import("//llvm/utils/gn/build/libs/terminfo/enable.gni")
import("//llvm/utils/gn/build/libs/xar/enable.gni")
import("//llvm/utils/gn/build/libs/xml/enable.gni")
import("//llvm/utils/gn/build/libs/zlib/enable.gni")
import("//llvm/version.gni")
@ -182,7 +183,6 @@ action("config") {
"HAVE_MACH_MACH_H=1",
"HAVE_MALLOC_MALLOC_H=1",
"HAVE_MALLOC_ZONE_STATISTICS=1",
"HAVE_LIBXAR=1",
"HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC=1",
]
} else {
@ -195,7 +195,6 @@ action("config") {
"HAVE_MALLOC_H=1",
"HAVE_MALLOC_MALLOC_H=",
"HAVE_MALLOC_ZONE_STATISTICS=",
"HAVE_LIBXAR=",
"HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC=",
]
}
@ -293,6 +292,12 @@ action("config") {
args += [ "LTDL_SHLIB_EXT=.dll" ]
}
if (llvm_enable_libxar) {
args += [ "HAVE_LIBXAR=1" ]
} else {
args += [ "HAVE_LIBXAR=" ]
}
if (llvm_enable_terminfo) {
args += [ "HAVE_TERMINFO=1" ]
} else {

View File

@ -0,0 +1,16 @@
static_library("Symbolize") {
output_name = "LLVMSymbolize"
deps = [
"//llvm/include/llvm/Config:config",
"//llvm/lib/DebugInfo/DWARF",
"//llvm/lib/DebugInfo/PDB",
"//llvm/lib/Demangle",
"//llvm/lib/Object",
"//llvm/lib/Support",
]
sources = [
"DIPrinter.cpp",
"SymbolizableObjectFile.cpp",
"Symbolize.cpp",
]
}

View File

@ -0,0 +1,19 @@
import("//llvm/utils/TableGen/tablegen.gni")
tablegen("Options") {
visibility = [ ":DlltoolDriver" ]
args = [ "-gen-opt-parser-defs" ]
}
static_library("DlltoolDriver") {
output_name = "LLVMDlltoolDriver"
deps = [
":Options",
"//llvm/lib/Object",
"//llvm/lib/Option",
"//llvm/lib/Support",
]
sources = [
"DlltoolDriver.cpp",
]
}

View File

@ -0,0 +1,5 @@
declare_args() {
# If set, creates symlinks for nm, objdump, readelf in the build
# directory.
llvm_install_binutils_symlinks = false
}

View File

@ -0,0 +1,46 @@
import("//llvm/tools/binutils_symlinks.gni")
import("//llvm/utils/gn/build/symlink_or_copy.gni")
symlinks = [
"llvm-dlltool",
"llvm-lib",
"llvm-ranlib",
]
if (llvm_install_binutils_symlinks) {
symlinks += [
"ar",
"dlltool",
"ranlib",
]
}
foreach(target, symlinks) {
symlink_or_copy(target) {
deps = [
":llvm-ar",
]
source = "llvm-ar"
output = "$root_out_dir/bin/$target"
}
}
# //:llvm-ar depends on this symlink target, see comment in //BUILD.gn.
group("symlinks") {
deps = []
foreach(target, symlinks) {
deps += [ ":$target" ]
}
}
executable("llvm-ar") {
deps = [
"//llvm/lib/IR",
"//llvm/lib/Object",
"//llvm/lib/Support",
"//llvm/lib/Target:TargetsToBuild",
"//llvm/lib/ToolDrivers/llvm-dlltool:DlltoolDriver",
"//llvm/lib/ToolDrivers/llvm-lib:LibDriver",
]
sources = [
"llvm-ar.cpp",
]
}

View File

@ -0,0 +1,37 @@
import("//llvm/tools/binutils_symlinks.gni")
import("//llvm/utils/gn/build/symlink_or_copy.gni")
if (llvm_install_binutils_symlinks) {
symlink_or_copy("nm") {
deps = [
":llvm-nm",
]
source = "llvm-nm"
output = "$root_out_dir/bin/nm"
}
}
# //:llvm-nm depends on this symlink target, see comment in //BUILD.gn.
group("symlinks") {
if (llvm_install_binutils_symlinks) {
deps = [
":nm",
]
}
}
executable("llvm-nm") {
deps = [
"//llvm/lib/Bitcode/Reader",
"//llvm/lib/Demangle",
"//llvm/lib/IR",
"//llvm/lib/Object",
"//llvm/lib/Support",
"//llvm/lib/Target:AllTargetsAsmParsers",
"//llvm/lib/Target:AllTargetsDescs",
"//llvm/lib/Target:AllTargetsInfos",
]
sources = [
"llvm-nm.cpp",
]
}

View File

@ -0,0 +1,48 @@
import("//llvm/tools/binutils_symlinks.gni")
import("//llvm/utils/gn/build/symlink_or_copy.gni")
if (llvm_install_binutils_symlinks) {
symlink_or_copy("objdump") {
deps = [
":llvm-objdump",
]
source = "llvm-objdump"
output = "$root_out_dir/bin/objdump"
}
}
# //:llvm-nm depends on this symlink target, see comment in //BUILD.gn.
group("symlinks") {
if (llvm_install_binutils_symlinks) {
deps = [
":objdump",
]
}
}
executable("llvm-objdump") {
deps = [
"//llvm/include/llvm/Config:config",
"//llvm/lib/CodeGen",
"//llvm/lib/DebugInfo/DWARF",
"//llvm/lib/DebugInfo/PDB",
"//llvm/lib/DebugInfo/Symbolize",
"//llvm/lib/Demangle",
"//llvm/lib/MC",
"//llvm/lib/MC/MCDisassembler",
"//llvm/lib/Object",
"//llvm/lib/Support",
"//llvm/lib/Target:AllTargetsAsmPrinters",
"//llvm/lib/Target:AllTargetsDescs",
"//llvm/lib/Target:AllTargetsDisassemblers",
"//llvm/lib/Target:AllTargetsInfos",
"//llvm/utils/gn/build/libs/xar",
]
sources = [
"COFFDump.cpp",
"ELFDump.cpp",
"MachODump.cpp",
"WasmDump.cpp",
"llvm-objdump.cpp",
]
}

View File

@ -0,0 +1,49 @@
import("//llvm/tools/binutils_symlinks.gni")
import("//llvm/utils/gn/build/symlink_or_copy.gni")
symlinks = [ "llvm-readelf" ]
if (llvm_install_binutils_symlinks) {
symlinks += [ "readelf" ]
}
foreach(target, symlinks) {
symlink_or_copy(target) {
deps = [
":llvm-readobj",
]
source = "llvm-readobj"
output = "$root_out_dir/bin/$target"
}
}
# //:llvm-readobj depends on this symlink target, see comment in //BUILD.gn.
group("symlinks") {
deps = []
foreach(target, symlinks) {
deps += [ ":$target" ]
}
}
executable("llvm-readobj") {
deps = [
"//llvm/lib/BinaryFormat",
"//llvm/lib/DebugInfo/CodeView",
"//llvm/lib/DebugInfo/DWARF",
"//llvm/lib/DebugInfo/MSF",
"//llvm/lib/DebugInfo/PDB",
"//llvm/lib/Object",
"//llvm/lib/Support",
]
sources = [
"ARMWinEHPrinter.cpp",
"COFFDumper.cpp",
"COFFImportDumper.cpp",
"ELFDumper.cpp",
"Error.cpp",
"MachODumper.cpp",
"ObjDumper.cpp",
"WasmDumper.cpp",
"Win64EHDumper.cpp",
"WindowsResourceDumper.cpp",
"llvm-readobj.cpp",
]
}