| # Copyright 2017 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/clang/clang.gni") |
| import("//build/config/sysroot.gni") |
| |
| config("compiler") { |
| cflags = [] |
| cflags_c = [] |
| cflags_cc = [] |
| ldflags = [ |
| "-static-libstdc++", |
| |
| # Generate build-id for all binaries so we can use the build-id directory |
| # scheme when using strip the same way we do for Fuchsia. |
| "-Wl,--build-id", |
| |
| # Use GNU style for linker's hash tables which is more efficient. |
| "-Wl,--hash-style=gnu", |
| |
| # Set rpath to find dynamically linked libraries placed next to executables |
| # in the host build directory. |
| "-Wl,-rpath=\$ORIGIN/", |
| ] |
| configs = [ |
| ":sysroot", |
| ":target", |
| ] |
| |
| # TODO(TC-74) The implicitly linked static libc++.a depends on these. |
| libs = [ |
| "dl", |
| "pthread", |
| ] |
| lib_dirs = [ rebase_path("//buildtools/${host_platform}/clang/lib") ] |
| asmflags = cflags + cflags_c |
| } |
| |
| config("sysroot") { |
| cflags = [ "--sysroot=$sysroot" ] |
| ldflags = cflags |
| asmflags = cflags |
| } |
| |
| config("target") { |
| cflags = [ "--target=$clang_target" ] |
| asmflags = cflags |
| ldflags = cflags |
| } |