Skip to content

Commit

Permalink
Merge pull request #130 from bgilbert/abi
Browse files Browse the repository at this point in the history
Check for stray exported symbols in OpenSlide DLL
  • Loading branch information
bgilbert authored Sep 25, 2023
2 parents f9944ec + 3286123 commit b9627a2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ log_version() {
bdist() {
# Build binary distribution
local package name version srcdir licensedir zipdir prev_ver_suffix input
local symbols

# Rebuild OpenSlide if suffix changed
prev_ver_suffix="$(cat ${build_bits}/.suffix 2>/dev/null ||:)"
Expand Down Expand Up @@ -355,6 +356,22 @@ bdist() {
fi
done
if [ "$package" = openslide ]; then
# check for extra symbol exports
symbols=$(${objdump} -p "${root}"/bin/libopenslide-*.dll | \
awk -v t=0 \
-e '/Ordinal\/Name Pointer/ {t = 1; next}' \
-e 't == 0 {next}' \
-e '/^$/ {exit}' \
-e '{print $3}')
if [ -z "${symbols}" ]; then
echo "Couldn't find symbols in OpenSlide DLL"
exit 1
fi
if symbols=$(grep -v ^openslide_ <<<"${symbols}"); then
echo -e "\nUnexpected exports:\n${symbols}"
exit 1
fi

mkdir -p "${zipdir}/lib"
cp "${root}/lib/libopenslide.dll.a" "${zipdir}/lib/libopenslide.lib"
mkdir -p "${zipdir}/include"
Expand Down Expand Up @@ -440,6 +457,7 @@ probe() {
cc=$(meson_config_key "${cross_file}" binaries c | tr -d "'")
ld=$(meson_config_key "${cross_file}" binaries ld | tr -d "'")
objcopy=$(meson_config_key "${cross_file}" binaries objcopy | tr -d "'")
objdump=$(meson_config_key "${cross_file}" binaries objdump | tr -d "'")
if ! type ${cc} >/dev/null 2>&1 ; then
echo "Couldn't find suitable compiler."
exit 1
Expand Down
1 change: 1 addition & 0 deletions meson/cross-win32.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ c = 'i686-w64-mingw32-gcc'
cpp = 'i686-w64-mingw32-g++'
ld = 'i686-w64-mingw32-ld'
objcopy = 'i686-w64-mingw32-objcopy'
objdump = 'i686-w64-mingw32-objdump'
# Fedora's ${build_host}-pkg-config clobbers search paths; avoid it
pkgconfig = 'pkg-config'
strip = 'i686-w64-mingw32-strip'
Expand Down
1 change: 1 addition & 0 deletions meson/cross-win64.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ld = 'x86_64-w64-mingw32-ld'
objcopy = 'x86_64-w64-mingw32-objcopy'
objdump = 'x86_64-w64-mingw32-objdump'
# Fedora's ${build_host}-pkg-config clobbers search paths; avoid it
pkgconfig = 'pkg-config'
strip = 'x86_64-w64-mingw32-strip'
Expand Down

0 comments on commit b9627a2

Please sign in to comment.