summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-07-07 18:58:20 +0200
committerLudovic Courtès <ludo@gnu.org>2021-07-08 00:28:56 +0200
commit145a5a5797f0f673c817d99760d1c1e5d71aa11c (patch)
treeff6e76095d5611f87fb004ec9e5c776cd9e92217 /gnu
parent68b0e0d511c2873603636e9f783ff59aac4b7612 (diff)
downloadguix-145a5a5797f0f673c817d99760d1c1e5d71aa11c.tar.gz
gnu: glibc: Fix cross-compilation to powerpc64le-linux-gnu.
Fixes <https://bugs.gnu.org/49417>.
Reported by Maxime Devos <maximedevos@telenet.be>.

* gnu/packages/patches/glibc-cross-objcopy.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/base.scm (glibc)[source]: Use it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/base.scm1
-rw-r--r--gnu/packages/patches/glibc-cross-objcopy.patch159
3 files changed, 161 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index c4d6a49606..adb4ad2e55 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1108,6 +1108,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/glibc-bootstrap-system-2.2.5.patch 	\
   %D%/packages/patches/glibc-bootstrap-system-2.16.0.patch 	\
   %D%/packages/patches/glibc-bootstrap-system.patch		\
+  %D%/packages/patches/glibc-cross-objcopy.patch		\
   %D%/packages/patches/glibc-cross-objdump.patch		\
   %D%/packages/patches/glibc-dl-cache.patch			\
   %D%/packages/patches/glibc-hidden-visibility-ldconfig.patch	\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 67df8a9154..565d2ccab8 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -692,6 +692,7 @@ the store.")
                                      "glibc-reinstate-prlimit64-fallback.patch"
                                      "glibc-supported-locales.patch"
                                      "glibc-cross-objdump.patch"
+                                     "glibc-cross-objcopy.patch" ;must come 2nd
                                      "glibc-hurd-clock_t_centiseconds.patch"
                                      "glibc-hurd-clock_gettime_monotonic.patch"
                                      "glibc-hurd-mach-print.patch"
diff --git a/gnu/packages/patches/glibc-cross-objcopy.patch b/gnu/packages/patches/glibc-cross-objcopy.patch
new file mode 100644
index 0000000000..e4c693aa44
--- /dev/null
+++ b/gnu/packages/patches/glibc-cross-objcopy.patch
@@ -0,0 +1,159 @@
+Use 'powerpc64le-linux-gnu-objcopy' rather than 'objcopy' when cross-compiling
+to powerpc64le-linux-gnu: <https://issues.guix.gnu.org/49417>.
+
+Patch submitted:
+  <https://sourceware.org/pipermail/libc-alpha/2021-July/128333.html>
+
+diff --git a/aclocal.m4 b/aclocal.m4
+index 13a791ffde..5b370c07a2 100644
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -118,8 +118,6 @@ AS=`$CC -print-prog-name=as`
+ LD=`$CC -print-prog-name=ld`
+ AR=`$CC -print-prog-name=ar`
+ AC_SUBST(AR)
+-OBJCOPY=`$CC -print-prog-name=objcopy`
+-AC_SUBST(OBJCOPY)
+ GPROF=`$CC -print-prog-name=gprof`
+ AC_SUBST(GPROF)
+ 
+diff --git a/configure b/configure
+index fe0eda1cd5..3a08270734 100755
+--- a/configure
++++ b/configure
+@@ -654,7 +654,6 @@ MAKE
+ LD
+ AS
+ GPROF
+-OBJCOPY
+ AR
+ LN_S
+ INSTALL_DATA
+@@ -689,6 +688,7 @@ sysheaders
+ ac_ct_CXX
+ CXXFLAGS
+ CXX
++OBJCOPY
+ OBJDUMP
+ READELF
+ CPP
+@@ -3054,6 +3054,98 @@ else
+   OBJDUMP="$ac_cv_prog_OBJDUMP"
+ fi
+ 
++if test -n "$ac_tool_prefix"; then
++  # Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args.
++set dummy ${ac_tool_prefix}objcopy; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_OBJCOPY+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$OBJCOPY"; then
++  ac_cv_prog_OBJCOPY="$OBJCOPY" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_OBJCOPY="${ac_tool_prefix}objcopy"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++fi
++fi
++OBJCOPY=$ac_cv_prog_OBJCOPY
++if test -n "$OBJCOPY"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJCOPY" >&5
++$as_echo "$OBJCOPY" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_OBJCOPY"; then
++  ac_ct_OBJCOPY=$OBJCOPY
++  # Extract the first word of "objcopy", so it can be a program name with args.
++set dummy objcopy; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_OBJCOPY+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$ac_ct_OBJCOPY"; then
++  ac_cv_prog_ac_ct_OBJCOPY="$ac_ct_OBJCOPY" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_ac_ct_OBJCOPY="objcopy"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++fi
++fi
++ac_ct_OBJCOPY=$ac_cv_prog_ac_ct_OBJCOPY
++if test -n "$ac_ct_OBJCOPY"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJCOPY" >&5
++$as_echo "$ac_ct_OBJCOPY" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++  if test "x$ac_ct_OBJCOPY" = x; then
++    OBJCOPY="false"
++  else
++    case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++    OBJCOPY=$ac_ct_OBJCOPY
++  fi
++else
++  OBJCOPY="$ac_cv_prog_OBJCOPY"
++fi
++
+ 
+ # We need the C++ compiler only for testing.
+ ac_ext=cpp
+@@ -4645,8 +4737,6 @@ AS=`$CC -print-prog-name=as`
+ LD=`$CC -print-prog-name=ld`
+ AR=`$CC -print-prog-name=ar`
+ 
+-OBJCOPY=`$CC -print-prog-name=objcopy`
+-
+ GPROF=`$CC -print-prog-name=gprof`
+ 
+ 
+diff --git a/configure.ac b/configure.ac
+index 924af12738..2148cd2ec8 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -53,6 +53,7 @@ AC_SUBST(cross_compiling)
+ AC_PROG_CPP
+ AC_CHECK_TOOL(READELF, readelf, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
++AC_CHECK_TOOL(OBJCOPY, objcopy, false)
+ 
+ # We need the C++ compiler only for testing.
+ AC_PROG_CXX