[PATCH] D57870: gn build: Make check-lld and check-clang pass on FreeBSD.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 6 17:43:24 PST 2019
pcc created this revision.
pcc added reviewers: thakis, phosek.
Herald added a subscriber: srhines.
Herald added a project: LLVM.
Mostly achieved by assuming that anything that isn't Win or Mac is ELF,
which seems reasonable enough for now.
Repository:
rL LLVM
https://reviews.llvm.org/D57870
Files:
llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
llvm/utils/gn/secondary/llvm/test/BUILD.gn
llvm/utils/gn/secondary/llvm/triples.gni
Index: llvm/utils/gn/secondary/llvm/triples.gni
===================================================================
--- llvm/utils/gn/secondary/llvm/triples.gni
+++ 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"
Index: llvm/utils/gn/secondary/llvm/test/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/llvm/test/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/test/BUILD.gn
@@ -83,24 +83,28 @@
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)
}
Index: llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
@@ -269,12 +269,12 @@
]
}
- 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) {
Index: llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
+++ llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
@@ -12,8 +12,8 @@
# - 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"
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57870.185685.patch
Type: text/x-patch
Size: 3187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190207/3f93575d/attachment.bin>
More information about the llvm-commits
mailing list