This was suggested on several occasions, notably
<https://bugs.gnu.org/24544>.
* gnu/packages/ld-wrapper.in (%allow-impurities?): Default to #t and
parse the value of 'GUIX_LD_WRAPPER_ALLOW_IMPURITIES'.
* guix/build/gnu-build-system.scm (set-paths): Set
'GUIX_LD_WRAPPER_ALLOW_IMPURITIES'.
Fixes <http://bugs.gnu.org/25882>.
Reported by Federico Beffa <beffa@fbengineering.ch>.
* gnu/packages/ld-wrapper.in (expand-arguments): New procedure.
(ld-wrapper): Use it.
Fixes <http://bugs.gnu.org/21941>.
* gnu/packages/ld-wrapper.in (library-search-path): New procedure.
(library-files-linked): Add 'library-path' parameter. Use it. Do not
thread it in 'fold'.
(ld-wrapper): Add call to 'library-search-path' and pass the result to
'library-files-linked'. When debugging, print the value of PATH.
Reported at <http://bugs.gnu.org/20102>.
* 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".