| Index: build/toolchain/gcc_toolchain.gni
|
| diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni
|
| index 9e53ef667e049ae8334475373de738342b5df3ad..91baa11b8473190d519cc501fb01378a5a5a6147 100644
|
| --- a/build/toolchain/gcc_toolchain.gni
|
| +++ b/build/toolchain/gcc_toolchain.gni
|
| @@ -14,6 +14,13 @@
|
| # build using this toolchain.)
|
| # - toolchain_os (What "os" should be set to when invoking a build using this
|
| # toolchain.)
|
| +#
|
| +# Optional parameters:
|
| +# - libs_section_prefix
|
| +# - libs_section_postfix
|
| +# The contents of these strings, if specified, will be placed around
|
| +# the libs section of the linker line. It allows one to inject libraries
|
| +# at the beginning and end for all targets in a toolchain.
|
| template("gcc_toolchain") {
|
| toolchain(target_name) {
|
| assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value")
|
| @@ -33,6 +40,19 @@ template("gcc_toolchain") {
|
| ar = invoker.ar
|
| ld = invoker.ld
|
|
|
| + # Bring these into our scope for string interpolation with default values.
|
| + if (defined(invoker.libs_section_prefix)) {
|
| + libs_section_prefix = invoker.libs_section_prefix
|
| + } else {
|
| + libs_section_prefix = ""
|
| + }
|
| +
|
| + if (defined(invoker.libs_section_postfix)) {
|
| + libs_section_postfix = invoker.libs_section_postfix
|
| + } else {
|
| + libs_section_postfix = ""
|
| + }
|
| +
|
| # Make these apply to all tools below.
|
| lib_prefix = "-l"
|
| lib_dir_prefix="-L"
|
| @@ -56,13 +76,13 @@ template("gcc_toolchain") {
|
| description = "AR \$out"
|
| }
|
| tool("solink") {
|
| - command = "if [ ! -e \$lib -o ! -e \${lib}.TOC ]; then $ld -shared \$ldflags -o \$lib -Wl,-soname=\$soname -Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archive \$libs && { readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.TOC; else $ld -shared \$ldflags -o \$lib -Wl,-soname=\$soname -Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archive \$libs && { readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.tmp && if ! cmp -s \${lib}.tmp \${lib}.TOC; then mv \${lib}.tmp \${lib}.TOC ; fi; fi"
|
| + command = "if [ ! -e \$lib -o ! -e \${lib}.TOC ]; then $ld -shared \$ldflags -o \$lib -Wl,-soname=\$soname -Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archive \$libs && { readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.TOC; else $ld -shared \$ldflags -o \$lib -Wl,-soname=\$soname -Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archive $libs_section_prefix \$libs $libs_section_postfix && { readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.tmp && if ! cmp -s \${lib}.tmp \${lib}.TOC; then mv \${lib}.tmp \${lib}.TOC ; fi; fi"
|
| description = "SOLINK \$lib"
|
| #pool = "link_pool"
|
| restat = "1"
|
| }
|
| tool("link") {
|
| - command = "$ld \$ldflags -o \$out -Wl,--start-group \$in \$solibs -Wl,--end-group \$libs"
|
| + command = "$ld \$ldflags -o \$out -Wl,--start-group \$in \$solibs -Wl,--end-group $libs_section_prefix \$libs $libs_section_postfix"
|
| description = "LINK \$out"
|
| #pool = "link_pool"
|
| }
|
|
|