[llvm] r353470 - gn build: Make check-{clang, lld, llvm} pass on FreeBSD.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 7 13:24:30 PST 2019


Author: pcc
Date: Thu Feb  7 13:24:30 2019
New Revision: 353470

URL: http://llvm.org/viewvc/llvm-project?rev=353470&view=rev
Log:
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

Modified:
    llvm/trunk/utils/gn/secondary/clang/tools/libclang/BUILD.gn
    llvm/trunk/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
    llvm/trunk/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn
    llvm/trunk/utils/gn/secondary/llvm/test/BUILD.gn
    llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn
    llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn
    llvm/trunk/utils/gn/secondary/llvm/tools/llc/BUILD.gn
    llvm/trunk/utils/gn/secondary/llvm/tools/lli/BUILD.gn
    llvm/trunk/utils/gn/secondary/llvm/tools/lto/BUILD.gn
    llvm/trunk/utils/gn/secondary/llvm/tools/opt/BUILD.gn
    llvm/trunk/utils/gn/secondary/llvm/triples.gni
    llvm/trunk/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn
    llvm/trunk/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn

Modified: llvm/trunk/utils/gn/secondary/clang/tools/libclang/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/clang/tools/libclang/BUILD.gn?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/clang/tools/libclang/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/clang/tools/libclang/BUILD.gn Thu Feb  7 13:24:30 2019
@@ -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"
 }

Modified: llvm/trunk/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn Thu Feb  7 13:24:30 2019
@@ -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) {

Modified: llvm/trunk/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn Thu Feb  7 13:24:30 2019
@@ -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" ]
   }

Modified: llvm/trunk/utils/gn/secondary/llvm/test/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/llvm/test/BUILD.gn?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/llvm/test/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/llvm/test/BUILD.gn Thu Feb  7 13:24:30 2019
@@ -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)
   }

Modified: llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn Thu Feb  7 13:24:30 2019
@@ -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" ]
   }

Modified: llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn Thu Feb  7 13:24:30 2019
@@ -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" ]

Modified: llvm/trunk/utils/gn/secondary/llvm/tools/llc/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/llvm/tools/llc/BUILD.gn?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/llvm/tools/llc/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/llvm/tools/llc/BUILD.gn Thu Feb  7 13:24:30 2019
@@ -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" ]
   }

Modified: llvm/trunk/utils/gn/secondary/llvm/tools/lli/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/llvm/tools/lli/BUILD.gn?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/llvm/tools/lli/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/llvm/tools/lli/BUILD.gn Thu Feb  7 13:24:30 2019
@@ -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" ]
   }

Modified: llvm/trunk/utils/gn/secondary/llvm/tools/lto/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/llvm/tools/lto/BUILD.gn?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/llvm/tools/lto/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/llvm/tools/lto/BUILD.gn Thu Feb  7 13:24:30 2019
@@ -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"
 }

Modified: llvm/trunk/utils/gn/secondary/llvm/tools/opt/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/llvm/tools/opt/BUILD.gn?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/llvm/tools/opt/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/llvm/tools/opt/BUILD.gn Thu Feb  7 13:24:30 2019
@@ -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" ]
   }

Modified: llvm/trunk/utils/gn/secondary/llvm/triples.gni
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/llvm/triples.gni?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/llvm/triples.gni (original)
+++ llvm/trunk/utils/gn/secondary/llvm/triples.gni Thu Feb  7 13:24:30 2019
@@ -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"

Modified: llvm/trunk/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn Thu Feb  7 13:24:30 2019
@@ -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" ]
   }

Modified: llvm/trunk/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn?rev=353470&r1=353469&r2=353470&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn Thu Feb  7 13:24:30 2019
@@ -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" ]
   }




More information about the llvm-commits mailing list