arm_abs_global.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh
  2. # arm_abs_global.sh -- test ARM absolute relocations against global symbols.
  3. # Copyright (C) 2010-2015 Free Software Foundation, Inc.
  4. # Written by Doug Kwan <dougkwan@google.com>
  5. # This file is part of gold.
  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. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  17. # MA 02110-1301, USA.
  18. # This file goes with the assembler source file arm_abs_global.s,
  19. # that is assembled and linked with a shared object libarm_abs.so. We
  20. # want to check that a MOV[TW] instruction referencing an external function
  21. # causes a PLT to be created.
  22. check()
  23. {
  24. file=$1
  25. sym=$2
  26. reloc=$3
  27. found=`grep " $sym\$" $file`
  28. if test -z "$found"; then
  29. echo "Symbol $sym not found."
  30. exit 1
  31. fi
  32. match_reloc=`grep " $sym\$" $file | grep " $reloc "`
  33. if test -z "$match_reloc"; then
  34. echo "Expected symbol $sym to have relocation $reloc but found"
  35. echo "$found"
  36. exit 1
  37. fi
  38. }
  39. check "arm_abs_global.stdout" "_movt_abs_global" "R_ARM_JUMP_SLOT"
  40. check "arm_abs_global.stdout" "_movw_abs_global" "R_ARM_JUMP_SLOT"
  41. check "arm_abs_global.stdout" "_thm_movt_abs_global" "R_ARM_JUMP_SLOT"
  42. check "arm_abs_global.stdout" "_thm_movw_abs_global" "R_ARM_JUMP_SLOT"
  43. check "arm_abs_global.stdout" "_abs32_global_plt" "R_ARM_JUMP_SLOT"
  44. check "arm_abs_global.stdout" "_abs32_global" "R_ARM_ABS32"
  45. exit 0