libtool-patches
[Top][All Lists]
Advanced

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

[patch #10469] Add support for 32-bit mode on FreeBSD/powerpc64


From: Bruno Haible
Subject: [patch #10469] Add support for 32-bit mode on FreeBSD/powerpc64
Date: Sat, 24 Aug 2024 08:12:59 -0400 (EDT)

URL:
  <https://savannah.gnu.org/patch/?10469>

                 Summary: Add support for 32-bit mode on FreeBSD/powerpc64
                   Group: GNU Libtool
               Submitter: haible
               Submitted: Sat 24 Aug 2024 02:12:56 PM CEST
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sat 24 Aug 2024 02:12:56 PM CEST By: Bruno Haible <haible>
FreeBSD 14 has two PowerPC64 ports:
* A little-endian one (powerpc64le),
* a big-endian one (powerpc64).

The latter is a bi-arch system: While "cc" creates 64-bit binaries, "cc -m32"
creates 32-bit binaries. 32-bit executables have /libexec/ld-elf32.so.1 as
dynamic loader.

In GNU libunistring, the unit tests in the build tree are libtool wrapper
scripts. In 32-bit mode, they all fail:


$ ./test-accept
ld-elf32.so.1: Shared object "libunistring.so.5" not found, required by
"test-accept"


The library was built correctly in the build tree:


$ ls -lL /home/bruno/libunistring-1.2/build-32/lib/.libs/libunistring.so.5
-rwxr-xr-x  1 bruno bruno 3347152 Aug 24 04:25
/home/bruno/libunistring-1.2/build-32/lib/.libs/libunistring.so.5


The problem is that the wrapper script uses the variable 'LD_LIBRARY_PATH':


$ grep LIBRARY_PATH test-accept
    # Add our own library path to LD_LIBRARY_PATH
   
LD_LIBRARY_PATH="/home/bruno/libunistring-1.2/build-32/lib/.libs:$LD_LIBRARY_PATH"
    # Some systems cannot cope with colon-terminated LD_LIBRARY_PATH
    LD_LIBRARY_PATH=`$ECHO "$LD_LIBRARY_PATH" | /usr/bin/sed 's/::*$//'`
    export LD_LIBRARY_PATH


And indeed, LD_LIBRARY_PATH seems to be ignored here:


$ LD_LIBRARY_PATH=/home/bruno/libunistring-1.2/build-32/lib/.libs
.libs/test-accept
ld-elf32.so.1: Shared object "libunistring.so.5" not found, required by
"test-accept"


The documentation <https://man.freebsd.org/cgi/man.cgi?query=ld.so> says:
  "On 64-bit architectures, the linker for 32-bit objects recognizes all the
environment variables listed below, but is being prefixed with LD_32_,  for
example: LD_32_TRACE_LOADED_OBJECTS."

So, let's try LD_32_LIBRARY_PATH instead:


$ LD_32_LIBRARY_PATH=/home/bruno/libunistring-1.2/build-32/lib/.libs
.libs/test-accept
(works)


Or like this:


$ sed -i -e 's/LD_LIBRARY_PATH/LD_32_LIBRARY_PATH/g' test-accept
$ ./test-accept
(works)


The fix is, of course, to change the value of shlibpath_var in the generated
'libtool' script.

Note: The lt_cv_* values in config.cache are the same for the 32-bit build as
for the 64-bit build:


$ diff build-64/config.cache build-32/config.cache 
23c23
< ac_cv_env_CC_value='cc -ferror-limit=0'
---
> ac_cv_env_CC_value='cc -m32 -ferror-limit=0'
...
407,408c402,403
< gl_cv_header_working_stdint_h=${gl_cv_header_working_stdint_h=no}
< gl_cv_host_cpu_c_abi_32bit=${gl_cv_host_cpu_c_abi_32bit=no}
---
> gl_cv_header_working_stdint_h=${gl_cv_header_working_stdint_h=yes}
> gl_cv_host_cpu_c_abi_32bit=${gl_cv_host_cpu_c_abi_32bit=yes}
...


Find attached:
* freebsd-biarch.diff: a patch relative to libtool-2.4.7.
* 0001-Fix-libtool-wrapper-programs-in-32-bit-mode-on-FreeB.patch: a commit
for libtool 'master'.







    _______________________________________________________
File Attachments:


-------------------------------------------------------
Name: freebsd-biarch.diff  Size: 761B
<https://file.savannah.gnu.org/file/freebsd-biarch.diff?file_id=56379>
-------------------------------------------------------
Name: 0001-Fix-libtool-wrapper-programs-in-32-bit-mode-on-FreeB.patch  Size:
1KiB
<https://file.savannah.gnu.org/file/0001-Fix-libtool-wrapper-programs-in-32-bit-mode-on-FreeB.patch?file_id=56380>

    AGPL NOTICE

These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://git.savannah.nongnu.org/cgit/administration/savane.git/snapshot/savane-d29f54e45b7d24f2f4db4b8f43b4a13267e27d3b.tar.gz

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?10469>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

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