]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
aarch64: silence GCS warnings on shared libraries for -z gcs=implicit
authorMatthieu Longo <matthieu.longo@arm.com>
Thu, 4 Dec 2025 15:50:30 +0000 (15:50 +0000)
committerMatthieu Longo <matthieu.longo@arm.com>
Wed, 21 Jan 2026 12:49:19 +0000 (12:49 +0000)
Dynamic library incompatibilities should not be reported when no GCS
option is provided (defaults to '-z gcs=implicit') and no explicit
diagnostic is provided via '-z gcs-report-dynamic'.

Binary Linux distributions do not rebuild all packages from scratch
when rolling out a new feature or creating a new release; only
modified packages get rebuilt. In the context of GCS deployment, this
meant that some packages were rebuilt with GCS enabled while their
dependencies were not yet GCS-compatible, resulting in warnings. These
warnings caused build failures for packages that treat linker warnings
as errors. Those errors slowed down the GCS deployment, and Linux
distribution maintainers requested that no GCS option provided should
be equivalent to '-z gcs=implicit -z gcs-report-dynamic=none'.

In contrast, '-z gcs=always' should continue to report such issues by
default. Warnings can still be disabled or promoted to errors by
explicitly setting '-z gcs-report-dynamic' to respectively 'none' or
'error'.

This patch preserves the existing behaviour for '-z gcs=never', changes
the default behaviour of '-z gcs=implicit' or no GCS option, and removed
the inheritance mechanism between '-z gcs-report' and '-z gcs-report-dynamics'.
The expected behaviour with the different possible combinations is as
follows:
* -z gcs=never:
  No diagnostic messages are emitted.
* -z gcs=implicit:
  No diagnostic messages are emitted for input static objects.
  However, if all the input static objects are marked for GCS, the
  output object will also be marked for GCS.
  In this case the output is marked with GCS, '-z gcs-report-dynamic'
  defaults to 'none' and no diagnostics are emitted. Diagnostics can
  be enabled by explicitly providing the option.
* -z gcs=always:
  Warning diagnostics for both static and dynamic input objects are
  enabled by default. The two options are independent of one another,
  and the diagnostic level can be adjusted for each by explicitly
  providing the desired level to '-z gcs-report-dynamic' and '-z
  gcs-report'.

The patch also updates the existing tests, removes redundant test cases,
and adds new tests covering cases with no report option provided, or
report options explicitly set.

40 files changed:
bfd/elfnn-aarch64.c
ld/emultempl/aarch64elf.em
ld/ld.texi
ld/testsuite/ld-aarch64/protections/gcs-1-c.d
ld/testsuite/ld-aarch64/protections/gcs-1-d.d
ld/testsuite/ld-aarch64/protections/gcs-1-e.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-2-a-i.d
ld/testsuite/ld-aarch64/protections/gcs-2-a-ii.d
ld/testsuite/ld-aarch64/protections/gcs-2-b-i.d
ld/testsuite/ld-aarch64/protections/gcs-2-b-ii.d
ld/testsuite/ld-aarch64/protections/gcs-2-b-iii.d
ld/testsuite/ld-aarch64/protections/gcs-2-b-iv.d
ld/testsuite/ld-aarch64/protections/gcs-2-b-v.d [moved from ld/testsuite/ld-aarch64/protections/gcs-3-b-ii.d with 58% similarity]
ld/testsuite/ld-aarch64/protections/gcs-2-c-i.d
ld/testsuite/ld-aarch64/protections/gcs-2-c-ii.d
ld/testsuite/ld-aarch64/protections/gcs-2-c-iii.d [moved from ld/testsuite/ld-aarch64/protections/gcs-3-c-ii.d with 58% similarity]
ld/testsuite/ld-aarch64/protections/gcs-3-a-i.d
ld/testsuite/ld-aarch64/protections/gcs-3-a-ii.d
ld/testsuite/ld-aarch64/protections/gcs-3-a-iii.d
ld/testsuite/ld-aarch64/protections/gcs-3-a-iv.d
ld/testsuite/ld-aarch64/protections/gcs-3-b-i.d [deleted file]
ld/testsuite/ld-aarch64/protections/gcs-3-b-iii.d [deleted file]
ld/testsuite/ld-aarch64/protections/gcs-3-c-i.d [deleted file]
ld/testsuite/ld-aarch64/protections/gcs-3-c-iii.d [deleted file]
ld/testsuite/ld-aarch64/protections/gcs-dynamic-1-a.d
ld/testsuite/ld-aarch64/protections/gcs-dynamic-1-b.d
ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-ii.d [deleted file]
ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a.d [moved from ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-i.d with 84% similarity]
ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-b.d
ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-c.d
ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-d.d
ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-a.d
ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-b.d
ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-c.d
ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-d.d [moved from ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-iv.d with 51% similarity]
ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-e.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-f.d [moved from ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-iii.d with 61% similarity]
ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-a.d
ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-b.d [deleted file]
ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-c.d [deleted file]

index 00a4f171cf131f85aa3c1db7e75cd9623e7c5513..d0be20ee459ae250072195fad1d58d3862a14467 100644 (file)
@@ -5040,40 +5040,73 @@ bfd_elfNN_aarch64_set_options (struct bfd *output_bfd,
   elf_aarch64_tdata (output_bfd)->no_enum_size_warning = no_enum_warn;
   elf_aarch64_tdata (output_bfd)->no_wchar_size_warning = no_wchar_warn;
 
-  /* Note: gnu_property_aarch64_feature_1_and was initialized to 0 by
-     bfd_zalloc().  */
+  uint32_t gnu_property_aarch64_feature_1_and = 0;
+  aarch64_feature_marking_report gcs_report;
+  aarch64_feature_marking_report gcs_report_dynamic;
+
   if (sw_protections->plt_type & PLT_BTI)
-    elf_aarch64_tdata (output_bfd)->gnu_property_aarch64_feature_1_and
-      |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI;
+    gnu_property_aarch64_feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI;
 
   switch (sw_protections->gcs_type)
     {
     case GCS_ALWAYS:
-      elf_aarch64_tdata (output_bfd)->gnu_property_aarch64_feature_1_and
-       |= GNU_PROPERTY_AARCH64_FEATURE_1_GCS;
+      gnu_property_aarch64_feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_GCS;
+
+      /* The default diagnostic level with '-z gcs=always' is 'warning'.  */
+      if (sw_protections->gcs_report == MARKING_UNSET)
+       gcs_report = MARKING_WARN;
+      else
+       gcs_report = sw_protections->gcs_report;
+
+      /* The default diagnostic level with '-z gcs=always' is 'warning'.  */
+      if (sw_protections->gcs_report_dynamic == MARKING_UNSET)
+       gcs_report_dynamic = MARKING_WARN;
+      else
+       gcs_report_dynamic = sw_protections->gcs_report_dynamic;
       break;
+
     case GCS_NEVER:
-      elf_aarch64_tdata (output_bfd)->gnu_property_aarch64_feature_1_and
-       &= ~GNU_PROPERTY_AARCH64_FEATURE_1_GCS;
+      gnu_property_aarch64_feature_1_and &= ~GNU_PROPERTY_AARCH64_FEATURE_1_GCS;
+
+      /* Markings are ignored, so no diagnostic messages can be emitted.  */
+      gcs_report = MARKING_NONE;
+      gcs_report_dynamic = MARKING_NONE;
       break;
+
     case GCS_IMPLICIT:
       /* GCS feature on the output bfd will be deduced from input objects.  */
+
+      /* No warnings should be emitted on input static objects with
+        '-z gcs=implicit'.  */
+      gcs_report = MARKING_NONE;
+
+      /* Binary Linux distributions do not rebuild all packages from scratch
+        when rolling out a new feature or creating a new release; only modified
+        packages get rebuilt.  In the context of GCS deployment, this meant
+        that some packages were rebuilt with GCS enabled while their
+        dependencies were not yet GCS-compatible, resulting in warnings because
+        originally the report level for dynamic objects was set to warning.
+        These warnings caused build failures for packages that treat linker
+        warnings as errors.  Those errors slowed down the GCS deployment, and
+        Linux distribution maintainers requested that no GCS option provided
+        should be equivalent to '-z gcs=implicit -z gcs-report-dynamic=none'.
+        */
+      if (sw_protections->gcs_report_dynamic == MARKING_UNSET)
+       gcs_report_dynamic = MARKING_NONE;
+      else
+       gcs_report_dynamic = sw_protections->gcs_report_dynamic;
       break;
     }
 
+  elf_aarch64_tdata (output_bfd)->gnu_property_aarch64_feature_1_and
+    = gnu_property_aarch64_feature_1_and;
+
   elf_aarch64_tdata (output_bfd)->sw_protections = *sw_protections;
-  /* Inherit the value from '-z gcs-report' if the option '-z gcs-report-dynamic'
-     was not set on the command line.  However, the inheritance mechanism is
-     capped to avoid inheriting the error level from -g gcs-report as the user
-     might want to continue to build a module without rebuilding all the shared
-     libraries.  If a user also wants to error GCS issues in the shared
-     libraries, '-z gcs-report-dynamic=error' will have to be specified
-     explicitly.  */
-  if (sw_protections->gcs_report_dynamic == MARKING_UNSET)
-    elf_aarch64_tdata (output_bfd)->sw_protections.gcs_report_dynamic
-      = (sw_protections->gcs_report == MARKING_ERROR)
-      ? MARKING_WARN
-      : sw_protections->gcs_report;
+  /* Adjusting GCS diagnostic levels.  */
+  elf_aarch64_tdata (output_bfd)->sw_protections.gcs_report
+    = gcs_report;
+  elf_aarch64_tdata (output_bfd)->sw_protections.gcs_report_dynamic
+    = gcs_report_dynamic;
 
   elf_aarch64_tdata (output_bfd)->n_bti_issues = 0;
   elf_aarch64_tdata (output_bfd)->n_gcs_issues = 0;
index cd3a6c63d99a5f3ca5a9d7a3e7ad2a41fee74f6e..5ddbed99724077944fb29f6366df538f4b76e2e0 100644 (file)
@@ -38,7 +38,7 @@ static aarch64_protection_opts sw_protections = {
   .plt_type = PLT_NORMAL,
   .bti_report = MARKING_WARN,
   .gcs_type = GCS_IMPLICIT,
-  .gcs_report = MARKING_WARN,
+  .gcs_report = MARKING_UNSET,
   .gcs_report_dynamic = MARKING_UNSET,
 };
 
@@ -417,7 +417,7 @@ aarch64_parse_gcs_report_dynamic_option (const char *_optarg)
   #define GCS_REPORT_DYNAMIC_LEN  COMPILE_TIME_STRLEN (GCS_REPORT_DYNAMIC)
 
   return aarch64_parse_feature_report_option (_optarg, GCS_REPORT_DYNAMIC,
-    GCS_REPORT_DYNAMIC_LEN, false, &sw_protections.gcs_report_dynamic);
+    GCS_REPORT_DYNAMIC_LEN, true, &sw_protections.gcs_report_dynamic);
 
   #undef GCS_REPORT_DYNAMIC
   #undef GCS_REPORT_DYNAMIC_LEN
index 7cadc853af90539e2f6fddb8337b7ffc33d6b880..3dc76a1f8c6b56c59c1828872827748508f34bcb 100644 (file)
@@ -8374,43 +8374,35 @@ markings on input objects and marks the output with GCS if all conditions are
 validated.
 @itemize
 @item @samp{implicit} (default if @samp{-z gcs} is omitted) enables GCS marking
-on the output if, and only if, all input objects composing the link unit are
-marked with GCS.
+on the output if, and only if, all input static objects are marked with GCS.
 @item @samp{always} forces the marking of the output with GCS.
 @item @samp{never} ignores any GCS marking on the input objects, and does not
 mark the output with GCS.
 @end itemize
 
 @kindex -z gcs-report[=none|warning|error]
-@cindex Control warnings for missing GCS markings.
-The @samp{-z gcs-report[=none|warning|error]} option specifies how to report the
-missing GCS markings on inputs, i.e. the GNU_PROPERTY_AARCH64_FEATURE_1_GCS
-property. By default, if the option is omitted and @samp{-z gcs} is provided,
-warnings are emitted.
+@cindex Control diagnostics for missing GCS markings on static input objects.
+When @samp{-z gcs=always} is specified, then the @samp{-z gcs-report[=none|warning|error]}
+option can be used to specify how to report missing GCS markings (i.e.
+the GNU_PROPERTY_AARCH64_FEATURE_1_GCS property) on static inputs.
 @itemize
-@item @samp{none} disables any warning messages.
-@item @samp{warning} (the default value) emits warning messages when input objects
-composing the link unit are missing GCS markings.
-@item @samp{error} turns the warning messages into errors.
+@item @samp{none} disables the diagnostic messages.
+@item @samp{warning} (the default value) emits diagnostic messages as warnings.
+@item @samp{error} emits diagnostic messages as errors.
 @end itemize
 If issues are found, a maximum of 20 messages will be emitted, and then a summary
 with the total number of issues will be displayed at the end.
 
-@kindex -z gcs-report-dynamic=none|warning|error
-@cindex Control warnings for missing GCS markings on dynamic input objects.
-The @samp{-z gcs-report-dynamic=none|warning|error} option specifies how to
-report the missing GCS markings on dynamic input objects, i.e. the
-GNU_PROPERTY_AARCH64_FEATURE_1_GCS property. By default, if the option is
-omitted, it inherits the value of @samp{-z gcs-report}. However, the inherited
-value is capped to @samp{warning} as some user might want to only report errors
-in the currently built module, and not the shared dependencies. It is therefore
-necessary to use an explicit @samp{-z gcs-report-dynamic=error} option if you
-want the linker to error on GCS issues in the shared libraries.
+@kindex -z gcs-report-dynamic[=none|warning|error]
+@cindex Control diagnostics for missing GCS markings on dynamic input objects.
+If @samp{-z gcs} is not specified on the command line, or if it has the value
+@samp{implicit} or @samp{always}, then the @samp{-z gcs-report-dynamic[=none|warning|error]}
+option specifies how to report the missing GCS markings (i.e. the GNU_PROPERTY_AARCH64_FEATURE_1_GCS
+property) on dynamic input objects.
 @itemize
-@item @samp{none} disables any warning messages.
-@item @samp{warning} emits warning messages when dynamic objects are missing
-GCS markings.
-@item @samp{error} turns the warning messages into errors.
+@item @samp{none} (default value when @samp{-z gcs=implicit}) disables the diagnostic messages.
+@item @samp{warning} (default value when @samp{-z gcs=always}) emits diagnostic messages as warnings.
+@item @samp{error} emits diagnostic messages as errors.
 @end itemize
 If issues are found, a maximum of 20 messages will be emitted, and then a summary
 with the total number of issues will be displayed at the end.
index 8205832f5242343fa28ba152c98e6aabf90e3fd8..98ff3da317cbb302ab0aec97bc6af4398ee59a8b 100644 (file)
@@ -1,7 +1,8 @@
-#name: Specifying '-z gcs' without value raise an error
+#name: No GCS option (equivalent to -z gcs=implicit) and mixed inputs emits no GCS feature and no warnings [shared]
 #source: gcs.s
 #source: gcs2.s
+#source: nogcs.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -shared -z gcs
-#error: .*: error: unrecognized value '-z gcs'
+#ld: -shared
+#readelf: -n
index 736330375fac405e14b0ca20641cdb7994e7ccf9..15db497528fa2d8f1c52c6d48a6b86e11ec0d150 100644 (file)
@@ -1,7 +1,7 @@
-#name: Specifying invalid value for '-z gcs' raise an error
+#name: '-z gcs' without value raises an error
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs
-#ld: -shared -z gcs=foo
-#error: .*: error: unrecognized value '-z gcs=foo'
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs
+#error: .*: error: unrecognized value '-z gcs'
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-1-e.d b/ld/testsuite/ld-aarch64/protections/gcs-1-e.d
new file mode 100644 (file)
index 0000000..28198da
--- /dev/null
@@ -0,0 +1,7 @@
+#name: Invalid value for '-z gcs' raises an error
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs
+#ld: -shared -z gcs=foo
+#error: .*: error: unrecognized value '-z gcs=foo'
index 77711ea0a586db5db1417fb3b72ce5fff5ebde4a..536687e7cf8630a69516eed1c67d3ae33c6186b5 100644 (file)
@@ -1,4 +1,4 @@
-#name: Specifying only '-z gcs=always' with GCS marked inputs emits GCS feature without warnings for inputs with GCS feature [shared]
+#name: '-z gcs=always' with GCS-marked inputs emits GCS feature and no warnings [shared]
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
index 04094a9036cc65b59fa0dfe40a004c560ea2385a..ef2c41d4dd7032ef897e8d17b26c98bbf5ee53f7 100644 (file)
@@ -1,4 +1,4 @@
-#name: Specifying only '-z gcs=always' emits GCS feature with warnings for missing GCS feature on inputs [shared]
+#name: '-z gcs=always' with GCS-unmarked inputs emits GCS feature with warnings [shared]
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
index cecf2742495080594af64aff503e60a7187274b9..424e35a208bdf92da3ae370a175feb8181f97fc7 100644 (file)
@@ -1,4 +1,4 @@
-#name: Specifying only '-z gcs=implicit' and GCS-marked inputs emits GCS feature [shared]
+#name: '-z gcs=implicit' with GCS-marked inputs emits GCS feature [shared]
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
index 853629935bb1f1904e4651c1b1c253358affd9e9..1e9c59926675b9b3b9977636a9dac72ff0999e0e 100644 (file)
@@ -1,4 +1,4 @@
-#name: Specifying only '-z gcs=implicit' and GCS-unmarked inputs emits no GCS feature without warnings [shared]
+#name: '-z gcs=implicit' with GCS-unmarked inputs emits no GCS feature and no warnings [shared]
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
index b49e7c4d7acb683bb8f2e5bccf2cc404968818a7..91c3a290077ced2226db7435eb84542c02bab03d 100644 (file)
@@ -1,12 +1,7 @@
-#name: Specifying only '-z gcs=implicit -z gcs-report=warning' and GCS-marked inputs emits GCS feature [shared]
+#name: '-z gcs=implicit -z gcs-report=warning' with GCS-unmarked inputs emits no warnings [shared]
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#as: -march=armv9.4-a+gcs
 #ld: -shared -z gcs=implicit -z gcs-report=warning
 #readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[      ]+Owner[        ]+Data size[    ]+Description
-  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
-      Properties: AArch64 feature: GCS
index c98f3e0525a2476672b90cff8beaf49bb5bef238..bb2425fd65e48b3dad70c0fd50b5630477efe88c 100644 (file)
@@ -1,7 +1,8 @@
-#name: Specifying only '-z gcs=implicit -z gcs-report=warning' and GCS-unmarked inputs emits no GCS feature without warnings [shared]
+#name: '-z gcs=implicit' with mixed inputs emits no GCS feature and no warnings [shared]
 #source: gcs.s
 #source: gcs2.s
+#source: nogcs.s
 #alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs
-#ld: -shared -z gcs=implicit -z gcs-report=warning
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=implicit
 #readelf: -n
similarity index 58%
rename from ld/testsuite/ld-aarch64/protections/gcs-3-b-ii.d
rename to ld/testsuite/ld-aarch64/protections/gcs-2-b-v.d
index f03e7ef7febe9ef2809eea8232d02825480ba894..1b2b7453c43fd152ca3727f6185df2094f3d60af 100644 (file)
@@ -1,8 +1,8 @@
-#name: Specifying only '-z gcs=implicit -z gcs-report=warning' with mixed inputs emits no warning, and no GCS feature [shared]
+#name: '-z gcs=implicit -z gcs-report=warning' with mixed inputs emits no GCS feature and no warnings [shared]
 #source: gcs.s
 #source: gcs2.s
 #source: nogcs.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
 #ld: -shared -z gcs=implicit -z gcs-report=warning
-#readelf: -n
\ No newline at end of file
+#readelf: -n
index 4bf8f6cbc16e95ff5f0ddb9f9b22e6ee6648dd16..644b7ce35cb22df00129d8dbb4117900fd648ab7 100644 (file)
@@ -1,4 +1,4 @@
-#name: Specifying only '-z gcs=never' and GCS-marked inputs emits no GCS feature [shared]
+#name: '-z gcs=never' with GCS-marked inputs emits no GCS feature [shared]
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
index 6941233cb6cd0d1a83c3e15df38c58dc9a34d043..d4438e9d44bd6c05d875b05160a7aabc62bc01d5 100644 (file)
@@ -1,4 +1,4 @@
-#name: Specifying only '-z gcs=never' and GCS-unmarked inputs emits no GCS feature [shared]
+#name: '-z gcs=never' with GCS-unmarked inputs emits no GCS feature [shared]
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
similarity index 58%
rename from ld/testsuite/ld-aarch64/protections/gcs-3-c-ii.d
rename to ld/testsuite/ld-aarch64/protections/gcs-2-c-iii.d
index bbe5e1092c5f80474a265060095eb5f27ad662c3..4fc4df9c144e282a5edc999f9c1952c57275ca41 100644 (file)
@@ -1,8 +1,8 @@
-#name: Specifying only '-z gcs=never -z gcs-report=warning' with mixed inputs emits no error/warning, and no GCS feature [shared]
+#name: '-z gcs=never -z gcs-report=warning' with mixed inputs emits no warnings [shared]
 #source: gcs.s
 #source: gcs2.s
 #source: nogcs.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
 #ld: -shared -z gcs=never -z gcs-report=warning
-#readelf: -n
\ No newline at end of file
+#readelf: -n
index c1c5ba3e1268f655101c89c32295238fdd910cdd..f9b01b93465d148ae0f1045963ce122dd47012c9 100644 (file)
@@ -1,4 +1,4 @@
-#name: Specifying only '-z gcs=always -z gcs-report=error' with mixed inputs emits errors [shared]
+#name: '-z gcs=always -z gcs-report=error' with mixed inputs emits errors [shared]
 #source: gcs.s
 #source: gcs2.s
 #source: nogcs.s
index d7289be30cf6d5175bdbb9c35c961228a54cbf13..0282a2e995eaca260c42a75a0be49d11c8908192 100644 (file)
@@ -1,4 +1,4 @@
-#name: Specifying only '-z gcs=always -z gcs-report=warning' with mixed inputs emits GCS feature and warnings [shared]
+#name: '-z gcs=always -z gcs-report=warning' with mixed inputs emits GCS feature and warnings [shared]
 #source: gcs.s
 #source: gcs2.s
 #source: nogcs.s
index 5f55e2f16fc0fa257c4129c1286021ffc3558d28..3d3c854b6d6d8f2acfb41fbf2d363689a837eb27 100644 (file)
@@ -1,4 +1,4 @@
-#name: Specifying only '-z gcs=always -z gcs-report=none' with mixed inputs emits GCS feature and no error/warning [shared]
+#name: '-z gcs=always -z gcs-report=none' with mixed inputs emits GCS feature and no diagnostics [shared]
 #source: gcs.s
 #source: gcs2.s
 #source: nogcs.s
index 5c340c400648d1921543d5b8660a074384fe35d2..0b5d11186344b0363a62e94d70dd6228d967d186 100644 (file)
@@ -1,4 +1,4 @@
-#name: Specifying only '-z gcs=always -z gcs-report' with mixed inputs emits GCS feature and warnings [shared]
+#name: '-z gcs=always -z gcs-report' with mixed inputs emits GCS feature and warnings [shared]
 #source: gcs.s
 #source: gcs2.s
 #source: nogcs.s
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-b-i.d b/ld/testsuite/ld-aarch64/protections/gcs-3-b-i.d
deleted file mode 100644 (file)
index 70cc1bd..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#name: Specifying only '-z gcs=implicit -z gcs-report=error' with mixed inputs emits no error/warning, and no GCS feature [shared]
-#source: gcs.s
-#source: gcs2.s
-#source: nogcs.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -shared -z gcs=implicit -z gcs-report=error
-#readelf: -n
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-b-iii.d b/ld/testsuite/ld-aarch64/protections/gcs-3-b-iii.d
deleted file mode 100644 (file)
index 3d3e07c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#name: Specifying only '-z gcs=implicit -z gcs-report=none' with mixed inputs emits no warning, and no GCS feature [shared]
-#source: gcs.s
-#source: gcs2.s
-#source: nogcs.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -shared -z gcs=implicit -z gcs-report=none
-#readelf: -n
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-c-i.d b/ld/testsuite/ld-aarch64/protections/gcs-3-c-i.d
deleted file mode 100644 (file)
index 472bb65..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#name: Specifying only '-z gcs=never -z gcs-report=error' with mixed inputs emits no error/warning, and no GCS feature [shared]
-#source: gcs.s
-#source: gcs2.s
-#source: nogcs.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -shared -z gcs=never -z gcs-report=error
-#readelf: -n
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-c-iii.d b/ld/testsuite/ld-aarch64/protections/gcs-3-c-iii.d
deleted file mode 100644 (file)
index 6bf96bc..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#name: Specifying only '-z gcs=never -z gcs-report=none' with mixed inputs emits no error/warning, and no GCS feature [shared]
-#source: gcs.s
-#source: gcs2.s
-#source: nogcs.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -shared -z gcs=never -z gcs-report=none
-#readelf: -n
\ No newline at end of file
index be8a301f6c0ac767395938a654278e10073ea6b1..b8358c55f8a270fb64a2f8f4acae8a614591ca9f 100644 (file)
@@ -1,9 +1,9 @@
-#name: '-z gcs=always -z gcs-report=error' and shared library with GCS feature reports no error.
+#name: '-z gcs=always' with GCS-marked shared library reports nothing.
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=error -L./tmpdir -lgcs-so
+#ld: -z gcs=always -L./tmpdir -lgcs-so
 #readelf: -n
 
 Displaying notes found in: .note.gnu.property
index d53d45ae5980a074b4bc77c7bfc6f7c123366943..51a35412e84dc0a20925c475ddf145e46296fec8 100644 (file)
@@ -1,4 +1,4 @@
-#name: '-z gcs=always -z gcs-report=error -z gcs-report-dynamic=error' and shared library with GCS feature reports no error.
+#name: '-z gcs=always -z gcs-report=error -z gcs-report-dynamic=error' with GCS-marked shared library reports nothing.
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-ii.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-ii.d
deleted file mode 100644 (file)
index 7adb481..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#name: '-z gcs=always -z gcs-report=error -z gcs-report-dynamic=error' and shared libraries without GCS feature reports errors.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=error -z gcs-report-dynamic=error -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#error: \A[^\n]*libnogcs-so\.so: error: GCS is required by -z gcs[^\n]*\n
-#error:   [^\n]*libbti-plt-so\.so: error: GCS is required by -z gcs[^\n]*
\ No newline at end of file
similarity index 84%
rename from ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-i.d
rename to ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a.d
index 903d14099be9cfbc83081db7df95df1f88580499..9623b5f498c03aa6f563b907e8b63a9c4b5b7632 100644 (file)
@@ -1,4 +1,4 @@
-#name: '-z gcs=always -z gcs-report=error' and shared libraries without GCS feature reports warnings.
+#name: '-z gcs=always' with GCS-unmarked shared libraries reports warnings.
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
index 36262bbc0876b18d101fd1b113540f9f69314a59..9750569400d231969b25c4eb85f59602bcb3022a 100644 (file)
@@ -1,14 +1,8 @@
-#name: '-z gcs=always -z gcs-report=warning' and shared libraries without GCS feature reports warnings.
+#name: '-z gcs=always -z gcs-report=error -z gcs-report-dynamic=error' with GCS-unmarked shared libraries reports errors.
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=warning -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#warning: \A[^\n]*libnogcs-so\.so: warning: GCS is required by -z gcs[^\n]*\n
-#warning:   [^\n]*libbti-plt-so\.so: warning: GCS is required by -z gcs[^\n]*
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[      ]+Owner[        ]+Data size[    ]+Description
-  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
-      Properties: AArch64 feature: GCS
+#ld: -z gcs=always -z gcs-report=error -z gcs-report-dynamic=error -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
+#error: \A[^\n]*libnogcs-so\.so: error: GCS is required by -z gcs[^\n]*\n
+#error:   [^\n]*libbti-plt-so\.so: error: GCS is required by -z gcs[^\n]*
index 6c7f5da8be74ff2ad6561d94dc7308335373c292..c142f6902625aa9d055fb7d9d7614208eb04951c 100644 (file)
@@ -1,9 +1,12 @@
-#name: '-z gcs=always -z gcs-report=none' and shared libraries without GCS feature reports nothing.
+#name: '-z gcs=always -z gcs-report=error -z gcs-report-dynamic=warning' with GCS-unmarked shared libraries reports warnings.
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=none -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
+#ld: -z gcs=always -z gcs-report=error -z gcs-report-dynamic=warning -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
+#warning: \A[^\n]*libnogcs-so\.so: warning: GCS is required by -z gcs[^\n]*\n
+#warning:   [^\n]*libbti-plt-so\.so: warning: GCS is required by -z gcs[^\n]*
+
 #readelf: -n
 
 Displaying notes found in: .note.gnu.property
index 58498e6c00b690218cf9dd0817326b1e90cb46e3..dee840d533cb187cb5957b6e6543aeea03d2ae75 100644 (file)
@@ -1,11 +1,9 @@
-#name: '-z gcs=always -z gcs-report' and shared libraries without GCS feature reports warnings.
+#name: '-z gcs=always -z gcs-report=error -z gcs-report-dynamic=none' with GCS-unmarked shared libraries reports nothing.
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#warning: \A[^\n]*libnogcs-so\.so: warning: GCS is required by -z gcs[^\n]*\n
-#warning:   [^\n]*libbti-plt-so\.so: warning: GCS is required by -z gcs[^\n]*
+#ld: -z gcs=always -z gcs-report=error -z gcs-report-dynamic=none -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
 #readelf: -n
 
 Displaying notes found in: .note.gnu.property
index ecdaf526779acdd0342ec0c21f5b315e31ebdd67..471bebe642eb1a7ae3238985552d26d3de234be3 100644 (file)
@@ -1,15 +1,8 @@
-#name: '-z gcs=implicit -z gcs-report=error' and shared libraries without GCS feature reports warnings.
+#name: '-z gcs=implicit -z gcs-report-dynamic=error' with GCS-unmarked shared libraries reports errors.
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
-#ld: -z gcs=implicit -z gcs-report=error -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#warning: \A[^\n]*libnogcs-so\.so: warning: GCS is required by -z gcs[^\n]*\n
-#warning:   [^\n]*libbti-plt-so\.so: warning: GCS is required by -z gcs[^\n]*
-
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[      ]+Owner[        ]+Data size[    ]+Description
-  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
-      Properties: AArch64 feature: GCS
+#ld: -z gcs=implicit -z gcs-report-dynamic=error -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
+#error: \A[^\n]*libnogcs-so\.so: error: GCS is required by -z gcs[^\n]*\n
+#error:   [^\n]*libbti-plt-so\.so: error: GCS is required by -z gcs[^\n]*
index 4d32fb6aa549144f3ba1b41873e5d7bcea448c15..5ed6616df3eba1e4f8c5036dac09e259f1de58eb 100644 (file)
@@ -1,9 +1,9 @@
-#name: '-z gcs=implicit -z gcs-report=warning' and shared libraries without GCS feature reports warnings.
+#name: '-z gcs=implicit -z gcs-report-dynamic=warning' with GCS-unmarked shared libraries reports warnings.
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
-#ld: -z gcs=implicit -z gcs-report=warning -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
+#ld: -z gcs=implicit -z gcs-report-dynamic=warning -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
 #warning: \A[^\n]*libnogcs-so\.so: warning: GCS is required by -z gcs[^\n]*\n
 #warning:   [^\n]*libbti-plt-so\.so: warning: GCS is required by -z gcs[^\n]*
 #readelf: -n
@@ -11,4 +11,4 @@
 Displaying notes found in: .note.gnu.property
 [      ]+Owner[        ]+Data size[    ]+Description
   GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
-      Properties: AArch64 feature: GCS
\ No newline at end of file
+      Properties: AArch64 feature: GCS
index c0da6c1d9c63ebc4962284c487ee0e1862fe2abd..5f2be1167535cdc8b178b4802b32ec5004a92bf6 100644 (file)
@@ -1,12 +1,12 @@
-#name: '-z gcs=implicit -z gcs-report=none' and shared libraries without GCS feature reports no warning.
+#name: '-z gcs=implicit -z gcs-report-dynamic=none' with GCS-unmarked shared libraries reports nothing.
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
-#ld: -z gcs=implicit -z gcs-report=none -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
+#ld: -z gcs=implicit -z gcs-report-dynamic=none -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
 #readelf: -n
 
 Displaying notes found in: .note.gnu.property
 [      ]+Owner[        ]+Data size[    ]+Description
   GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
-      Properties: AArch64 feature: GCS
\ No newline at end of file
+      Properties: AArch64 feature: GCS
similarity index 51%
rename from ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-iv.d
rename to ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-d.d
index 554ca1186ef29da890feb9f2d08b489f074ae3ba..70f8845c9e3835c3c7794bd449504191cde4671e 100644 (file)
@@ -1,12 +1,12 @@
-#name: '-z gcs=always -z gcs-report=error -z gcs-report-dynamic=none' and shared libraries without GCS feature reports nothing.
+#name: '-z gcs=implicit' and GCS-unmarked shared libraries reports nothing.
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=error -z gcs-report-dynamic=none -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
+#ld: -z gcs=implicit -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
 #readelf: -n
 
 Displaying notes found in: .note.gnu.property
 [      ]+Owner[        ]+Data size[    ]+Description
   GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
-      Properties: AArch64 feature: GCS
\ No newline at end of file
+      Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-e.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-e.d
new file mode 100644 (file)
index 0000000..8781123
--- /dev/null
@@ -0,0 +1,12 @@
+#name: Linux distributions's main use case: no GCS options and GCS-unmarked shared libraries report nothing.
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
+#ld: -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[      ]+Owner[        ]+Data size[    ]+Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties: AArch64 feature: GCS
similarity index 61%
rename from ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-iii.d
rename to ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-f.d
index 76a7c461347cf2ac2325d573c782d11b7c12cf3b..18d4350c5e77986d61610f0153306764157e0527 100644 (file)
@@ -1,15 +1,14 @@
-#name: '-z gcs=always -z gcs-report=error -z gcs-report-dynamic=warning' and shared libraries without GCS feature reports warnings.
+#name: '-z gcs-report-dynamic' with GCS-unmarked shared libraries reports warnings.
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=error -z gcs-report-dynamic=warning -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
+#ld: -z gcs-report-dynamic -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
 #warning: \A[^\n]*libnogcs-so\.so: warning: GCS is required by -z gcs[^\n]*\n
 #warning:   [^\n]*libbti-plt-so\.so: warning: GCS is required by -z gcs[^\n]*
-
 #readelf: -n
 
 Displaying notes found in: .note.gnu.property
 [      ]+Owner[        ]+Data size[    ]+Description
   GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
-      Properties: AArch64 feature: GCS
\ No newline at end of file
+      Properties: AArch64 feature: GCS
index ae324bbba1eaf59bcd0446d48b31aed029946107..5c73a2920deb387315e594bde9bd59053ef5ba74 100644 (file)
@@ -1,7 +1,7 @@
-#name: '-z gcs=never -z gcs-report=error' and shared libraries without GCS feature reports no warning/error.
+#name: '-z gcs=never -z gcs-report-dynamic=error' with GCS-unmarked shared libraries reports nothing.
 #source: gcs.s
 #source: gcs2.s
 #alltargets: [check_shared_lib_support] *linux*
 #as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
-#ld: -z gcs=never -z gcs-report=error -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
+#ld: -z gcs=never -z gcs-report-dynamic=error -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
 #readelf: -n
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-b.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-b.d
deleted file mode 100644 (file)
index 6b65898..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#name: '-z gcs=never -z gcs-report=warning' and shared libraries without GCS feature reports no warning/error.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
-#ld: -z gcs=never -z gcs-report=warning -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#readelf: -n
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-c.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-c.d
deleted file mode 100644 (file)
index 35b011f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#name: '-z gcs=never -z gcs-report=none' and shared libraries without GCS feature reports no warning/error.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs  -defsym __property_gcs__=1
-#ld: -z gcs=never -z gcs-report=none -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#readelf: -n