Index: llvm/trunk/utils/gn/secondary/clang/tools/libclang/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/clang/tools/libclang/BUILD.gn +++ llvm/trunk/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" } Index: llvm/trunk/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn +++ llvm/trunk/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/trunk/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn +++ llvm/trunk/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn @@ -11,9 +11,9 @@ "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" ] } Index: llvm/trunk/utils/gn/secondary/llvm/test/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/test/BUILD.gn +++ llvm/trunk/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/trunk/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn +++ llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn @@ -11,9 +11,9 @@ "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" ] } Index: llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn +++ llvm/trunk/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn @@ -33,7 +33,7 @@ # 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" ] Index: llvm/trunk/utils/gn/secondary/llvm/tools/llc/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/tools/llc/BUILD.gn +++ llvm/trunk/utils/gn/secondary/llvm/tools/llc/BUILD.gn @@ -21,7 +21,7 @@ # 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" ] } Index: llvm/trunk/utils/gn/secondary/llvm/tools/lli/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/tools/lli/BUILD.gn +++ llvm/trunk/utils/gn/secondary/llvm/tools/lli/BUILD.gn @@ -22,7 +22,7 @@ sources = [ "lli.cpp", ] - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # Corresponds to export_executable_symbols() in cmake. ldflags = [ "-rdynamic" ] } Index: llvm/trunk/utils/gn/secondary/llvm/tools/lto/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/tools/lto/BUILD.gn +++ llvm/trunk/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" } Index: llvm/trunk/utils/gn/secondary/llvm/tools/opt/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/tools/opt/BUILD.gn +++ llvm/trunk/utils/gn/secondary/llvm/tools/opt/BUILD.gn @@ -32,7 +32,7 @@ # 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" ] } Index: llvm/trunk/utils/gn/secondary/llvm/triples.gni =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/triples.gni +++ llvm/trunk/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/trunk/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn +++ llvm/trunk/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn @@ -17,9 +17,9 @@ "//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 @@ defines = [ "LLVM_ENABLE_PLUGINS" ] } - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # Corresponds to export_executable_symbols() in cmake. ldflags = [ "-rdynamic" ] } Index: llvm/trunk/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn +++ llvm/trunk/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn @@ -15,9 +15,9 @@ "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 @@ "ExportedFuncs.cpp", ] - if (host_os == "linux") { + if (host_os != "mac" && host_os != "win") { # Corresponds to export_executable_symbols() in cmake. ldflags = [ "-rdynamic" ] }