https://gcc.gnu.org/g:48a432de368ab8784392947a187880a658463106

commit r16-5447-g48a432de368ab8784392947a187880a658463106
Author: Rainer Orth <[email protected]>
Date:   Thu Nov 20 10:31:56 2025 +0100

    driver: Simplify LINK_ARCH*_SPEC on Solaris
    
    The various LINK_ARCH*_SPECs proved to be way more complex than
    necessary:
    
    * All uses of -YP,* can just go: they match the Solaris and GNU ld
      defaults.  In addition, the /usr/lib/libp entries are now superfluous:
      they only contain compatiblity symlinks to their counterparts in
      /usr/lib.  The %R parts are superceded by the -z sysroot/--sysroot
      options.
    
    * With those options gone, LINK_ARCH{32,64}_SPEC_BASE are now identical
      and can be merged.
    
    * It's no longer necessary to use arch-specific versions of the Solaris
      ld map.below4G linker map: with the new v2 mapfile syntax a single
      file can be used for all of SPARC, and x86, 32 and 64-bit.
    
    * Similarly, with LINK_ARCH{32,64,DEFAULT}_SPEC being identical, a
      common LINK_ARCH_SPEC can be used with the single difference (erroring
      out on the non-default multilib in non-multilib configurations,
      e.g. -m64 for -m32-only configs) moved to a separate
      LINK_ARCH_ERROR_SPEC.
    
    Bootstrapped without regressions on {i386,amd64}-pc-solaris2.11,
    sparc{,v9}-sun-solaris2.11 with as/ld, gas/ld, and gas/gld plus
    --disable-multilib builds of those.
    
    2025-11-17  Rainer Orth  <[email protected]>
    
            gcc:
            * config/sol2.h (LINK_ARCH32_SPEC_BASE): Don't provide -YP
            defaults.  Rename to ...
            (LINK_ARCH_SPEC_BASE): ... this.
            (LINK_ARCH32_SPEC): Remove.
            (LINK_ARCH64_SPEC_BASE): Remove.
            (LINK_ARCH64_SPEC): Rename to ...
            (LINK_ARCH_SPEC_1): ... this.
            [!USE_GLD]: Simplify map.below4G use.
            (LINK_ARCH_ERROR_SPEC): New macro.
            (LINK_ARCH32_SPEC): Remove.
            (LINK_ARCH_DEFAULT_SPEC): Remove.
            (LINK_ARCH_SPEC): Simplify using LINK_ARCH_ERROR_SPEC,
            LINK_ARCH_SPEC_1.
            (SUBTARGET_EXTRA_SPECS): Remove link_arch32, link_arch64
            link_arch_default.

Diff:
---
 gcc/config/sol2.h | 56 ++++++++++++-------------------------------------------
 1 file changed, 12 insertions(+), 44 deletions(-)

diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
index 36337dbf98d0..7c3cb82933bf 100644
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -270,35 +270,17 @@ along with GCC; see the file COPYING3.  If not see
   "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \
    %(endfile_arch) %(endfile_vtv) %(endfile_crtend) crtn.o%s"
 
-#undef LINK_ARCH32_SPEC_BASE
-#define LINK_ARCH32_SPEC_BASE \
+#undef LINK_ARCH_SPEC_BASE
+#define LINK_ARCH_SPEC_BASE \
   "%{G:-G} \
    %{YP,*} \
-   %{R*} \
-   %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp%R/lib:%R/usr/lib} \
-          %{!p:%{!pg:-Y P,%R/lib:%R/usr/lib}}}"
+   %{R*}"
 
-#undef LINK_ARCH32_SPEC
-#define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE
-
-/* This should be the same as LINK_ARCH32_SPEC_BASE, except with
-   ARCH64_SUBDIR appended to the paths.  */
-#undef LINK_ARCH64_SPEC_BASE
-#define LINK_ARCH64_SPEC_BASE \
-  "%{G:-G} \
-   %{YP,*} \
-   %{R*} \
-   %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/" ARCH64_SUBDIR ":%R/lib/" 
ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}        \
-          %{!p:%{!pg:-Y P,%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR 
"}}}"
-
-#undef LINK_ARCH64_SPEC
 #ifndef USE_GLD
-/* FIXME: Used to be SPARC-only.  Not SPARC-specfic but for the model name!  */
-#define LINK_ARCH64_SPEC \
-  "%{mcmodel=medlow:-M /usr/lib/ld/" ARCH64_SUBDIR "/map.below4G} " \
-  LINK_ARCH64_SPEC_BASE
+#define LINK_ARCH_SPEC_1 \
+  "%{mcmodel=medlow:-M /usr/lib/ld/map.below4G} " LINK_ARCH_SPEC_BASE
 #else
-#define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
+#define LINK_ARCH_SPEC_1 LINK_ARCH_SPEC_BASE
 #endif
 
 #ifdef USE_GLD
@@ -314,39 +296,25 @@ along with GCC; see the file COPYING3.  If not see
 #define TARGET_LD_EMULATION ""
 #endif
 
-#undef LINK_ARCH_SPEC
 #if DISABLE_MULTILIB
 #if DEFAULT_ARCH32_P
-#define LINK_ARCH_SPEC TARGET_LD_EMULATION " \
-%{m32:%(link_arch32)} \
-%{m64:%edoes not support multilib} \
-%{!m32:%{!m64:%(link_arch_default)}} \
-"
+#define LINK_ARCH_ERROR_SPEC "%{m64:%edoes not support multilib}"
 #else
-#define LINK_ARCH_SPEC TARGET_LD_EMULATION " \
-%{m32:%edoes not support multilib} \
-%{m64:%(link_arch64)} \
-%{!m32:%{!m64:%(link_arch_default)}} \
-"
+#define LINK_ARCH_ERROR_SPEC "%{m32:%edoes not support multilib}"
 #endif
 #else
-#define LINK_ARCH_SPEC TARGET_LD_EMULATION " \
-%{m32:%(link_arch32)} \
-%{m64:%(link_arch64)} \
-%{!m32:%{!m64:%(link_arch_default)}}"
+#define LINK_ARCH_ERROR_SPEC ""
 #endif
 
-#define LINK_ARCH_DEFAULT_SPEC \
-(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
+#undef LINK_ARCH_SPEC
+#define LINK_ARCH_SPEC TARGET_LD_EMULATION \
+  " " LINK_ARCH_ERROR_SPEC " " LINK_ARCH_SPEC_1
 
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS \
   { "startfile_arch",          STARTFILE_ARCH_SPEC },          \
   { "startfile_crtbegin",      STARTFILE_CRTBEGIN_SPEC },      \
   { "startfile_vtv",           STARTFILE_VTV_SPEC },           \
-  { "link_arch32",             LINK_ARCH32_SPEC },             \
-  { "link_arch64",             LINK_ARCH64_SPEC },             \
-  { "link_arch_default",       LINK_ARCH_DEFAULT_SPEC },       \
   { "link_arch",               LINK_ARCH_SPEC },               \
   { "endfile_arch",            ENDFILE_ARCH_SPEC },            \
   { "endfile_crtend",          ENDFILE_CRTEND_SPEC },          \

Reply via email to