bfd: pru: Enable gc-sections option

Message ID 20210508184116.29741-1-dimitar@dinux.eu
State New
Headers show
Series
  • bfd: pru: Enable gc-sections option
Related show

Commit Message

Dimitar Dimitrov May 8, 2021, 6:41 p.m.
I disabled gc-sections option for PRU per review [1] of the initial
port submission. But I could not find any missing requirement in the
PRU port, so I would like to enable it.

Full toolchain testing did not reveal any regressions. Four new failures
appeared, but they are not related to gc-sections:

NA->FAIL: Build pr22983        --dynamic-list used, but PRU does not support shared libraries.
NA->FAIL: PR binutils/23460    -fPIC not supported by PRU.
NA->FAIL: PR ld/12942 (3)      Program size too big due to missing -mmcu=sim.
NA->FAIL: Run pr24406-1        Also observed for arm: PR ld/27833

[1] https://sourceware.org/pipermail/binutils/2016-December/096099.html

bfd/ChangeLog:

	* elf32-pru.c (elf_backend_can_gc_sections): Define as 1.

ld/ChangeLog:

	* 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.

CC:
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>

---
 bfd/elf32-pru.c               | 1 +
 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 -
 8 files changed, 7 insertions(+), 7 deletions(-)

-- 
2.20.1

Comments

Mike Frysinger via Binutils May 10, 2021, 1:02 p.m. | #1
Hi Dimitar,

> bfd/ChangeLog:

> 

> 	* elf32-pru.c (elf_backend_can_gc_sections): Define as 1.

> 

> ld/ChangeLog:

> 

> 	* 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.


Approved and applied.

I am glad to see that this feature has been re-enabled. :-)

Cheers
   Nick

Patch

diff --git a/bfd/elf32-pru.c b/bfd/elf32-pru.c
index e3001d57558..b9368440843 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/testsuite/ld-elf/group8a.d b/ld/testsuite/ld-elf/group8a.d
index 59043b29839..96cab9e0146 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 7de82ef515a..8ff5b97d7e8 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 d2ec10c9f72..a44e75b0ad9 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 df7f57626b4..0007ebee9fd 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 fe75caf43eb..8b88f032c71 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 49af52a4158..e229f85a448 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 b1080889a8e..8fd14afc63e 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-*-*] } {