From 4a2b74bf4ce6780bb284bbcc63d3548233b09ee6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 21 Apr 2015 21:14:28 +0200 Subject: gnu: ld-wrapper: Ignore the .so argument following '-dynamic-linker'. Reported at . * gnu/packages/ld-wrapper.in (library-files-linked): Rename 'path+files' to 'path+files+args'. Thread the reverse list of previous arguments. Add case for when the previous argument is "-dynamic-linker". --- gnu/packages/ld-wrapper.in | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'gnu/packages') diff --git a/gnu/packages/ld-wrapper.in b/gnu/packages/ld-wrapper.in index ed2a51ea67..db662e7d76 100644 --- a/gnu/packages/ld-wrapper.in +++ b/gnu/packages/ld-wrapper.in @@ -140,34 +140,45 @@ exec @GUILE@ -c "(load-compiled \"@SELF@.go\") (apply $main (cdr (command-line)) (define (library-files-linked args) ;; Return the file names of shared libraries explicitly linked against via ;; `-l' or with an absolute file name in ARGS. - (define path+files + (define path+files+args (fold (lambda (argument result) (match result - ((library-path . library-files) + ((library-path library-files ("-dynamic-linker" . rest)) + ;; When passed '-dynamic-linker ld.so', ignore 'ld.so'. + ;; See . + (list library-path + library-files + (cons* argument "-dynamic-linker" rest))) + ((library-path library-files previous-args) (cond ((string-prefix? "-L" argument) ;augment the search path - (cons (append library-path + (list (append library-path (list (string-drop argument 2))) - library-files)) + library-files + (cons argument previous-args))) ((string-prefix? "-l" argument) ;add library (let* ((lib (string-append "lib" (string-drop argument 2) ".so")) (full (search-path library-path lib))) - (if full - (cons library-path - (cons full library-files)) - result))) + (list library-path + (if full + (cons full library-files) + library-files) + (cons argument previous-args)))) ((and (string-prefix? %store-directory argument) (shared-library? argument)) ;add library - (cons library-path - (cons argument library-files))) + (list library-path + (cons argument library-files) + (cons argument previous-args))) (else - result))))) - (cons '() '()) + (list library-path + library-files + (cons argument previous-args))))))) + (list '() '() '()) args)) - (match path+files - ((path . files) + (match path+files+args + ((path files arguments) (reverse files)))) (define (rpath-arguments library-files) -- cgit v1.2.3