shims/super/cc: add nostdinc and rpath-link when using glibc@2.13

This commit is contained in:
danielnachun 2022-07-16 18:00:22 -07:00
parent 8dc46a7c47
commit 6ab6382518
No known key found for this signature in database
GPG Key ID: 7343CCAD07E2D0FB

View File

@ -292,6 +292,8 @@ class Cmd
args.concat(optflags) unless runtime_cpu_detection? args.concat(optflags) unless runtime_cpu_detection?
args.concat(archflags) args.concat(archflags)
args << "-std=#{@arg0}" if /c[89]9/.match?(@arg0) args << "-std=#{@arg0}" if /c[89]9/.match?(@arg0)
# Add -nostdinc when building against glibc@2.13 to avoid mixing system and brewed glibc headers.
args << "-nostdinc" if @deps.include?("glibc@2.13")
args args
end end
@ -326,6 +328,9 @@ 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 glibc@2.13 rather than the system glibc for indirect
# dependencies because -L will only handle direct dependencies.
args << "#{wl}-rpath-link=#{@opt}/glibc@2.13/lib" if @deps.include?("glibc@2.13")
args args
end end