export-class.exp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # Expect script for symbol export classes, VAX variation.
  2. #
  3. # Copyright (C) 2013-2022 Free Software Foundation, Inc.
  4. #
  5. # This file is part of the GNU Binutils.
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  20. # MA 02110-1301, USA.
  21. #
  22. #
  23. # Written by Maciej W. Rozycki <macro@codesourcery.com>
  24. #
  25. # Exclude non-Linux targets; feel free to include your favorite one
  26. # if you like.
  27. if { ![istarget vax*-*-linux*] } {
  28. return
  29. }
  30. set testname "VAX symbol export class test"
  31. # Build an auxiliary shared object with conflicting versioned symbol
  32. # definitions.
  33. run_ld_link_tests [list \
  34. [list \
  35. "$testname (auxiliary shared object)" \
  36. "-shared -version-script ../ld-elf/export-class-lib.ver" "" \
  37. "-k" \
  38. { ../ld-elf/export-class-lib.s } \
  39. {} \
  40. "vax-export-class-lib.so" \
  41. ] \
  42. ]
  43. # Build a static object that pulls symbol definitions. It has to come
  44. # first before the auxiliary shared object and other static objects on
  45. # the linker's command line and hence we need to build it separately.
  46. run_ld_link_tests [list \
  47. [list \
  48. "$testname (initial static object)" \
  49. "-r" "" \
  50. "" \
  51. { ../ld-elf/export-class-ref.s } \
  52. {} \
  53. "vax-export-class-ref-r.o" \
  54. ] \
  55. ]
  56. # Build static objects that satisfy symbol dependencies and preempt
  57. # shared-object symbol definitions, and link all the objects built into
  58. # the final shared object. The command-line order of objects linked is
  59. # important to make sure the linker correctly preempts versioned symbols
  60. # from the auxiliary shared object and is as follows: ref, lib, dep, def.
  61. # Get a dump to make sure symbol dependencies are resolved internally.
  62. run_ld_link_tests [list \
  63. [list \
  64. "$testname (final shared object)" \
  65. "-shared -Tdata=0x12340000 tmpdir/vax-export-class-ref-r.o tmpdir/vax-export-class-lib.so" "" \
  66. "-k" \
  67. { ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \
  68. [list \
  69. [list readelf -r vax-export-class.rd] \
  70. [list readelf "-x .data" vax-export-class.xd] \
  71. ] \
  72. "vax-export-class.so" \
  73. ] \
  74. ]