ci: check the prefixing policy for runtime symbols (#9260)

* ci: check runtime symbol policy on travis and Appveyor
* tune check-symbol-names:
** ignore all local symbol
** ignore Caml_ prefix
** ignore x86: pic-related symbols
** windows: ignore debugging, unicode and wmain symbols
master
Florian Angeletti 2020-01-29 15:30:15 +01:00 committed by GitHub
parent b237282e97
commit 5302b09764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View File

@ -18,13 +18,23 @@ set -o pipefail
[ -z "$*" ] && { echo "Usage: $0 libfoo.a" 1>&2; exit 2; }
nm -A -P "$@" | awk '
nm -A -P "$@" | LC_ALL=C awk '
# ignore caml_foo, camlFoo_bar, _caml_foo, _camlFoo_bar
$2 ~ /^(_?caml[_A-Z])/ { next }
# ignore local and undefined symbols
$3 ~ /^[rbdtsU]$/ { next }
$3 ~ /^[a-zU]$/ { next }
# ignore "main", which should be externally linked
$2 ~ /^_?main$/ { next }
$2 ~ /^_?wmain$/ { next }
# Caml_state escapes the prefixing rule for now
$2 ~ /^_?Caml_state$/ { next }
# for x86 PIC mode
$2 ~ /^__x86.get_pc_thunk./ { next }
# for mingw32
$2 ~ /^.debug_/ { next }
# windows unicode support
$2 ~ /^_win_multi_byte_to_wide_char$/ { next }
$2 ~ /^_win_wide_char_to_multi_byte$/ { next }
# print the rest
{ found=1; print $1 " " $2 " " $3 }
# fail if there were any results

View File

@ -103,6 +103,11 @@ case "$1" in
test)
FULL_BUILD_PREFIX="$APPVEYOR_BUILD_FOLDER/../$BUILD_PREFIX"
run 'ocamlc.opt -version' "$FULL_BUILD_PREFIX-$PORT/ocamlc.opt" -version
if [[ $PORT = 'mingw32' ]] ; then
run "Check runtime symbols" \
"$FULL_BUILD_PREFIX-$PORT/tools/check-symbol-names" \
$FULL_BUILD_PREFIX-$PORT/runtime/*.a
fi
run "test $PORT" make -C "$FULL_BUILD_PREFIX-$PORT" tests
run "install $PORT" make -C "$FULL_BUILD_PREFIX-$PORT" install
if [[ $PORT = 'msvc64' ]] ; then

View File

@ -136,6 +136,8 @@ EOF
$MAKE world.opt
$MAKE ocamlnat
fi
echo Ensuring that all names are prefixed in the runtime
./tools/check-symbol-names runtime/*.a
cd testsuite
echo Running the testsuite with the normal runtime
$MAKE all