run.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. # Copyright 2021 Yury Gribov
  3. #
  4. # The MIT License (MIT)
  5. #
  6. # Use of this source code is governed by MIT license that can be
  7. # found in the LICENSE.txt file.
  8. # This test checks that exceptions are successfully propagated
  9. # through implib wrappers.
  10. set -eu
  11. cd $(dirname $0)
  12. if test -n "${1:-}"; then
  13. ARCH="$1"
  14. fi
  15. . ../common.sh
  16. export LD_LIBRARY_PATH=.:${LD_LIBRARY_PATH:-}
  17. $CC $CFLAGS -shared -fPIC interposed.c -o libinterposed.so
  18. ${PYTHON:-} ../../implib-gen.py -q --target $TARGET libinterposed.so
  19. $CC $CFLAGS -shared -fPIC user.c libinterposed.so.tramp.S libinterposed.so.init.c -o libuser.so
  20. $CC $CFLAGS -shared -fPIC user.c libinterposed.so.tramp.S libinterposed.so.init.c -DIMPLIB_EXPORT_SHIMS -o libuser_export_shims.so
  21. if test $(readelf -D -sW libuser_export_shims.so | grep foo | wc -l) -eq 0; then
  22. echo "Shim symbol NOT exported by default" >&2
  23. exit 1
  24. fi
  25. if test $(readelf -D -sW libuser.so | grep foo | wc -l) -gt 0; then
  26. echo "Hidden shim symbol exported" >&2
  27. exit 1
  28. fi
  29. echo SUCCESS