https://gcc.gnu.org/g:c17883e6f27a0960ba35fe059db639293b7ab909

commit r17-2655-gc17883e6f27a0960ba35fe059db639293b7ab909
Author: Rainer Orth <[email protected]>
Date:   Thu Jul 23 10:29:33 2026 +0200

    testsuite: Provide shf_link_order effective target
    
    Like R_flag_in_section, the o_flag_in_section effective target is a
    misnomer.  It actually signifies support for the SHF_LINK_ORDER section
    flag.  Therefore this patch uses the et-static framework to determine it
    from HAVE_GAS_SECTION_LINK_ORDER in auto-host.h, adapting the existing
    uses.
    
    Bootstrapped without regressions on i386-pc-solaris2.11 and
    x86_64-pc-linux-gnu.
    
    2026-01-13  Rainer Orth  <[email protected]>
    
            gcc:
            * configure.ac (HAVE_GAS_SECTION_LINK_ORDER): Clarify comment.
            * config.in: Regenerate.
    
            * doc/sourcebuild.texi (Effective-Target Keywords)
            (o_flag_in_section): Rename to shf_link_order.  Update description.
    
            gcc/testsuite:
            * lib/target-supports.exp
            (check_effective_target_o_flag_in_section): Remove.
            * lib/et-static.def (shf_link_order): New effective target.
            * g++.dg/pr93195a.C: Require shf_link_order.
            * gcc.dg/pr110729.c: Likewise.

Diff:
---
 gcc/config.in                         |  2 +-
 gcc/configure.ac                      |  2 +-
 gcc/doc/sourcebuild.texi              |  6 +++---
 gcc/testsuite/g++.dg/pr93195a.C       |  2 +-
 gcc/testsuite/gcc.dg/pr110729.c       |  2 +-
 gcc/testsuite/lib/et-static.def       |  4 ++++
 gcc/testsuite/lib/target-supports.exp | 40 -----------------------------------
 7 files changed, 11 insertions(+), 47 deletions(-)

diff --git a/gcc/config.in b/gcc/config.in
index 95a1087c8a57..34ff1b1cb995 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1522,7 +1522,7 @@
 #endif
 
 
-/* Define 0/1 if your assembler supports 'o' flag in .section directive. */
+/* Define 0/1 if your assembler and linker support SHF_LINK_ORDER. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_GAS_SECTION_LINK_ORDER
 #endif
diff --git a/gcc/configure.ac b/gcc/configure.ac
index c400be9114a5..9818f7b01488 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3793,7 +3793,7 @@ case "${target}" in
 esac
 AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_LINK_ORDER,
   [`if test $gcc_cv_as_section_link_order = yes; then echo 1; else echo 0; 
fi`],
-  [Define 0/1 if your assembler supports 'o' flag in .section directive.])
+  [Define 0/1 if your assembler and linker support SHF_LINK_ORDER.])
 
 gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
  [$fw_as_opt],
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index f3c5b13840c4..7b59cf89050a 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -3173,9 +3173,6 @@ Target supports the @code{noinit} variable attribute.
 @item nonpic
 Target does not generate PIC by default.
 
-@item o_flag_in_section
-Target supports the 'o' flag in .section directive in assembly inputs.
-
 @item offload_gcn
 Target has been configured for OpenACC/OpenMP offloading on AMD GCN.
 
@@ -3211,6 +3208,9 @@ Target supports section anchors.
 @item shf_gnu_retain
 Target supports @code{SHF_GNU_RETAIN}.
 
+@item shf_link_order
+Target supports @code{SHF_LINK_ORDER}.
+
 @item short_enums
 Target defaults to short enums.
 
diff --git a/gcc/testsuite/g++.dg/pr93195a.C b/gcc/testsuite/g++.dg/pr93195a.C
index 26d265da74eb..550b73adc4dd 100644
--- a/gcc/testsuite/g++.dg/pr93195a.C
+++ b/gcc/testsuite/g++.dg/pr93195a.C
@@ -1,5 +1,5 @@
 /* { dg-do link { target { ! { nvptx*-*-* visium-*-* } } } } */
-// { dg-require-effective-target o_flag_in_section }
+/* { dg-require-effective-target shf_link_order } */
 /* { dg-options "-O0 -fpatchable-function-entry=1" } */
 /* { dg-additional-options "-fno-pie" { target sparc*-*-* } } */
 /* { dg-additional-sources pr93195b.C } */
diff --git a/gcc/testsuite/gcc.dg/pr110729.c b/gcc/testsuite/gcc.dg/pr110729.c
index 29b8c1c1f439..4e4c62b3f747 100644
--- a/gcc/testsuite/gcc.dg/pr110729.c
+++ b/gcc/testsuite/gcc.dg/pr110729.c
@@ -1,5 +1,5 @@
 /* { dg-do compile { target { ! { nvptx*-*-* visium-*-* } } } } */
-/* { dg-require-effective-target o_flag_in_section } */
+/* { dg-require-effective-target shf_link_order } */
 /* { dg-options "-ffunction-sections -fpatchable-function-entry=2" } */
 /* { dg-additional-options "-fno-pie" { target sparc*-*-* } } */
 
diff --git a/gcc/testsuite/lib/et-static.def b/gcc/testsuite/lib/et-static.def
index 2c3b6eaa3ef3..b5a323359208 100644
--- a/gcc/testsuite/lib/et-static.def
+++ b/gcc/testsuite/lib/et-static.def
@@ -52,6 +52,10 @@ shf_gnu_retain
 HAVE_GAS_SHF_GNU_RETAIN
 this target supports SHF_GNU_RETAIN
 
+shf_link_order
+HAVE_GAS_SECTION_LINK_ORDER
+this target supports SHF_LINK_ORDER
+
 sht_init_array
 HAVE_INITFINI_ARRAY_SUPPORT
 this target supports SHT_INIT_ARRAY
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index 0111fac3e42b..57a6df4f83ba 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -14207,46 +14207,6 @@ proc check_effective_target_gnu_retain { } {
                    && [check_effective_target_sht_init_array] } ]
 }
 
-# Return 1 if this target supports 'o' flag in .section directive, 0
-# otherwise.  Cache the result.
-
-proc check_effective_target_o_flag_in_section { } {
-    global tool
-    global GCC_UNDER_TEST
-
-    # Need auto-host.h to check linker support.
-    if { ![file exists ../../auto-host.h ] } {
-       return 0
-    }
-
-    return [check_cached_effective_target o_flag_in_section {
-
-       set src pie[pid].c
-       set obj pie[pid].o
-
-       set f [open $src "w"]
-       puts $f "#include \"../../auto-host.h\""
-       puts $f "#if HAVE_GAS_SECTION_LINK_ORDER == 0"
-       puts $f "# error Assembler does not support 'o' flag in .section 
directive."
-       puts $f "#endif"
-       close $f
-
-       verbose "check_effective_target_o_flag_in_section compiling testfile 
$src" 2
-       set lines [${tool}_target_compile $src $obj object ""]
-
-       file delete $src
-       file delete $obj
-
-       if [string match "" $lines] then {
-           verbose "check_effective_target_o_flag_in_section testfile 
compilation passed" 2
-           return 1
-       } else {
-           verbose "check_effective_target_o_flag_in_section testfile 
compilation failed" 2
-           return 0
-       }
-    }]
-}
-
 # Return 1 if LRA is supported.  This must not be called (results in ERROR) for
 # targets that don't do register allocation, and therefore neither use nor
 # don't use LRA.

Reply via email to