audit.exp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Expect script for various ELF tests.
  2. # Copyright (C) 2009-2022 Free Software Foundation, Inc.
  3. #
  4. # This file is part of the GNU Binutils.
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  19. # MA 02110-1301, USA.
  20. #
  21. # Exclude non-ELF targets.
  22. if ![is_elf_format] {
  23. return
  24. }
  25. # Skip targets where -shared is not supported
  26. if ![check_shared_lib_support] {
  27. return
  28. }
  29. # Check if compiler works
  30. if { ![check_compiler_available] } {
  31. return
  32. }
  33. set build_tests {
  34. {"Run with -paudit.so"
  35. "-Wl,--audit=tmpdir/audit.so" ""
  36. {main.c} {{"readelf" {-d} "audit.rd"}} "audit.out"}
  37. {"Run with -Paudit.so"
  38. "-Wl,-Ptmpdir/audit.so" ""
  39. {main.c} {{"readelf" {-d} "depaudit.rd"}} "depaudit.out"}
  40. {"Run with --depaudit=audit.so"
  41. "-Wl,--depaudit=tmpdir/audit.so" ""
  42. {main.c} {{"readelf" {-d} "depaudit.rd"}} "depaudit2.out"}
  43. {"Run with shared with --audit"
  44. "-shared -Wl,--audit=tmpdir/audit.so" "-fPIC"
  45. {main.c} {} "libusesaudit.so"}
  46. {"Run with shared with three --audit"
  47. "-shared -Wl,--audit=tmpdir/audit.so -Wl,--audit=tmpdir/audit2.so \
  48. -Wl,--audit=tmpdir/audit3.so"
  49. "-fPIC"
  50. {main.c} {} "libusesaudit2.so"}
  51. {"Run with -lusesaudit"
  52. "-Ltmpdir/ -lusesaudit" ""
  53. {main.c} {{"readelf" {-d} "depaudit.rd"}} "useslibusesaudit.out"}
  54. {"Run with -lusesaudit -lusesaudit2"
  55. "-Ltmpdir/ -lusesaudit -lusesaudit2" ""
  56. {main.c} {{"readelf" {-d} "depaudit2.rd"}} "useslibusesaudit2.out"}
  57. {"Link with -z globalaudit"
  58. "-Wl,-Paudit.so -Wl,-z,globalaudit" ""
  59. {main.c} {{"readelf" {-d} "globalaudit.rd"}} "globalaudit.out"}
  60. }
  61. run_cc_link_tests $build_tests