abicheck.sh portability

Guido Berhoerster gber at opensuse.org
Wed Mar 23 17:07:13 CET 2011


the abicheck.sh script included with libxfce4ui, exo, thunar,
xfce4-panel, xfconf, libxfce4util, and thunar-vfs which verifies
the symbol table uses non-portable constructs which currently
cause buildbot builds to fail on the Solaris platform.

With the common build environment Solaris nm is in a $PATH ahead
of GNU nm and the "nm -D" output format differs. IMO the best
solution is using the -P option which produces a POSIX-specified
output format on both nm implementations, hence I'd suggest:

nm -D -g -P libfoo.so | awk '$2~/^[DRT]$/&&$1~/^[^_]/{print $1}' >actual-abi

(The alternative would be to add a Solaris-specific section and
either specify the full path /usr/gnu/bin/nm or use gnm instead
of nm, or use "elfdump -T SHT_DYNSYM libfoo.so | awk
'$8~/^\.(text|rodata)$/{print $9}' | sort >actual-abi".)

While on OpenIndiana/Solaris Express both the gcc preprocessor
(/usr/gnu/bin/cpp) and a separate preprocessor (not in $PATH but
in /usr/lib/cpp) are available, SunStudio uses its own built-in
preprocessor. IMHO it might be a good idea to use the same
preprocessor used by the compiler and this can be achieved in a
portable way by invoking it with "$CC -E" (line markers can be
stripped with sed). How about:

${CC:-cc} -E -DINCLUDE_INTERNAL_SYMBOLS -DINCLUDE_VARIABLES -DALL_FILES ${srcdir:-.}/libfoo.symbols | sed 's/ G_GNUC.*$//;s/ PRIVATE//;/^[# ]*$/d' | sort >expected-abi

Guido Berhoerster

More information about the Xfce4-dev mailing list