Index: build/toolchain/gcc_toolchain.gni |
diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni |
index 3421a9575bda75ed497f57cf2ec3b7e8b3587123..29b913759653962261e3e3d585c30dee95e2fa07 100644 |
--- a/build/toolchain/gcc_toolchain.gni |
+++ b/build/toolchain/gcc_toolchain.gni |
@@ -13,8 +13,6 @@ concurrent_links = exec_script("get_concurrent_links.py", [], "value") |
# - cxx |
# - ar |
# - ld |
-# - readelf |
-# - nm |
# and the following which is used in the toolchain_args |
# - toolchain_cpu (What "current_cpu" should be set to when invoking a |
# build using this toolchain.) |
@@ -42,9 +40,6 @@ template("gcc_toolchain") { |
assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") |
assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") |
assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") |
- assert(defined(invoker.readelf), |
- "gcc_toolchain() must specify a \"readelf\" value") |
- assert(defined(invoker.nm), "gcc_toolchain() must specify a \"nm\" value") |
assert(defined(invoker.toolchain_cpu), |
"gcc_toolchain() must specify a \"toolchain_cpu\"") |
assert(defined(invoker.toolchain_os), |
@@ -57,8 +52,16 @@ template("gcc_toolchain") { |
cxx = invoker.cxx |
ar = invoker.ar |
ld = invoker.ld |
- readelf = invoker.readelf |
- nm = invoker.nm |
+ if (defined(invoker.readelf)) { |
+ readelf = invoker.readelf |
+ } else { |
+ readelf = "readelf" |
+ } |
+ if (defined(invoker.nm)) { |
+ nm = invoker.nm |
+ } else { |
+ nm = "nm" |
+ } |
# Bring these into our scope for string interpolation with default values. |
if (defined(invoker.libs_section_prefix)) { |
@@ -145,6 +148,8 @@ template("gcc_toolchain") { |
temporary_tocname = sofile + ".tmp" |
link_command = |
"$ld -shared {{ldflags}} -o $sofile -Wl,-soname=$soname @$rspfile" |
+ assert(defined(readelf), "to solink you must have a readelf") |
+ assert(defined(nm), "to solink you must have an nm") |
toc_command = "{ $readelf -d $sofile | grep SONAME ; $nm -gD -f p $sofile | cut -f1-2 -d' '; } > $temporary_tocname" |
replace_command = "if ! cmp -s $temporary_tocname $tocfile; then mv $temporary_tocname $tocfile; fi" |