diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2019-02-07 21:24:30 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2019-02-07 21:24:30 +0000 |
commit | 82bf8e82c96b79fcafea5d0026feab24a270e9af (patch) | |
tree | cba488c18dc666f0461dcd7c3b9126a2dc256441 | |
parent | f557a94aa32cd707a07019f3b35fb6a37f5da7b7 (diff) | |
download | bcm5719-llvm-82bf8e82c96b79fcafea5d0026feab24a270e9af.tar.gz bcm5719-llvm-82bf8e82c96b79fcafea5d0026feab24a270e9af.zip |
gn build: Make check-{clang,lld,llvm} pass on FreeBSD.
Mostly achieved by assuming that anything that isn't Win or Mac is ELF,
which seems reasonable enough for now.
Differential Revision: https://reviews.llvm.org/D57870
llvm-svn: 353470
13 files changed, 43 insertions, 37 deletions
diff --git a/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn b/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn index c2fad99acf5..7417e5982ee 100644 --- a/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn +++ b/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn @@ -12,8 +12,8 @@ import("//llvm/version.gni") # - the GN build doesn't have LIBCLANG_BUILD_STATIC libclang_target_type = "shared_library" -if (host_os == "linux") { - # Linux needs -fPIC to build shared libs but they aren't on by default. +if (host_os != "win" && host_os != "mac") { + # ELF targets need -fPIC to build shared libs but they aren't on by default. # For now, make libclang a static lib there. libclang_target_type = "static_library" } diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn index ebeb6f365d3..4d0a3a8144c 100644 --- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn @@ -269,12 +269,12 @@ write_cmake_config("config") { ] } - if (current_os == "linux" || current_os == "android") { - values += [ "LTDL_SHLIB_EXT=.so" ] - } else if (current_os == "mac") { + if (current_os == "mac") { values += [ "LTDL_SHLIB_EXT=.dylib" ] } else if (current_os == "win") { values += [ "LTDL_SHLIB_EXT=.dll" ] + } else { + values += [ "LTDL_SHLIB_EXT=.so" ] } if (llvm_enable_libedit) { diff --git a/llvm/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn index 9240193cd67..9e5557840c0 100644 --- a/llvm/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn @@ -11,9 +11,9 @@ loadable_module("Hello") { "Hello.cpp", ] - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # The GN build currently doesn't globally pass -fPIC, but that's - # needed for building .so files on Linux. Just pass it manually + # needed for building .so files on ELF. Just pass it manually # for loadable_modules for now. cflags = [ "-fPIC" ] } diff --git a/llvm/utils/gn/secondary/llvm/test/BUILD.gn b/llvm/utils/gn/secondary/llvm/test/BUILD.gn index 6da35dd8990..0dc292e4ecd 100644 --- a/llvm/utils/gn/secondary/llvm/test/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/test/BUILD.gn @@ -83,24 +83,28 @@ write_lit_config("lit_site_cfg") { assert(false, "unimplemented host_cpu " + host_cpu) } + if (host_os == "win") { + extra_values += [ "EXEEXT=.exe" ] + } else { + extra_values += [ "EXEEXT=" ] + } + if (host_os == "mac") { - extra_values += [ - "EXEEXT=", - "HOST_OS=Darwin", - "SHLIBEXT=.dylib", - ] + extra_values += [ "SHLIBEXT=.dylib" ] + } else if (host_os == "win") { + extra_values += [ "SHLIBEXT=.dll" ] + } else { + extra_values += [ "SHLIBEXT=.so" ] + } + + if (host_os == "freebsd") { + extra_values += [ "HOST_OS=FreeBSD" ] + } else if (host_os == "mac") { + extra_values += [ "HOST_OS=Darwin" ] } else if (host_os == "linux") { - extra_values += [ - "EXEEXT=", - "HOST_OS=Linux", - "SHLIBEXT=.so", - ] + extra_values += [ "HOST_OS=Linux" ] } else if (host_os == "win") { - extra_values += [ - "EXEEXT=.exe", - "HOST_OS=Windows", - "SHLIBEXT=.dll", - ] + extra_values += [ "HOST_OS=Windows" ] } else { assert(false, "unsupported host_os " + host_os) } diff --git a/llvm/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn b/llvm/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn index 385c4694c0a..260c3909b60 100644 --- a/llvm/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn @@ -11,9 +11,9 @@ loadable_module("bugpoint-passes") { "TestPasses.cpp", ] - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # The GN build currently doesn't globally pass -fPIC, but that's - # needed for building .so files on Linux. Just pass it manually + # needed for building .so files on ELF. Just pass it manually # for loadable_modules for now. cflags = [ "-fPIC" ] } diff --git a/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn b/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn index 84a49082c31..d14aec2f72a 100644 --- a/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn @@ -33,7 +33,7 @@ executable("bugpoint") { # Support plugins. # FIXME: Disable dead stripping once other binaries are dead-stripped. - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # Make sure bugpoint plugins can access bugpoint's symbols. # Corresponds to export_executable_symbols() in cmake. ldflags = [ "-rdynamic" ] diff --git a/llvm/utils/gn/secondary/llvm/tools/llc/BUILD.gn b/llvm/utils/gn/secondary/llvm/tools/llc/BUILD.gn index 45cde4a59b2..5f7aff10d99 100644 --- a/llvm/utils/gn/secondary/llvm/tools/llc/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/tools/llc/BUILD.gn @@ -21,7 +21,7 @@ executable("llc") { # Support plugins. # FIXME: Disable dead stripping once other binaries are dead-stripped. - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # Corresponds to export_executable_symbols() in cmake. ldflags = [ "-rdynamic" ] } diff --git a/llvm/utils/gn/secondary/llvm/tools/lli/BUILD.gn b/llvm/utils/gn/secondary/llvm/tools/lli/BUILD.gn index 0e173584f15..171e0dd87c9 100644 --- a/llvm/utils/gn/secondary/llvm/tools/lli/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/tools/lli/BUILD.gn @@ -22,7 +22,7 @@ executable("lli") { sources = [ "lli.cpp", ] - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # Corresponds to export_executable_symbols() in cmake. ldflags = [ "-rdynamic" ] } diff --git a/llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn b/llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn index 3cc62d3888f..135b952c153 100644 --- a/llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn @@ -1,8 +1,8 @@ import("//llvm/version.gni") lto_target_type = "shared_library" -if (host_os == "linux") { - # Linux needs -fPIC to build shared libs but they aren't on by default. +if (host_os != "mac" && host_os != "win") { + # ELF targets need -fPIC to build shared libs but they aren't on by default. # For now, make libclang a static lib there. lto_target_type = "static_library" } diff --git a/llvm/utils/gn/secondary/llvm/tools/opt/BUILD.gn b/llvm/utils/gn/secondary/llvm/tools/opt/BUILD.gn index 7deae1c79c3..2bf062c4dc2 100644 --- a/llvm/utils/gn/secondary/llvm/tools/opt/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/tools/opt/BUILD.gn @@ -32,7 +32,7 @@ executable("opt") { # Support plugins. # FIXME: Disable dead stripping once other binaries are dead-stripped. - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # Corresponds to export_executable_symbols() in cmake. ldflags = [ "-rdynamic" ] } diff --git a/llvm/utils/gn/secondary/llvm/triples.gni b/llvm/utils/gn/secondary/llvm/triples.gni index 1987afa0f08..a82bd9b921b 100644 --- a/llvm/utils/gn/secondary/llvm/triples.gni +++ b/llvm/utils/gn/secondary/llvm/triples.gni @@ -1,5 +1,7 @@ if (current_cpu == "x64") { - if (current_os == "linux") { + if (current_os == "freebsd") { + llvm_current_triple = "x86_64-unknown-freebsd" + } else if (current_os == "linux") { llvm_current_triple = "x86_64-unknown-linux-gnu" } else if (current_os == "mac") { llvm_current_triple = "x86_64-apple-darwin" diff --git a/llvm/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn b/llvm/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn index 6bf6e7044c2..4ad9317a21e 100644 --- a/llvm/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn @@ -17,9 +17,9 @@ if (host_os != "win") { "//llvm/include/llvm/IR:public_tablegen", ] - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # The GN build currently doesn't globally pass -fPIC, but that's - # needed for building .so files on Linux. Just pass it manually + # needed for building .so files on ELF. Just pass it manually # for loadable_modules for now. cflags = [ "-fPIC" ] } @@ -46,7 +46,7 @@ unittest("PluginsTests") { defines = [ "LLVM_ENABLE_PLUGINS" ] } - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # Corresponds to export_executable_symbols() in cmake. ldflags = [ "-rdynamic" ] } diff --git a/llvm/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn b/llvm/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn index a04559e74c6..aac3da706d1 100644 --- a/llvm/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn @@ -15,9 +15,9 @@ template("dynlib_add_module") { "PipSqueak.cpp", ] - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # The GN build currently doesn't globally pass -fPIC, but that's - # needed for building .so files on Linux. Just pass it manually + # needed for building .so files on ELF. Just pass it manually # for loadable_modules for now. cflags = [ "-fPIC" ] } @@ -42,7 +42,7 @@ unittest("DynamicLibraryTests") { "ExportedFuncs.cpp", ] - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # Corresponds to export_executable_symbols() in cmake. ldflags = [ "-rdynamic" ] } |