RPATH of binary contains a forbidden reference to /build/

I’m getting a weird error when trying to package julia 1.6:

post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/64i3w967hnmjf5m9kfpd9s5hys8dy2gj-julia-1.6.0
shrinking /nix/store/64i3w967hnmjf5m9kfpd9s5hys8dy2gj-julia-1.6.0/bin/julia
shrinking /nix/store/64i3w967hnmjf5m9kfpd9s5hys8dy2gj-julia-1.6.0/lib/libjulia.so.1.6
gzipping man pages under /nix/store/64i3w967hnmjf5m9kfpd9s5hys8dy2gj-julia-1.6.0/share/man/
strip is /nix/store/xdii8qvch5h8chyp0z2is2qzky565w68-binutils-2.35.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/64i3w967hnmjf5m9kfpd9s5hys8dy2gj-julia-1.6.0/lib  /nix/store/64i3w967hnmjf5m9kfpd9s5hys8dy2gj-julia-1.6.0/libexec  /nix/store/64i3w967hnmjf5m9kfpd9s5hys8dy2gj-julia-1.6.0/bin
patching script interpreter paths in /nix/store/64i3w967hnmjf5m9kfpd9s5hys8dy2gj-julia-1.6.0
checking for references to /build/ in /nix/store/64i3w967hnmjf5m9kfpd9s5hys8dy2gj-julia-1.6.0...
RPATH of binary /nix/store/64i3w967hnmjf5m9kfpd9s5hys8dy2gj-julia-1.6.0/lib/julia/libgmpxx.so.4.6.0 contains a forbidden reference to /build/

The last line appears to be the real issue. It looks like it’s coming from nixpkgs/audit-tmpdir.sh at 47d089b4ad34b0e51d27b3ac83b9acee6f6199e5 · NixOS/nixpkgs · GitHub.

My best understanding of what’s going on here is that libgmp is vendored in by julia’s build process, and it’s outputting a binary with a dangerous rpath. Does nixpkgs have a standard way of patching rpath’s in this kind of situation? What are my options here?

Happy to post a WIP PR as well!