nix-archive-1(type directoryentry(namebinnode(type directoryentry(nameldnode(typeregular executablecontents1#!/gnu/store/h1ap2ldl46a57fa3978w6pdbrq3zhzks-bash-minimal-5.1.16/bin/bash # -*- mode: scheme; coding: utf-8; -*- # XXX: We have to go through Bash because there's no Guile command-line switch to # ignore the various Guile load path related environment variables. # Unset 'GUILE_LOAD_PATH' to make sure we do not stumble upon # incompatible Guile files (see # ). unset GUILE_LOAD_PATH unset GUILE_LOAD_COMPILED_PATH unset GUILE_SYSTEM_PATH unset GUILE_SYSTEM_COMPILED_PATH # Use `load-compiled' because `load' (and `-l') doesn't otherwise load our # .go file, or causes extraneous `stat' system calls when the "-C" "/" arguments # are provided. main="(@ (gnu build-support ld-wrapper) ld-wrapper)" exec /gnu/store/05z5jdf858n4n4jbprlmvi0la4fzy148-guile-3.0.9/bin/guile -c "(load-compiled \"/gnu/store/fy0b225yfj0935gklyavxw81aak0zzc4-ld-wrapper-0/bin/ld.go\") ($main (command-line))" "$@" !# ;;; GNU Guix --- Functional package management for GNU ;;; Copyright ?? 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2020 Ludovic Court??s ;;; Copyright ?? 2020 Marius Bakke ;;; Copyright ?? 2024 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu build-support ld-wrapper) #:use-module (srfi srfi-1) #:use-module (ice-9 match) #:autoload (ice-9 rdelim) (read-delimited) #:export (ld-wrapper)) ;;; Commentary: ;;; ;;; This is a wrapper for the linker. Its purpose is to inspect the -L and ;;; -l switches passed to the linker, add corresponding -rpath arguments, and ;;; invoke the actual linker with this new set of arguments. ;;; ;;; The alternatives to this hack would be: ;;; ;;; 1. Using $LD_RUN_PATH. However, that would tend to include more than ;;; needed in the RPATH; for instance, given a package with `libfoo' as ;;; an input, all its binaries would have libfoo in their RPATH, ;;; regardless of whether they actually NEED it. ;;; ;;; 2. Use a GCC "lib" spec string such as `%{L*:-rpath %*}', which adds a ;;; `-rpath LIBDIR' argument for each occurrence of `-L LIBDIR'. ;;; However, this doesn't work when $LIBRARY_PATH is used, because the ;;; additional `-L' switches are not matched by the above rule, because ;;; the rule only matches explicit user-provided switches. See ;;; for details. ;;; ;;; As a bonus, this wrapper checks for "impurities"--i.e., references to ;;; libraries outside the store. ;;; ;;; Code: (define %real-ld ;; Name of the linker that we wrap. "/gnu/store/03i3civrmcfpc0212jdir7hvgz776iv1-binutils-2.41/bin/ld") (define %store-directory ;; File name of the store. (or (getenv "NIX_STORE") "/gnu/store")) (define %temporary-directory ;; Temporary directory. (or (getenv "TMPDIR") "/tmp")) (define %build-directory ;; Top build directory when run from a builder. (getenv "NIX_BUILD_TOP")) (define %allow-impurities? ;; Whether to allow references to libraries outside the store. ;; Allow them by default for convenience. (let ((value (getenv "GUIX_LD_WRAPPER_ALLOW_IMPURITIES"))) (or (not value) (let ((value (string-downcase value))) (cond ((member value '("yes" "y" "t" "true" "1")) #t) ((member value '("no" "n" "f" "false" "0")) #f) (else (format (current-error-port) "ld-wrapper: ~s: invalid value for \ 'GUIX_LD_WRAPPER_ALLOW_IMPURITIES'~%" value))))))) (define %debug? ;; Whether to emit debugging output. (getenv "GUIX_LD_WRAPPER_DEBUG")) (define %disable-rpath? ;; Whether to disable automatic '-rpath' addition. (getenv "GUIX_LD_WRAPPER_DISABLE_RPATH")) (define (readlink* file) ;; Call 'readlink' until the result is not a symlink. (define %max-symlink-depth 50) (let loop ((file file) (depth 0)) (define (absolute target) (if (absolute-file-name? target) target (string-append (dirname file) "/" target))) (if (>= depth %max-symlink-depth) file (call-with-values (lambda () (catch 'system-error (lambda () (values #t (readlink file))) (lambda args (let ((errno (system-error-errno args))) (if (or (= errno EINVAL) (= errno ENOENT)) (values #f file) (apply throw args)))))) (lambda (success? target) (if success? (loop (absolute target) (+ depth 1)) file)))))) (define (pure-file-name? file) ;; Return #t when FILE is the name of a file either within the store ;; (possibly via a symlink) or within the build directory. (let ((file (readlink* file))) (or (not (string-prefix? "/" file)) (string-prefix? %store-directory file) (string-prefix? %temporary-directory file) (and %build-directory (string-prefix? %build-directory file))))) (define (store-file-name? file) ;; Return #t when FILE is a store file, possibly indirectly. (string-prefix? %store-directory (readlink* file))) (define (shared-library? file) ;; Return #t when FILE denotes a shared library. (or (string-suffix? ".so" file) (let ((index (string-contains file ".so."))) ;; Since we cannot use regexps during bootstrap, roll our own. (and index (string-every (char-set-union (char-set #\.) char-set:digit) (string-drop file (+ index 3))))))) (define (library-search-path args) ;; Return the library search path as a list of directory names. The GNU ld ;; manual notes that "[a]ll `-L' options apply to all `-l' options, ;; regardless of the order in which the options appear", so we must compute ;; the search path independently of the -l options. (let loop ((args args) (path '())) (match args (() (reverse path)) (("-L" directory . rest) (loop rest (cons directory path))) ((argument . rest) (if (string-prefix? "-L" argument) ;augment the search path (loop rest (cons (string-drop argument 2) path)) (loop rest path)))))) (define (library-files-linked args library-path) ;; Return the absolute file names of shared libraries explicitly linked ;; against via `-l' or with an absolute file name in ARGS, looking them up ;; in LIBRARY-PATH. (define files+args (fold (lambda (argument result) (match result ((library-files ((and flag (or "-dynamic-linker" "-plugin")) . rest)) ;; When passed '-dynamic-linker ld.so', ignore 'ld.so'; when ;; passed '-plugin liblto_plugin.so', ignore ;; 'liblto_plugin.so'. See . (list library-files (cons* argument flag rest))) ((library-files previous-args) (cond ((string-prefix? "-l" argument) ;add library (let* ((lib (string-append "lib" (string-drop argument 2) ".so")) (full (search-path library-path lib))) (list (if full (cons full library-files) library-files) (cons argument previous-args)))) ((and (string-prefix? %store-directory argument) (shared-library? argument)) ;add library (list (cons argument library-files) (cons argument previous-args))) (else (list library-files (cons argument previous-args))))))) (list '() '()) args)) (match files+args ((files arguments) (reverse files)))) (define (rpath-arguments library-files) ;; Return the `-rpath' argument list for each of LIBRARY-FILES, a list of ;; absolute file names. (fold-right (lambda (file args) ;; Add '-rpath' if and only if FILE is in the store; we don't ;; want to add '-rpath' for files under %BUILD-DIRECTORY or ;; %TEMPORARY-DIRECTORY because that could leak to installed ;; files. (cond ((and (not %disable-rpath?) (store-file-name? file)) (cons* "-rpath" (dirname file) args)) ((or %allow-impurities? (pure-file-name? file)) args) (else (begin (format (current-error-port) "ld-wrapper: error: attempt to use \ library outside of ~a: ~s~%" %store-directory file) (exit 1))))) '() library-files)) (define (expand-arguments args) ;; Expand ARGS such that "response file" arguments, such as "@args.txt", are ;; expanded (info "(gcc) Overall Options"). (define (response-file-arguments file) (define (tokenize port) ;; Return a list of all strings found in PORT. Quote characters are ;; removed, but whitespaces within quoted strings are preserved. (let loop ((tokens '())) (let* ((token+delimiter (read-delimited " '\"\n" port 'split)) (token (car token+delimiter)) (delim (cdr token+delimiter))) (if (eof-object? token) (reverse tokens) (case delim ((#\") (loop (cons (read-delimited "\"" port) tokens))) ((#\') (loop (cons (read-delimited "'" port) tokens))) (else (if (> (string-length token) 0) (loop (cons token tokens)) (loop tokens)))))))) (when %debug? (format (current-error-port) "ld-wrapper: attempting to read arguments from '~a'~%" file)) (call-with-input-file file tokenize)) (define result (fold-right (lambda (arg result) (if (string-prefix? "@" arg) (let ((file (string-drop arg 1))) (append (catch 'system-error (lambda () (response-file-arguments file)) (lambda args ;; FILE doesn't exist or cannot be read so ;; leave ARG as is. (list arg))) result)) (cons arg result))) '() args)) ;; If there are "@" arguments in RESULT *and* we can expand them (they don't ;; refer to nonexistent files), then recurse. (if (equal? result args) result (expand-arguments result))) (define (ld-wrapper args) ;; Invoke the real `ld' with ARGS, augmented with `-rpath' switches. (let* ((args (expand-arguments (cdr args))) ;strip arg0 (path (library-search-path args)) (libs (library-files-linked args path)) (args (append args (rpath-arguments libs)))) (when %debug? (format (current-error-port) "ld-wrapper: library search path: ~s~%" path) (format (current-error-port) "ld-wrapper: libraries linked: ~s~%" libs) (format (current-error-port) "ld-wrapper: invoking `~a' with ~s~%" %real-ld args) (force-output (current-error-port))) (apply execl %real-ld (basename %real-ld) args))) ;;; ld-wrapper.scm ends here ))entry(nameld.gonode(typeregularcontents0ELF4@ 4 (0A0A@ @ @@@88HA ;?T?;?T?;!@T'@;?T+@;?@TE@TD@|G@I@qU;@G   p`P@0 ' T6@|+@3@qU-@G  'T/@4);-@HT2@4); 0@T 2@'|;)@HT.@4); ,@T @' |;#@HT(@4); &@T @'HT#@4); !@T ?'|NT@|?@pU@G  @'->T@4oG ; '@ @'|(->4oG;5@@' |T,@'  ;%@T'@@'HT@4);@T?' HT@4);@T?' y->U@B0>EL<LHBP>EL< L HHHB `> L H H H H H HT?4);?HT?4)HT?4)HT?4);?HT?4);?HT?4)B0L<LHHT?4)B0L<LH HT?4)B0L<LHHT>4)BPL<^LHH HH'?|>?pU?G'?|>?pUi?G'?|>?pUa?G'? 00'T?G 0@'??T?> E< V< q; ??'u IB 0L L  H B0L L HT?'   `| .T ?|  ~>?pU ?G P'| T?'T?P' P^''v? `Tl?|G>i?pUc?GG@'PP`@'u? TX?|)>U?pUO?GP'PTL?|>I?pUC?Gy0"TD?| >A?pU;?Gy0TG')?|= ?pU>G'#?|=?pU>G'?|=?pU>G'? ``'0;>T>`'P||5T>G`'P|$T>G`'P|G| Tq>P`p@''P'P'P'> '> p;>T>p'OP |E;>T>p'OP |3 .T>'QP T>|"=>pU>GT>`'JP 5T>p'M` T>`pP'O''>|<~>pU`>G'>|<x>pUX>G'{>|<r>pUL>G'u>|<l>pUF>G'o>|<f>pU:>G'i>|<`>pU.>G'_> 'w> ; W>T Y>|  <V>qU P>G  c>'| U| B} ?G G ~|p' || } G GB H H p`G G TY=p' |T=p' B HH`T >; ;; >B H H B H H B H H  $ T >|  T <T >4 oU =G  '= G'=B@>EL<eLHHB HHB HHT=|;=pU=G0P@`'@|2}/GG|}G| T=| T<T=4oU=GP'T=;;;=B HHB HHB HH$`T=;o;;=B HHB HHB HH$`= | \} YG G |K}HG| DG|@}=GG;w=~P0|TF=|};C=qU==G`P'  |;^=~P|T)=|`;&=qU =G`P'  |G G |}G| G ;8=T@<'p |A;.= T<'n ;<T@<p'Yp T=|;=pU=GG `p'p | B H HB H H  B H H  B H H  'T;G p'3p | c;T<TV<'p | D;L<TN<'p | G .TC<'p T=<|::<pU4<GT7<p'p 5 T.<' T'<p'p | B H H B H H B H H  B H H   'B H H  B H H  B H H  'T E<; /:;C<B H HB H H B H H $ B H H B H H  B H H  B H H  'B H H B H H  B H H  B H H  'T <; 9;<B H HB H H B H H $ =< G'<<Bp>EL<LGHGHGHGHGHT$< 0'.< pG |)'T 0T;G 'A` |; <T ;'` B HHB H H 'G |j'( 0;:T:`'p |UT:G `'p |HT:G `'p |;G |T:P`'` |*T+:'P ;;T':G `Pp' T;|9;pU;G p' p';|i9a:pU9G';| 9;pUc;G'; G'; B0>EL<6LHTJ;`p'P ~p"||T:|'9:qU:G`p'` |`'`'Q; ;B;T:'I` |>T:'8` T.;| T9T-;4oU#;GT9B@>EL<$LG H HB 0>EL <'L H  T9`P'  p'B H H  '; pG|TB9'@;:T>9G'T:| TG9T:4oU:GG;:`p@';  ; :T :T:|^8`8pU:G'p |}GG  "( '|}K/.vB HH $"&:;:T:'p B HH p;:T:'{p B HH p; :;::'T:|88pU:G'  |>};GG : "& '|} K/`.`vB HH`&d:TR:p' 0 B HHPTC:' ! B HHP&X:T 9|  T t8T 94 oU 9G  '&C:I:|77pU:G'?: B GHH'[: | } G G 'F  `'P G 'm` T9| T#8T94oU9GG p'= `'p G | RT7'vp ;9T7'y T7'dp ;9T7p'g T7'RP ;9;?7T7' T7'>P T9|79pU9G' T 9|  79pU 9G ;7T9|69pU9G'` #p`  P'& 99 VS6;O61UO6U_6VN6;J61UJ6UR6VI6;E61UE6UE6VF6C6VE6B6VD6;@61U@6T>61U<6V=6V>6;:61U:6T861U66V76;361U36U;6V26;.61U.6U.6V/6,6V-6+6V@6*6V*6;&61U&6UN6U,6V#6;61U6U6V 66V66V66V66V6;61U6T61U6V6;61U6T61U 6V6; 61U 6U 6V 66V66V6;61U6U6V66V66V6w;51U5T51U5V5n;51U5U5V5gV5jV5o;51U5V5lV5};51U5V5|V5V5;51U5V5V5V5;51U5V5V5;51U5V5V5V5;51U5V5V65V5V65V5V65V5V55V5V55V55V55V55V55V5uV65V5sV55V5qV55V5oV55V5mV55V55V55V55V55V5_V5p;51U5V5kV5p;51U5V5mV5t;51U5V5V5n;51U5V5k;51U5V5j;51U5V5V5d;51U5V5^V5`;51U5V5_;51U5V5\;51U5V5[V5\V5aV5b;51U5V5_V5`V5eV5hV5mV5nV5oV6pV6qV 6rV6uV6xV"6yV)6zV46}V96V>6VC6VH6VM6VV6VY6VZ6;V61UV6VW6VZ6;V61UV6Va6Vf6Vg6Vh6Vi6Vl6V{6V|6V6V6V6V6;61U6V6V6;61U6V6V6V6;61U6V6;61U6U6U6U6V6V66V6V66V6V6V6V66V6;6U6U6V6V6V6V6V6V6V6V66'gnu' build-support' ld-wrapper'filename'?/gnu/store/fy0b225yfj0935gklyavxw81aak0zzc4-ld-wrapper-0/bin/ld'imports'srfi'srfi-1'ice-9'match'exports' autoloads'rdelim'read-delimited' declarative?'guile'define-module*'set-current-module'%real-ld'@/gnu/store/03i3civrmcfpc0212jdir7hvgz776iv1-binutils-2.41/bin/ld'%store-directory' NIX_STORE' /gnu/store'%temporary-directory'TMPDIR'/tmp'%build-directory' NIX_BUILD_TOP'%allow-impurities?' GUIX_LD_WRAPPER_ALLOW_IMPURITIES'string-downcase'member'yes'y't'true'1'no'n'f'false'0'Fld-wrapper: ~s: invalid value for 'GUIX_LD_WRAPPER_ALLOW_IMPURITIES'~%'%debug?'GUIX_LD_WRAPPER_DEBUG'%disable-rpath?'GUIX_LD_WRAPPER_DISABLE_RPATH' readlink*'pure-file-name?'store-file-name?'shared-library?'library-search-path'library-files-linked'rpath-arguments'expand-arguments'getenv'current-error-port'format' system-error'/'absolute-file-name?'readlink'system-error-errno'EINVAL'ENOENT'throw'catch'dirname' string-append'string-prefix?'.so'.so.'char-set:digit'string-suffix?'string-contains'char-set'char-set-union' string-drop' string-every'-L'equal?' match-error'no matching pattern'reverse'fold'-dynamic-linker'-plugin'-l'lib' search-path'-rpath'=ld-wrapper: error: attempt to use library outside of ~a: ~s~%'exit' fold-right'@'append'4ld-wrapper: attempting to read arguments from '~a'~%'call-with-input-file' '" 'split'wrong-type-arg' string-length'8Wrong type argument in position 1 (expecting string): ~S'''"'car'6Wrong type argument in position 1 (expecting pair): ~S'%ld-wrapper: library search path: ~s~%'"ld-wrapper: libraries linked: ~s~%'#ld-wrapper: invoking `~a' with ~s~%' force-output'execl'basename'cdr`< 8hh   ( t     @ l L@dT(8d<$|   H!!4"X#t### $<$h$$$!$"%#%$d%%%&  *    *f%f%d%d%   *  **"** "**   **`7`7`7`7@ &`7=  ?  @    F EEE4 P(,dD|\ t 4L,d D| \ $$0  T  (=H  4E 86<%"# |P%22L @  1*=='<@@8E,M)U-k< z/ `!8!`#`#*/@ HHu' @8 @xE x^Pn P  4 H 4 l a l r    4 4 T T  7  $L $\a \r   $$$ #$@L @Z # g X  X %i H Hd d\  \ l? l"t 6""X "#m#&~0   ) ) : : O  `  sw| s|   `              $,4 <(D0L8T@\H`PhXXXppxpxpxp xp(000p(080p000HX0HHP@((PH0XP8@@JRPZb`j                 "    "    "    $,0$,0$,0 (04         ,4"<*D0DD \8l@P8X888x8xP     4<@D0\ | | |  8@D(\d$,0$,0$,0$,0     (008(Tl(0(0    |    0(8L8T(p0(8(@0$,0$,0$,0$,0$,0$,0  |    sw|  <DHL PP(080080P8H08 (     sw|    "("8<H Xt| ( ( ||          |           (, H(X t(x 0888H00888H0 (@8  P@HP8 ((((@   @@8H8@8 (((H8 P@H8     (         (    (08@HPX`          8@@0D8\px0@8 8@ 8@  0( 0 $,0$,0  | (48<(\0   sw|    808H@P0lt  (   (0::@  sw| $ <(D0L P8l         sw|  ( D L P8p ( "" # @8 (@8 ( ( 000H08022030H08H08 $,0   sw|      |  ((, D`d0  (   @H8@H8808((08@(((0 31 h8838@TQdt\ 8[ 8g 8u 8< 8t XQ  `L8888 ,8d82 2FF[T[p3p8k8PD @D#8|#8#& %.. .. Guile 3.0.9getenv@guilecurrent-error-port@guileformat@guilestore-file-name?readlink*catch@guiledirname@guilestring-append@guilestring-prefix?@guilepure-file-name?shared-library?string-suffix?@guilestring-contains@guilechar-set@guilechar-set-union@guilestring-drop@guilestring-every@guilelibrary-search-pathlibrary-files-linkedrpath-argumentsfold-right@srfi/srfi-1expand-argumentstokenizeread-delimited@ice-9/rdelimld-wrapper& /gnu/store/fy0b225yfj0935gklyavxw81aak0zzc4-ld-wrapper-0/bin/ldice-9/match.upstream.scmice-9/boot-9.scm~;,a,,,b,,,b,,,b,$,b,aL*!L,,h;*!L,,h;*! L,,f!M,,i<- w, h= Y, f@,x+,* ) L,,f! L,,h~"!wc]w'0~;$=w;Xh-[)w, [1LG,  o;,=, w ,),wh<;i!Z&-7,. .!v,>>x,, wh < ;v = ;u M<, }*=,,w*<,, y6<-,,;h,.x,,v, w~[ !).xY#;7 2 ,=, :.w,$,~, S  ehY.H,$,,$,, b <) *; *'(,,w3<I-43,x%*$,%zK#<[8;wW;,,2w*O;,, y6<-,,;h,.x,,v,.w=<:: h,$, ,gg y,$, ,!,n,O$;w;h=),(,w;x,,w < ;v = ;u M<,#C",i+; 2 t,=m'<,,w4<$#,x(#-"!,R#yhuJ<,i+;\lh>1?,",Kxm!KJ*4+%,$,w;4+%,$,w;4-"yYKxm!K;- %+$,;%+$,;{,>G#%\ "=iw<,i+,j,i+,j,i~,,,k,h ~,,"s88'@84xTEPt8O 8[4 8il 8} 8 XE4 T ` 8 8$8\888& &$:$:@OOX'8_8vHvd\Pl@"8"8#& getenv@guilecurrent-error-port@guileformat@guilestore-file-name?readlink*catch@guiledirname@guilestring-append@guilestring-prefix?@guilepure-file-name?shared-library?string-suffix?@guilestring-contains@guilechar-set@guilechar-set-union@guilestring-drop@guilestring-every@guilelibrary-search-pathlibrary-files-linkedrpath-argumentsfold-right@srfi/srfi-1expand-argumentstokenizeread-delimited@ice-9/rdelimld-wrapperclosureargcachevarproctmp%real-ld%store-directory%temporary-directory%build-directory%allow-impurities?modnamebox%debug?%disable-rpath?moduletagcodevw0readlink*pure-file-name?store-file-name?shared-library?library-search-pathlibrary-files-linkedrpath-argumentsexpand-argumentsld-wrappervalarg0arg1arg2arg3fileunboxeddepthsuccess?targetaresults64argscachedprimtbpathwxpairlibrary-pathargumentinittaillibrary-filesarg4porttokenstokendelimulenrlenia.guile.procprops.rodata.data.rtl-text.guile.frame-maps.dynamic.strtab.symtab.guile.arities.strtab.guile.arities.guile.docstrs.strtab.guile.docstrs.debug_info.debug_abbrev.debug_str.debug_loc.debug_line.shstrtab)))))