bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

relocatable-prog: Add support for 32-bit build on FreeBSD/powerpc64


From: Bruno Haible
Subject: relocatable-prog: Add support for 32-bit build on FreeBSD/powerpc64
Date: Sat, 24 Aug 2024 16:37:38 +0200

FreeBSD/powerpc64 is a bi-arch platform, and in 32-bit mode a different
environment variable needs to be used instead of LD_LIBRARY_PATH.
For details, see <https://savannah.gnu.org/patch/?10469>.

This patch updates the 'relocatable-prog' module accordingly.


2024-08-24  Bruno Haible  <bruno@clisp.org>

        relocatable-prog: Add support for 32-bit build on FreeBSD/powerpc64.
        Reference: <https://savannah.gnu.org/patch/?10469>.
        * build-aux/config.libpath: Accept a second argument. Use it on
        FreeBSD/powerpc64.
        (func_usage): Document it.
        * m4/relocatable.m4 (AC_LIB_LIBPATH): Require gl_HOST_CPU_C_ABI_32BIT.
        Pass HOST_CPU_C_ABI_32BIT to the config.libpath script.
        * modules/relocatable-prog (Files): Add m4/host-cpu-c-abi.m4.

diff --git a/build-aux/config.libpath b/build-aux/config.libpath
index 173cd0d90b..ba0f94426b 100755
--- a/build-aux/config.libpath
+++ b/build-aux/config.libpath
@@ -29,7 +29,7 @@
 func_usage ()
 {
   echo "\
-Usage: config.libpath [OPTION] HOST
+Usage: config.libpath [OPTION] HOST HOST_CPU_C_ABI_32BIT
 
 Prints shell variable assignments that describe how to set the
 run time search path of shared libraries in an executable at run time.
@@ -39,6 +39,9 @@ The first argument passed to this file is the canonical host 
specification,
 or
    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
 
+The second argument passed to this file is 'yes' if the C language ABI
+is 32-bit, or 'no' if it is 64-bit.
+
 The environment variable LD should be set by the caller.
 
 The set of defined variables is at the end of this script.
@@ -102,6 +105,7 @@ host="$1"
 host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+abi_32bit="$2"
 
 shlibpath_var=
 case $host_os in
@@ -133,7 +137,18 @@ case $host_os in
     shlibpath_var=LD_LIBRARY_PATH
     ;;
   freebsd* | dragonfly* | midnightbsd*)
-    shlibpath_var=LD_LIBRARY_PATH
+    case $host_cpu in
+      powerpc64)
+        if test "$abi_32bit" != yes; then
+          shlibpath_var=LD_LIBRARY_PATH
+        else
+          shlibpath_var=LD_32_LIBRARY_PATH
+        fi
+        ;;
+      *)
+        shlibpath_var=LD_LIBRARY_PATH
+        ;;
+    esac
     ;;
   gnu*)
     shlibpath_var=LD_LIBRARY_PATH
diff --git a/m4/relocatable.m4 b/m4/relocatable.m4
index b86829e246..54423a8336 100644
--- a/m4/relocatable.m4
+++ b/m4/relocatable.m4
@@ -1,5 +1,5 @@
 # relocatable.m4
-# serial 25
+# serial 26
 dnl Copyright (C) 2003, 2005-2007, 2009-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -149,10 +149,11 @@ AC_DEFUN([AC_LIB_LIBPATH]
 [
   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD
   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
+  AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT])   dnl we use $HOST_CPU_C_ABI_32BIT
   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
   AC_CACHE_CHECK([for shared library path variable], [acl_cv_libpath], [
     LD="$LD" \
-    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.libpath" "$host" > conftest.sh
+    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.libpath" "$host" 
"$HOST_CPU_C_ABI_32BIT" > conftest.sh
     . ./conftest.sh
     rm -f ./conftest.sh
     acl_cv_libpath=${acl_cv_shlibpath_var:-none}
diff --git a/modules/relocatable-prog b/modules/relocatable-prog
index 8e22b20dd0..4d13fda63b 100644
--- a/modules/relocatable-prog
+++ b/modules/relocatable-prog
@@ -13,6 +13,7 @@ lib/progreloc.c
 m4/relocatable.m4
 m4/relocatable-lib.m4
 m4/lib-ld.m4
+m4/host-cpu-c-abi.m4
 
 Depends-on:
 relocatable-prog-wrapper






reply via email to

[Prev in Thread] Current Thread [Next in Thread]