summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml1
-rwxr-xr-xMeta/check-symbols.sh21
2 files changed, 22 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml
index 9eb469529b..39ad4027d0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -49,6 +49,7 @@ script:
- cd Build
- cmake .. -DBUILD_LAGOM=1 -DALL_THE_DEBUG_MACROS=1
- make -j2
+- Meta/check-symbols.sh
- CTEST_OUTPUT_ON_FAILURE=1 make test
- cd Meta/Lagom
- DISABLE_DBG_OUTPUT=1 ./test-js
diff --git a/Meta/check-symbols.sh b/Meta/check-symbols.sh
new file mode 100755
index 0000000000..8d28eeda6d
--- /dev/null
+++ b/Meta/check-symbols.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
+cd "$script_path/.."
+
+# The __cxa_guard_* calls are generated for (non trivial) initialzation of local static objects.
+# These symbols are OK to use within serenity code, but they are problematic in LibC because their
+# existence breaks ports (the implementation of these symbols resides in libstdc++.a which we do not link against in ports).
+# To eliminate the need for these symbols, avoid doing non-trivial construction of local statics in LibC.
+
+FORBIDDEN_SYMBOLS="__cxa_guard_acquire __cxa_guard_release"
+LIBC_PATH="Build/Libraries/LibC/libc.a"
+for forbidden_symbol in $FORBIDDEN_SYMBOLS; do
+ # check if symbol is undefined
+ nm $LIBC_PATH | grep "U $forbidden_symbol"
+ if [ $? -eq 0 ]; then
+ echo "Forbidden undefined symbol in LibC: $forbidden_symbol"
+ echo "See comment in Meta/check-symbols.sh for more info"
+ exit 1
+ fi
+done