run.sh 992 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh
  2. # Copyright 2022 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 is a test for manual loading of destination library (--no-dlopen flag).
  9. # Run it like
  10. # ./run.sh ARCH
  11. # where ARCH stands for any supported arch (arm, x86_64, etc., see `implib-gen -h' for full list).
  12. # Note that you may need to install qemu-user for respective platform
  13. # (i386 also needs gcc-multilib).
  14. set -eu
  15. cd $(dirname $0)
  16. if test -n "${1:-}"; then
  17. ARCH="$1"
  18. fi
  19. . ../common.sh
  20. CFLAGS="-g -O2 $CFLAGS"
  21. LIBS='-ldl'
  22. # Build shlib to test against
  23. $CC $CFLAGS -shared -fPIC interposed.c -o libinterposed.so
  24. # Prepare implib
  25. ${PYTHON:-} ../../implib-gen.py -q --target $TARGET --no-dlopen libinterposed.so
  26. # Build app
  27. $CC $CFLAGS -fPIE main.c libinterposed.so.tramp.S libinterposed.so.init.c $LIBS
  28. LD_LIBRARY_PATH=.:${LD_LIBRARY_PATH:-} $INTERP ./a.out > a.out.log
  29. diff test.ref a.out.log
  30. echo SUCCESS