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" } 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/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/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"