[PATCH] Move mlibc case matches above GNU/Linux (and similar) ones.

mintsuki via Patch submission list for the GNU libtool shared library maintenance tool <[email protected]> Sun, 27 Apr 2025 19:08:08 +0000
Newsgroups gmane.comp.gnu.libtool.patches
Message-ID <DoJQd2scQR3naSU2uUFcsHLfOajGEewVShnrJqKjLOTiQY4G7FRINSb3nt4mm-uyx9LuJNOmSAoGSLn8tKJQDCAYas_ZKxHdM7ROiJywRM4=@protonmail.com>
From d08633958d24d4616e5511dee7b06b63d712f0ab Mon Sep 17 00:00:00 2001
From: Mintsuki <[email protected]>
Date: Sun, 27 Apr 2025 21:01:12 +0200
Subject: [PATCH] Move mlibc case matches above GNU/Linux (and similar) ones=
.

This allows a *-linux-mlibc host to correctly match with the mlibc userland
rather than having the GNU/Linux (and similar) userland match override it.
---
 m4/libtool.m4 | 70 +++++++++++++++++++++++++--------------------------
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 99b53ad0..4b4ea721 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -2929,6 +2929,18 @@ irix5* | irix6* | nonstopux*)
   hardcode_into_libs=3Dyes
   ;;
=20
+*-mlibc)
+  version_type=3Dlinux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=3Dno
+  need_version=3Dno
+  library_names_spec=3D'$libname$release$shared_ext$versuffix $libname$rel=
ease$shared_ext$major $libname$shared_ext'
+  soname_spec=3D'$libname$release$shared_ext$major'
+  dynamic_linker=3D'mlibc ld.so'
+  shlibpath_var=3DLD_LIBRARY_PATH
+  shlibpath_overrides_runpath=3Dno
+  hardcode_into_libs=3Dyes
+  ;;
+
 # No shared lib support for Linux oldld, aout, or coff.
 linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=3Dno
@@ -3040,18 +3052,6 @@ netbsd*)
   stdlibflag=3D
   ;;
=20
-*-mlibc)
-  version_type=3Dlinux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=3Dno
-  need_version=3Dno
-  library_names_spec=3D'$libname$release$shared_ext$versuffix $libname$rel=
ease$shared_ext$major $libname$shared_ext'
-  soname_spec=3D'$libname$release$shared_ext$major'
-  dynamic_linker=3D'mlibc ld.so'
-  shlibpath_var=3DLD_LIBRARY_PATH
-  shlibpath_overrides_runpath=3Dno
-  hardcode_into_libs=3Dyes
-  ;;
-
 newsos6)
   version_type=3Dlinux # correct to gnu/linux during the next big refactor
   library_names_spec=3D'$libname$release$shared_ext$versuffix $libname$rel=
ease$shared_ext$major $libname$shared_ext'
@@ -3713,12 +3713,12 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=3Dpass_all
   ;;
=20
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+*-mlibc)
   lt_cv_deplibs_check_method=3Dpass_all
   ;;
=20
-*-mlibc)
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   lt_cv_deplibs_check_method=3Dpass_all
   ;;
=20
@@ -4541,6 +4541,8 @@ m4_if([$1], [CXX], [
 =09    ;;
 =09esac
 =09;;
+      *-mlibc)
+=09;;
       linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
 =09case $cc_basename in
 =09  KCC*)
@@ -4607,8 +4609,6 @@ m4_if([$1], [CXX], [
 =09;;
       netbsd* | netbsdelf*-gnu)
 =09;;
-      *-mlibc)
-=09;;
       *qnx* | *nto*)
         # QNX uses GNU C++, but need to define -shared option too, otherwi=
se
         # it will coredump.
@@ -4869,6 +4869,12 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_static, $1)=3D'-non_shared'
       ;;
=20
+    *-mlibc)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)=3D'-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=3D'-fPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=3D'-static'
+      ;;
+
     linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
       case $cc_basename in
       # old Intel for x86_64, which still supported -KPIC.
@@ -4965,12 +4971,6 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_static, $1)=3D'-Bstatic'
       ;;
=20
-    *-mlibc)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)=3D'-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)=3D'-fPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)=3D'-static'
-      ;;
-
     *nto* | *qnx*)
       # QNX uses GNU C++, but need to define -shared option too, otherwise
       # it will coredump.
@@ -5372,6 +5372,11 @@ _LT_EOF
       _LT_TAGVAR(archive_expsym_cmds, $1)=3D'$SED "s|^|_|" $export_symbols=
 >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $co=
mpiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.=
expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280=
` -o $lib'
       ;;
=20
+    *-mlibc)
+=09_LT_TAGVAR(archive_cmds, $1)=3D'$CC -shared $pic_flag $libobjs $deplibs=
 $compiler_flags $wl-soname $wl$soname -o $lib'
+=09_LT_TAGVAR(archive_expsym_cmds, $1)=3D'$CC -shared $pic_flag $libobjs $=
deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$e=
xport_symbols -o $lib'
+      ;;
+
     gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       tmp_diet=3Dno
       if test linux-dietlibc =3D "$host_os"; then
@@ -5452,11 +5457,6 @@ _LT_EOF
       fi
       ;;
=20
-    *-mlibc)
-=09_LT_TAGVAR(archive_cmds, $1)=3D'$CC -shared $pic_flag $libobjs $deplibs=
 $compiler_flags $wl-soname $wl$soname -o $lib'
-=09_LT_TAGVAR(archive_expsym_cmds, $1)=3D'$CC -shared $pic_flag $libobjs $=
deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$e=
xport_symbols -o $lib'
-      ;;
-
     netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 =09_LT_TAGVAR(archive_cmds, $1)=3D'$LD -Bshareable $libobjs $deplibs $link=
er_flags -o $lib'
@@ -5989,6 +5989,9 @@ _LT_EOF
       _LT_TAGVAR(link_all_deplibs, $1)=3Dyes
       ;;
=20
+    *-mlibc)
+      ;;
+
     linux*)
       case $cc_basename in
       tcc*)
@@ -6000,9 +6003,6 @@ _LT_EOF
       esac
       ;;
=20
-    *-mlibc)
-      ;;
-
     netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 =09_LT_TAGVAR(archive_cmds, $1)=3D'$LD -Bshareable -o $lib $libobjs $depli=
bs $linker_flags'  # a.out
@@ -7141,6 +7141,10 @@ if test yes !=3D "$_lt_caught_CXX_error"; then
         _LT_TAGVAR(inherit_rpath, $1)=3Dyes
         ;;
=20
+      *-mlibc)
+        _LT_TAGVAR(ld_shlibs, $1)=3Dyes
+=09;;
+
       linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
         case $cc_basename in
           KCC*)
@@ -7306,10 +7310,6 @@ if test yes !=3D "$_lt_caught_CXX_error"; then
 =09esac
 =09;;
=20
-      *-mlibc)
-        _LT_TAGVAR(ld_shlibs, $1)=3Dyes
-=09;;
-
       netbsd*)
         if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 =09  _LT_TAGVAR(archive_cmds, $1)=3D'$LD -Bshareable  -o $lib $predep_obje=
cts $libobjs $deplibs $postdep_objects $linker_flags'
--=20
2.49.0