From dfc8bb207104cb3c25c0922508acf6d3c27b69fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Tue, 7 Apr 2015 21:24:37 +0200
Subject: [PATCH] gnu: gcc: Disable RUNPATH validation for native builds.

* gnu/packages/gcc.scm (gcc-4.7)[arguments]: Pass
  #:validate-runpath? #f.
* gnu/packages/commencement.scm (gcc-boot0)[arguments]: Override
  #:validate-runpath? with 'substitute-keyword-arguments'.
  (gcc-final)[arguments]: Likewise.
* gnu/packages/cross-base.scm (cross-gcc-arguments): Likewise.
---
 gnu/packages/commencement.scm | 12 +++++++-----
 gnu/packages/cross-base.scm   |  2 ++
 gnu/packages/gcc.scm          |  5 +++++
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 766aea4bfdc..14af246e997 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -158,6 +158,8 @@ (define gcc-boot0
                    (srfi srfi-1)
                    (srfi srfi-26))
         ,@(substitute-keyword-arguments (package-arguments gcc-4.8)
+            ((#:validate-runpath? _)
+             #t)
             ((#:configure-flags flags)
              `(append (list ,(string-append "--target=" (boot-triplet))
 
@@ -500,11 +502,6 @@ (define-public gcc-final
 
        #:allowed-references ("out" "lib" ,glibc-final)
 
-       ;; Things like libasan.so and libstdc++.so NEED ld.so and/or
-       ;; libgcc_s.so but RUNPATH is empty.  This is a false positive, so turn
-       ;; it off.
-       #:validate-runpath? #f
-
        ;; Build again GMP & co. within GCC's build process, because it's hard
        ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
        ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
@@ -529,6 +526,11 @@ (define-public gcc-final
                                              "/lib")
                               flag))
                         ,flags)))
+           ((#:validate-runpath? _)
+            ;; Things like libasan.so and libstdc++.so NEED ld.so and/or
+            ;; libgcc_s.so but RUNPATH is empty.  This is a false positive, so
+            ;; turn it off.
+            #f)
            ((#:phases phases)
             `(alist-delete 'symlink-libgcc_eh ,phases)))))
 
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 565a4a82209..0f15a0aaec8 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -175,6 +175,8 @@ (define (cross? x)
                      #t)))
                ,phases)
              phases)))
+      ((#:validate-runpath? _)
+       #t)
       ((#:strip-binaries? _)
        ;; Disable stripping as this can break binaries, with object files of
        ;; libgcc.a showing up as having an unknown architecture.  See
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 68c9e98762f..4c06f841551 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -189,6 +189,11 @@ (define-public gcc-4.7
                                    ,(if stripped? "-g0" "-g")))))
 
          #:tests? #f
+
+         ;; libstdc++.so NEEDs libgcc_s.so but somehow it doesn't get
+         ;; $(libdir) in its RUNPATH, so turn it off.
+         #:validate-runpath? #f
+
          #:phases
          (alist-cons-before
           'configure 'pre-configure
-- 
GitLab