From 256662f70144e542f4f4c7ba96334a0f1f9977b5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 3 Dec 2014 16:14:48 +0100 Subject: [PATCH 1/2] build: adjust tools/check-exports.sh Now that the version scripts might have different sections, the previous check-exports.sh script no longer works. --- tools/check-exports.sh | 57 ++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/tools/check-exports.sh b/tools/check-exports.sh index b5a9e952b5..2049d0b3cb 100755 --- a/tools/check-exports.sh +++ b/tools/check-exports.sh @@ -4,22 +4,53 @@ LC_ALL=C export LC_ALL stat=0 -so=$1 -def=$2 +so="$1" +def="$2" +PATTERN="_ANCHOR_" -# Have to prefix with a tab and suffix with a ';' to match .ver file format -get_syms='nm "$so" | grep "^[[:xdigit:]]\+ T " | sed "s/^[[:xdigit:]]\+ T //" | sed "s/^/\t/" | sed "s/$/;/"' +TMPFILE="$(mktemp .nm-check-exports.XXXXXX)" -echo $so: checking exported symbols against $def -{ - echo "{" - echo "global:" - eval $get_syms | sort -u - echo "local:" - echo " *;" - echo "};" -} | diff -u "$def" - >&2 || stat=1 +get_syms() { + nm "$1" | + sed -n 's/^[[:xdigit:]]\+ T //p' | + sort +} +get_syms_from_def() { + # be strict and only parse entries that start with one \t and end with a ';' + sed -n 's/^\t\([_a-zA-Z0-9]\+\);$/\1/p' "$1" | + grep '^\*$' -v | + sort +} + +anchor() { + sed "s/.*/$PATTERN\0$PATTERN/" +} + +unanchor() { + sed "s/^$PATTERN\(.*\)$PATTERN\$/\1/" +} + + +get_syms "$so" | anchor > "$TMPFILE" +WRONG="$(get_syms_from_def "$def" | anchor | grep -F -f - "$TMPFILE" -v)" +RESULT=$? +if [ $RESULT -eq 0 ]; then + stat=1 + echo ">>library \"$so\" exports symbols that are not in linker script \"$def\":" + echo "$WRONG" | unanchor | nl +fi + +get_syms_from_def "$def" | anchor > "$TMPFILE" +WRONG="$(get_syms "$so" | anchor | grep -F -f - "$TMPFILE" -v)" +RESULT=$? +if [ $RESULT -eq 0 ]; then + stat=1 + echo ">>linker script \"$def\" contains symbols that are not exported by library \"$so\":" + echo "$WRONG" | unanchor | nl +fi + +rm -rf "$TMPFILE" exit $stat From 2788c344c3665b758cc893cf7a192c138fec4ad3 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 6 Oct 2014 17:12:38 +0200 Subject: [PATCH 2/2] libnm/build: add versioning to linker script https://bugzilla.gnome.org/show_bug.cgi?id=741069 --- libnm/libnm.ver | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libnm/libnm.ver b/libnm/libnm.ver index d56a411bfc..718d1f086a 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1,4 +1,9 @@ -{ +__libnm_local { +local: + *; +}; + +libnm_1_0_0 { global: nm_802_11_ap_flags_get_type; nm_802_11_ap_security_flags_get_type; @@ -841,6 +846,4 @@ global: nm_wimax_nsp_get_signal_quality; nm_wimax_nsp_get_type; nm_wimax_nsp_network_type_get_type; -local: - *; -}; +} __libnm_local;