bug-gnulib
[Top][All Lists]
Advanced

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

relocatable-prog: Add support for MidnightBSD


From: Bruno Haible
Subject: relocatable-prog: Add support for MidnightBSD
Date: Sun, 07 Feb 2021 19:40:17 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; )

For creating relocatable installations, the ELF $ORIGIN trick works
on MidnightBSD 1.1, just like on glibc and FreeBSD and some other platforms.
Namely, passing '-Wl,-rpath -Wl,\$ORIGIN/../lib' to the compiler causes
the resulting executable to contain an RPATH and a RUNPATH of '$ORIGIN/../lib'
(as can be seen by running 'readelf -d _executable_').

However, on MidnightBSD 0.8 this does not work: on this OS the resulting
executable contains an RPATH of '$ORIGIN/../lib' but no RUNPATH, and as a
consequence the executable does not find its library any more when the
installation directory hierarchy was moved. So, on this OS the wrapper
executable approach must be used.

Tested with GNU libiconv (with the libtool patch from
<https://savannah.gnu.org/patch/?10007>) and
'./configure --prefix=/tmp/foo --enable-relocatable'.


2021-02-07  Bruno Haible  <bruno@clisp.org>

        relocatable-prog: Add support for MidnightBSD.
        * m4/relocatable.m4 (gl_RELOCATABLE_BODY): Use the ELF $ORIGIN trick
        also on MidnightBSD >= 1.1.
        * build-aux/config.libpath: Treat MidnightBSD like FreeBSD.
        * build-aux/reloc-ldflags: Likewise.

diff --git a/build-aux/config.libpath b/build-aux/config.libpath
index 6d0e550..0823857 100755
--- a/build-aux/config.libpath
+++ b/build-aux/config.libpath
@@ -66,7 +66,7 @@ case $host_os in
   dgux*)
     shlibpath_var=LD_LIBRARY_PATH
     ;;
-  freebsd* | dragonfly*)
+  freebsd* | dragonfly* | midnightbsd*)
     shlibpath_var=LD_LIBRARY_PATH
     ;;
   gnu*)
diff --git a/build-aux/reloc-ldflags b/build-aux/reloc-ldflags
index fff3d79..ff748fe 100755
--- a/build-aux/reloc-ldflags
+++ b/build-aux/reloc-ldflags
@@ -56,7 +56,7 @@ esac
 origin_token=
 case "$host_os" in
   linux* | gnu* | kfreebsd* | \
-  freebsd* | dragonfly* | \
+  freebsd* | dragonfly* | midnightbsd* | \
   netbsd* | \
   openbsd* | \
   solaris* | \
diff --git a/m4/relocatable.m4 b/m4/relocatable.m4
index a3bd41e..c11999e 100644
--- a/m4/relocatable.m4
+++ b/m4/relocatable.m4
@@ -1,4 +1,4 @@
-# relocatable.m4 serial 23
+# relocatable.m4 serial 24
 dnl Copyright (C) 2003, 2005-2007, 2009-2021 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -68,10 +68,11 @@ AC_DEFUN([gl_RELOCATABLE_BODY],
         fi
         ;;
 changequote(,)dnl
-      # FreeBSD >= 7.3, DragonFly >= 3.0: yes.
+      # FreeBSD >= 7.3, DragonFly >= 3.0, MidnightBSD >= 1.1: yes.
       freebsd | freebsd[1-7] | freebsd[1-6].* | freebsd7.[0-2]) ;;
       dragonfly | dragonfly[1-2] | dragonfly[1-2].*) ;;
-      freebsd* | dragonfly*) use_elf_origin_trick=yes ;;
+      midnightbsd | midnightbsd0* | midnightbsd1.0*) ;;
+      freebsd* | dragonfly* | midnightbsd*) use_elf_origin_trick=yes ;;
       # NetBSD >= 8.0: yes.
       netbsd | netbsd[1-7] | netbsd[1-7].*) ;;
       netbsdelf | netbsdelf[1-7] | netbsdelf[1-7].*) ;;




reply via email to

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