sframe: Add tests for PR ld/32769

Add simple tests that verify the behavior of garbage collection of
SFrame sections during linking.

x86_64-specific tests:
  - sframe-gc-sections-1.d checks that none of the functions get
    discarded with --gc-sections
  - sframe-gc-sections-2a.d checks the behavior of --gc-sections with two
    distinct .text.* sections (similar to -ffunction-sections compiler
    option)
  - sframe-gc-sections-2b.d checks the same behaviour as
    sframe-gc-sections-2a.d, but with a linker script that discards
    .eh_frame sections.  This testcase is keep it ensured that the two
    section's GC behaviours are not unnecessarily inter-twined.

All targets supporting sframe tests:
   - pr32769.rd simple linking test in presence of --gc-sections
     option.
   - pr32769-2.d checks the behavior of --gc-sections with two .text.*
     sections, one section is discarded
   - pr32769-2r.d Like the above, but using -r option when linking and
     checking for the relocations.
   - pr32769-3.d checks the behavior of --gc-sections with multiple
     sections, none is drop.

ld/
	PR ld/32769
	* testsuite/ld-sframe/pr32769.rd: New file.
	* testsuite/ld-sframe/pr32769.s: Likewise.
	* testsuite/ld-sframe/pr32769-2.d: Likewise.
	* testsuite/ld-sframe/pr32769-2r.d: Likewise.
	* testsuite/ld-sframe/pr32769-2.s: Likewise.
	* testsuite/ld-sframe/pr32769-3.d: Likewise.
	* testsuite/ld-sframe/pr32769-3.s: Likewise.
	* testsuite/ld-sframe/sframe.exp: Add pr32769 test.
	* testsuite/ld-x86-64/sframe-baz.s: New file.
	* testsuite/ld-x86-64/sframe-gc-sections-1.d: Likewise.
	* testsuite/ld-x86-64/sframe-gc-sections-2.s: Likewise.
	* testsuite/ld-x86-64/sframe-gc-sections-2a.d: Likewise.
	* testsuite/ld-x86-64/sframe-gc-sections-2b.d: Likewise.
	* testsuite/ld-x86-64/sframe-gc-sections-2b.t: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Add new sframe gc tests.

Co-authored-by: Indu Bhagat <indu.bhagat@oracle.com>
Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
(cherry-picked from commit ae82750860f5aff1ff8a42542b87e7ad33f18b97)
15 files changed