Index: build/common.gypi |
diff --git a/build/common.gypi b/build/common.gypi |
index e498d3eb467aeb94a8a835357a32be77ddc4f7f1..667284434e4dbbd42a1206e776ac17f7940ef24d 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,28 @@ |
'-march=armv7-a', |
'-mtune=cortex-a8', |
], |
+ 'target_conditions': [ |
+ [ '_type=="executable"', { |
+ # Statically link whole libstdc++ and libgcc in |
+ # executables to ensure only one copy at runtime. |
+ 'ldflags': [ |
+ # 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', |
+ ], |
+ }] |
+ ], |
}], |
], |
}], |