shims/super/cc: rpath-link glibc if indirect dep

This helps ld.bfd find the correct `glibc` dependency. Needed when using
host toolchain which will only search for /etc/ld.so.conf.

Also can help unsupported systems that force poured non-relocatable
`binutils` bottle.
This commit is contained in:
Michael Cho 2025-09-03 20:21:59 -04:00
parent 1c959c22ce
commit 5fb96d9d8a
No known key found for this signature in database
GPG Key ID: 55E85E28A7CD1E85

View File

@ -369,9 +369,13 @@ class Cmd
end end
args += rpath_flags("#{wl}-rpath=", rpath_paths) args += rpath_flags("#{wl}-rpath=", rpath_paths)
args += ["#{wl}--dynamic-linker=#{dynamic_linker_path}"] if dynamic_linker_path args += ["#{wl}--dynamic-linker=#{dynamic_linker_path}"] if dynamic_linker_path
# Use -rpath-link to make sure linker uses versioned glibc rather than the system glibc for indirect # Use -rpath-link to make sure linker uses brew glibc rather than the system glibc for indirect
# dependencies because -L will only handle direct dependencies. # dependencies because -L will only handle direct dependencies.
args << "#{wl}-rpath-link=#{@opt}/#{versioned_glibc_dep}/lib" if versioned_glibc_dep if versioned_glibc_dep
args << "#{wl}-rpath-link=#{@opt}/#{versioned_glibc_dep}/lib"
else
args << "#{wl}-rpath-link=#{@opt}/glibc/lib"
end
args args
end end