>From d08633958d24d4616e5511dee7b06b63d712f0ab Mon Sep 17 00:00:00 2001
From: Mintsuki <mints...@protonmail.com>
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=yes
   ;;
 
+*-mlibc)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix 
$libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  dynamic_linker='mlibc ld.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
 # No shared lib support for Linux oldld, aout, or coff.
 linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
@@ -3040,18 +3052,6 @@ netbsd*)
   stdlibflag=
   ;;
 
-*-mlibc)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='$libname$release$shared_ext$versuffix 
$libname$release$shared_ext$major $libname$shared_ext'
-  soname_spec='$libname$release$shared_ext$major'
-  dynamic_linker='mlibc ld.so'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
 newsos6)
   version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='$libname$release$shared_ext$versuffix 
$libname$release$shared_ext$major $libname$shared_ext'
@@ -3713,12 +3713,12 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+*-mlibc)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-*-mlibc)
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -4541,6 +4541,8 @@ m4_if([$1], [CXX], [
            ;;
        esac
        ;;
+      *-mlibc)
+       ;;
       linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
        case $cc_basename in
          KCC*)
@@ -4607,8 +4609,6 @@ m4_if([$1], [CXX], [
        ;;
       netbsd* | netbsdelf*-gnu)
        ;;
-      *-mlibc)
-       ;;
       *qnx* | *nto*)
         # QNX uses GNU C++, but need to define -shared option too, otherwise
         # it will coredump.
@@ -4869,6 +4869,12 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
       ;;
 
+    *-mlibc)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-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)='-Bstatic'
       ;;
 
-    *-mlibc)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-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)='$SED "s|^|_|" $export_symbols 
>$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs 
$compiler_flags $wl-h,$soname 
$wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr 
${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
+    *-mlibc)
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs 
$compiler_flags $wl-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs 
$deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file 
$wl$export_symbols -o $lib'
+      ;;
+
     gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       tmp_diet=no
       if test linux-dietlibc = "$host_os"; then
@@ -5452,11 +5457,6 @@ _LT_EOF
       fi
       ;;
 
-    *-mlibc)
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs 
$compiler_flags $wl-soname $wl$soname -o $lib'
-       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs 
$deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file 
$wl$export_symbols -o $lib'
-      ;;
-
     netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
        _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs 
$linker_flags -o $lib'
@@ -5989,6 +5989,9 @@ _LT_EOF
       _LT_TAGVAR(link_all_deplibs, $1)=yes
       ;;
 
+    *-mlibc)
+      ;;
+
     linux*)
       case $cc_basename in
       tcc*)
@@ -6000,9 +6003,6 @@ _LT_EOF
       esac
       ;;
 
-    *-mlibc)
-      ;;
-
     netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
        _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs 
$linker_flags'  # a.out
@@ -7141,6 +7141,10 @@ if test yes != "$_lt_caught_CXX_error"; then
         _LT_TAGVAR(inherit_rpath, $1)=yes
         ;;
 
+      *-mlibc)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+       ;;
+
       linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
         case $cc_basename in
           KCC*)
@@ -7306,10 +7310,6 @@ if test yes != "$_lt_caught_CXX_error"; then
        esac
        ;;
 
-      *-mlibc)
-        _LT_TAGVAR(ld_shlibs, $1)=yes
-       ;;
-
       netbsd*)
         if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
          _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib 
$predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
-- 
2.49.0


  • ... mintsuki via Patch submission list for the GNU libtool shared library maintenance tool
    • ... Ileana Dumitrescu

Reply via email to