just-symbols.exp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Expect script for ld --just-symbols tests.
  2. # Copyright (C) 2020-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. # SH/PE targets complain about zero VMA.
  22. # i386-msdos doesn't have .data
  23. # tic30-coff has a weird 32-bit reloc that divides sym value by four
  24. # alpha-dec-vms wants a bunch of libs to link
  25. if { [istarget sh-*-pe]
  26. || [istarget *-*-msdos]
  27. || [istarget *c30-*-*]
  28. || [istarget alpha-*-vms] } {
  29. return
  30. }
  31. set saved_LDFLAGS "$LDFLAGS"
  32. if { [is_pecoff_format] } then {
  33. # Avoid auto image-basing.
  34. set LDFLAGS "$LDFLAGS --image-base 0"
  35. } elseif { [is_xcoff_format] } then {
  36. set LDFLAGS "$LDFLAGS -bnogc"
  37. }
  38. run_ld_link_tests [list \
  39. [list "Object for --just-symbols test" \
  40. "$LDFLAGS -r -T just-symbols.ld" "" \
  41. "" \
  42. {just-symbols-0.s} \
  43. {} \
  44. "just-symbols-r"] \
  45. [list "Executable for --just-symbols test" \
  46. "$LDFLAGS -e 0 -T just-symbols.ld" "" \
  47. "" \
  48. {just-symbols-0.s} \
  49. {} \
  50. "just-symbols-0"] \
  51. [list "Object with --just-symbols test" \
  52. "$LDFLAGS -e 0 -T just-symbols.ld --just-symbols=tmpdir/just-symbols-0.o" "" \
  53. "" \
  54. {just-symbols-1.s} \
  55. {{objdump {-s -j .data} just-symbols-1.dd}} \
  56. "just-symbols-1obj"] \
  57. [list "Executable with --just-symbols test" \
  58. "$LDFLAGS -e 0 -T just-symbols.ld --just-symbols=tmpdir/just-symbols-0" "" \
  59. "" \
  60. {just-symbols-1.s} \
  61. {{objdump {-s -j .data} just-symbols-1.dd}} \
  62. "just-symbols-1exe"] \
  63. ]
  64. set LDFLAGS "$saved_LDFLAGS"