arm_target1_rel.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/sh
  2. # arm_target1_rel.sh -- test --target1-rel option.
  3. # This test is based on ld/testsuite/ld-arm/arm-target1-rel.d.
  4. # Copyright (C) 2016-2022 Free Software Foundation, Inc.
  5. # Written by Igor Kudrin <ikudrin@accesssoftek.com>.
  6. # This file is part of gold.
  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. # 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. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  18. # MA 02110-1301, USA.
  19. check()
  20. {
  21. file=$1
  22. section=$2
  23. pattern=$3
  24. found=`fgrep "Contents of section $section:" -A1 $file | tail -n 1`
  25. if test -z "$found"; then
  26. echo "Section \"$section\" not found in file $file"
  27. echo ""
  28. echo "Actual output below:"
  29. cat "$file"
  30. exit 1
  31. fi
  32. match_pattern=`echo "$found" | grep -e "$pattern"`
  33. if test -z "$match_pattern"; then
  34. echo "Expected pattern was not found in section \"$section\":"
  35. echo " $pattern"
  36. echo ""
  37. echo "Actual output below:"
  38. cat "$file"
  39. exit 1
  40. fi
  41. }
  42. # foo = 0x8004
  43. # foo - 0x8000 = 4
  44. check "arm_target1_rel.stdout" ".text" "\<8000[[:space:]]\+\(04000000\|00000004\)\b"
  45. exit 0