summaryrefslogtreecommitdiff
path: root/llvm
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2019-01-15 08:14:38 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2019-01-15 08:14:38 +0000
commita46a21f783e69ce9a8ff476c8fb92ca03103bc87 (patch)
tree39eb55bd4825abb704a1ec2385576b9066872e3a /llvm
parent85e2d7f946f4f2d6fcd6dbb89901924eda6b4950 (diff)
gn build: Make a couple of improvements to the unix toolchain.
Add an asm tool (will be required for building sanitizer_common on x64) and set a soname for DSOs so that anything that links against them gets the correct DT_NEEDED. Differential Revision: https://reviews.llvm.org/D56705
Diffstat (limited to 'llvm')
-rw-r--r--llvm/utils/gn/build/toolchain/BUILD.gn14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/utils/gn/build/toolchain/BUILD.gn b/llvm/utils/gn/build/toolchain/BUILD.gn
index 61c0418cacd..7a2e584c3a4 100644
--- a/llvm/utils/gn/build/toolchain/BUILD.gn
+++ b/llvm/utils/gn/build/toolchain/BUILD.gn
@@ -39,6 +39,16 @@ template("unix_toolchain") {
]
}
+ tool("asm") {
+ depfile = "{{output}}.d"
+ command = "$cc -MMD -MF $depfile -o {{output}} -c {{source}} {{defines}} {{include_dirs}} {{asmflags}} $target_cflags"
+ depsformat = "gcc"
+ description = "ASM {{output}}"
+ outputs = [
+ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+ ]
+ }
+
tool("alink") {
if (current_os == "mac") {
command = "libtool -static -no_warning_for_no_symbols {{arflags}} -o {{output}} {{inputs}}"
@@ -62,7 +72,7 @@ template("unix_toolchain") {
command = "$ld -shared {{ldflags}} -o $outfile {{libs}} {{inputs}} $target_ldflags"
default_output_extension = ".dylib"
} else {
- command = "$ld -shared {{ldflags}} -Wl,-z,defs -o $outfile {{libs}} {{inputs}} $target_ldflags"
+ command = "$ld -shared {{ldflags}} -Wl,-z,defs -Wl,-soname,{{target_output_name}}{{output_extension}} -o $outfile {{libs}} {{inputs}} $target_ldflags"
default_output_extension = ".so"
}
description = "SOLINK $outfile"
@@ -80,7 +90,7 @@ template("unix_toolchain") {
command = "$ld -shared {{ldflags}} -Wl,-flat_namespace -Wl,-undefined,suppress -o $outfile {{libs}} {{inputs}} $target_ldflags"
default_output_extension = ".dylib"
} else {
- command = "$ld -shared {{ldflags}} -o $outfile {{libs}} {{inputs}} $target_ldflags"
+ command = "$ld -shared {{ldflags}} -Wl,-soname,{{target_output_name}}{{output_extension}} -o $outfile {{libs}} {{inputs}} $target_ldflags"
default_output_extension = ".so"
}
description = "SOLINK $outfile"