From 5b45e89f56db79fc22ecbb1657eff8ef39fc2c5f Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov Date: Mon, 10 May 2021 14:00:00 +0100 Subject: [PATCH] Enable linker garbage collection for the PRU target. bfd * elf32-pru.c (elf_backend_can_gc_sections): Define as 1. ld * testsuite/ld-elf/group8a.d: Remove pru from XFAIL list. * testsuite/ld-elf/group8b.d: Ditto. * testsuite/ld-elf/group9a.d: Ditto. * testsuite/ld-elf/group9b.d: Ditto. * testsuite/ld-elf/pr12851.d: Ditto. * testsuite/ld-elf/pr22677.d: Ditto. * testsuite/lib/ld-lib.exp (check_gc_sections_available): Remove pru from list. --- bfd/ChangeLog | 4 ++++ bfd/elf32-pru.c | 1 + ld/ChangeLog | 11 +++++++++++ ld/testsuite/ld-elf/group8a.d | 2 +- ld/testsuite/ld-elf/group8b.d | 2 +- ld/testsuite/ld-elf/group9a.d | 2 +- ld/testsuite/ld-elf/group9b.d | 2 +- ld/testsuite/ld-elf/pr12851.d | 2 +- ld/testsuite/ld-elf/pr22677.d | 2 +- ld/testsuite/lib/ld-lib.exp | 1 - 10 files changed, 22 insertions(+), 7 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 376e8fd540..39395faff3 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2021-05-10 Dimitar Dimitrov + + * elf32-pru.c (elf_backend_can_gc_sections): Define as 1. + 2021-05-08 Mike Frysinger * doc/Makefile.am (html-local, bfd/index.html): New targets. diff --git a/bfd/elf32-pru.c b/bfd/elf32-pru.c index e3001d5755..b936844084 100644 --- a/bfd/elf32-pru.c +++ b/bfd/elf32-pru.c @@ -1601,6 +1601,7 @@ pru_elf32_link_hash_table_create (bfd *abfd) #define elf_backend_relocate_section pru_elf32_relocate_section #define bfd_elf32_bfd_relax_section pru_elf32_relax_section +#define elf_backend_can_gc_sections 1 #define TARGET_LITTLE_SYM pru_elf32_vec #define TARGET_LITTLE_NAME "elf32-pru" diff --git a/ld/ChangeLog b/ld/ChangeLog index b66e72281e..e92638a162 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +2021-05-10 Dimitar Dimitrov + + * testsuite/ld-elf/group8a.d: Remove pru from XFAIL list. + * testsuite/ld-elf/group8b.d: Ditto. + * testsuite/ld-elf/group9a.d: Ditto. + * testsuite/ld-elf/group9b.d: Ditto. + * testsuite/ld-elf/pr12851.d: Ditto. + * testsuite/ld-elf/pr22677.d: Ditto. + * testsuite/lib/ld-lib.exp (check_gc_sections_available): Remove + pru from list. + 2021-05-10 Dimitar Dimitrov * scripttempl/pru.sc (.resource_table): Add ALIGN directive. diff --git a/ld/testsuite/ld-elf/group8a.d b/ld/testsuite/ld-elf/group8a.d index 59043b2983..96cab9e014 100644 --- a/ld/testsuite/ld-elf/group8a.d +++ b/ld/testsuite/ld-elf/group8a.d @@ -2,7 +2,7 @@ #ld: -r --gc-sections --entry foo #readelf: -g --wide # generic linker targets don't support --gc-sections, nor do a bunch of others -#xfail: [is_generic] hppa64-*-* mep-*-* mn10200-*-* pru-*-* +#xfail: [is_generic] hppa64-*-* mep-*-* mn10200-*-* COMDAT group section \[[ 0-9]+\] `.group' \[foo\] contains . sections: \[Index\] Name diff --git a/ld/testsuite/ld-elf/group8b.d b/ld/testsuite/ld-elf/group8b.d index 7de82ef515..8ff5b97d7e 100644 --- a/ld/testsuite/ld-elf/group8b.d +++ b/ld/testsuite/ld-elf/group8b.d @@ -2,7 +2,7 @@ #ld: -r --gc-sections --entry bar #readelf: -g --wide # generic linker targets don't support --gc-sections, nor do a bunch of others -#xfail: [is_generic] hppa64-*-* mep-*-* mn10200-*-* pru-*-* +#xfail: [is_generic] hppa64-*-* mep-*-* mn10200-*-* COMDAT group section \[[ 0-9]+\] `.group' \[bar\] contains . sections: \[Index\] Name diff --git a/ld/testsuite/ld-elf/group9a.d b/ld/testsuite/ld-elf/group9a.d index d2ec10c9f7..a44e75b0ad 100644 --- a/ld/testsuite/ld-elf/group9a.d +++ b/ld/testsuite/ld-elf/group9a.d @@ -2,7 +2,7 @@ #ld: -r --gc-sections --entry foo #readelf: -g --wide # generic linker targets don't support --gc-sections, nor do a bunch of others -#xfail: [is_generic] hppa64-*-* mep-*-* mn10200-*-* pru-*-* +#xfail: [is_generic] hppa64-*-* mep-*-* mn10200-*-* COMDAT group section \[[ 0-9]+\] `.group' \[foo\] contains . sections: \[Index\] Name diff --git a/ld/testsuite/ld-elf/group9b.d b/ld/testsuite/ld-elf/group9b.d index df7f57626b..0007ebee9f 100644 --- a/ld/testsuite/ld-elf/group9b.d +++ b/ld/testsuite/ld-elf/group9b.d @@ -2,7 +2,7 @@ #ld: -r --gc-sections --entry bar #readelf: -g --wide # generic linker targets don't support --gc-sections, nor do a bunch of others -#xfail: [is_generic] hppa64-*-* mep-*-* mn10200-*-* pru-*-* +#xfail: [is_generic] hppa64-*-* mep-*-* mn10200-*-* COMDAT group section \[[ 0-9]+\] `.group' \[foo\] contains . sections: \[Index\] Name diff --git a/ld/testsuite/ld-elf/pr12851.d b/ld/testsuite/ld-elf/pr12851.d index fe75caf43e..8b88f032c7 100644 --- a/ld/testsuite/ld-elf/pr12851.d +++ b/ld/testsuite/ld-elf/pr12851.d @@ -2,7 +2,7 @@ #source: start.s #ld: --gc-sections #readelf: -s --wide -#xfail: [is_generic] hppa64-*-* mep-*-* mn10200-*-* pru-*-* +#xfail: [is_generic] hppa64-*-* mep-*-* mn10200-*-* # generic linker targets don't support --gc-sections, nor do a bunch of others #... diff --git a/ld/testsuite/ld-elf/pr22677.d b/ld/testsuite/ld-elf/pr22677.d index 49af52a415..e229f85a44 100644 --- a/ld/testsuite/ld-elf/pr22677.d +++ b/ld/testsuite/ld-elf/pr22677.d @@ -2,7 +2,7 @@ #readelf: -S --wide # generic linker targets don't support --gc-sections, nor do a bunch of # others. -#xfail: [is_generic] hppa64-*-* mep-*-* mn10200-*-* pru-*-* +#xfail: [is_generic] hppa64-*-* mep-*-* mn10200-*-* #... \[[ 0-9]+\] \.preinit_array\.01000[ \t]+PREINIT_ARRAY[ \t0-9a-f]+WA?.* diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index b1080889a8..8fd14afc63 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -1090,7 +1090,6 @@ proc check_gc_sections_available { } { || [istarget mep-*-*] || [istarget mn10200-*-*] || [istarget pj*-*-*] - || [istarget pru*-*-*] || [istarget s12z-*-*] || [istarget xgate-*-*] || [istarget z80-*-*] } { -- 2.34.1