pr20717.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. # pr20717.sh -- test --gc-sections for an unused orphan section
  3. # when the last section in the linker script has a KEEP statement.
  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. pattern=$2
  23. if grep -q "$pattern" "$file"
  24. then
  25. echo "Garbage collection failed to collect :"
  26. echo " $pattern"
  27. exit 1
  28. fi
  29. }
  30. check pr20717.stdout "unused"