Index: build/common.gypi |
diff --git a/build/common.gypi b/build/common.gypi |
index e498d3eb467aeb94a8a835357a32be77ddc4f7f1..40dbe5227342228fc07ce7678940eb2c4d0a088e 100644 |
--- a/build/common.gypi |
+++ b/build/common.gypi |
@@ -4148,7 +4148,7 @@ |
'-g', |
], |
'ldflags': [ |
- # We want to statically link libstdc++/libgcc_s. |
+ # We want to statically link libstdc++/libgcc. |
'-static-libstdc++', |
'-static-libgcc', |
], |
@@ -4160,6 +4160,34 @@ |
'-march=armv7-a', |
'-mtune=cortex-a8', |
], |
+ 'target_conditions': [ |
+ [ '_type=="executable" and OS!="android"', { |
bcf
2015/12/09 00:34:55
Android uses its own libstdc++ so we don't need th
|
+ # Statically link whole libstdc++ and libgcc in |
+ # executables to ensure only one copy at runtime. |
+ 'ldflags': [ |
+ # Note executables also get -static-stdlibc++/libgcc. |
+ # Despite including libstdc++/libgcc archives, we |
+ # still need to specify static linking for them in |
+ # order to prevent the executable from having a |
+ # dynamic dependency on them. |
+ |
+ # Export stdlibc++ and libgcc symbols to force shlibs |
+ # to refer to these symbols from the executable. |
+ '-Wl,--export-dynamic', |
+ |
+ '-lm', # stdlibc++ requires math.h |
+ |
+ # In case we redefined stdlibc++ symbols |
+ # (e.g. tc_malloc) |
+ '-Wl,--allow-multiple-definition', |
+ |
+ '-Wl,--whole-archive', |
+ '-l:libstdc++.a', |
+ '-l:libgcc.a', |
+ '-Wl,--no-whole-archive', |
+ ], |
+ }] |
+ ], |
}], |
], |
}], |