bit-rot in target before_parse function option

Alan Modra amodra@gmail.com
Thu May 26 11:06:56 GMT 2022


On Fri, May 20, 2022 at 07:46:10PM +0930, Alan Modra wrote:
> On Fri, May 20, 2022 at 09:07:06AM +0200, Clément Chigot wrote:
> > However, the testsuite changes look mandatory to me.
> > As of now, the results are different dependending on the
> > configure options being passed.
> 
> Yes, you may well be correct.  I'm going to leave this to Nick.
> Incidentally, the reason why I didn't fix the arm/aarch64 regressions
> is that if
> 
>   link_info.separate_code = DEFAULT_LD_Z_SEPARATE_CODE;
>   link_info.warn_execstack = DEFAULT_LD_WARN_EXECSTACK;
>   link_info.no_warn_rwx_segments = ! DEFAULT_LD_WARN_RWX_SEGMENTS;
>   link_info.default_execstack = DEFAULT_LD_EXECSTACK;
> 
> is added to armelf.em:before_parse then we get
> 
> FAIL: PR ld/29072 (ignore absent .note.GNU-stack)
> 
> The reason being that arm is listed in ld/testsuite/ld-elf/elf.exp
> target_defaults_to_execstack but doesn't have
> elf_backend_default_execstack set.

I guess I really shouldn't just palm this off to Nick, leaving
testsuite regressions.

Copy initialisation over from the elf.em before_parse.  Commit
ba951afb999 2022-05-03 changed behaviour on arm and score regarding
exec stack.  This patch restores the previous behaviour.

	* emultempl/aarch64elf.em (before_parse): Init separate_code,
	warn_execstack, no_warn_rwx_segments and default_execstack.
	* emultempl/armelf.em (before_parse): Likewise.
	* emultempl/scoreelf.em (before_parse): Likewise.
	* testsuite/ld-elf/elf.exp (target_defaults_to_execstack): Return
	true for arm and nacl.

diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em
index 26e3dd243fc..1968f12cf29 100644
--- a/ld/emultempl/aarch64elf.em
+++ b/ld/emultempl/aarch64elf.em
@@ -54,6 +54,10 @@ fragment <<EOF
 EOF
 fi
 fragment <<EOF
+  link_info.separate_code = DEFAULT_LD_Z_SEPARATE_CODE;
+  link_info.warn_execstack = DEFAULT_LD_WARN_EXECSTACK;
+  link_info.no_warn_rwx_segments = ! DEFAULT_LD_WARN_RWX_SEGMENTS;
+  link_info.default_execstack = DEFAULT_LD_EXECSTACK;
 }
 
 static void
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index 885067fa256..8f5334df198 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -67,6 +67,10 @@ fragment <<EOF
 EOF
 fi
 fragment <<EOF
+  link_info.separate_code = DEFAULT_LD_Z_SEPARATE_CODE;
+  link_info.warn_execstack = DEFAULT_LD_WARN_EXECSTACK;
+  link_info.no_warn_rwx_segments = ! DEFAULT_LD_WARN_RWX_SEGMENTS;
+  link_info.default_execstack = DEFAULT_LD_EXECSTACK;
 }
 
 static void
diff --git a/ld/emultempl/scoreelf.em b/ld/emultempl/scoreelf.em
index f5dd06246de..d781dd96057 100644
--- a/ld/emultempl/scoreelf.em
+++ b/ld/emultempl/scoreelf.em
@@ -47,6 +47,10 @@ fragment <<EOF
 EOF
 fi
 fragment <<EOF
+  link_info.separate_code = DEFAULT_LD_Z_SEPARATE_CODE;
+  link_info.warn_execstack = DEFAULT_LD_WARN_EXECSTACK;
+  link_info.no_warn_rwx_segments = ! DEFAULT_LD_WARN_RWX_SEGMENTS;
+  link_info.default_execstack = DEFAULT_LD_EXECSTACK;
 }
 
 static void
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index ebb5ba090bf..621d4e121d7 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -182,8 +182,6 @@ if { [check_gc_sections_available] && ![istarget "v850-*-*"] } {
 
 proc target_defaults_to_execstack {} {
     if {   [istarget "aarch64*-*-*"]
-	|| [istarget "arm*-*-*"]
-	|| [istarget "*-*-nacl"]
 	|| [istarget "arc*-*-*"]
 	|| [istarget "ia64*-*-*"]
 	|| [istarget "nios2*-*-*"]


-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list