shims/super/cc: add -nostdinc in cppflags

This commit is contained in:
danielnachun 2022-07-20 11:08:43 -07:00
parent 8a2efb1df6
commit 7a247fd52d
No known key found for this signature in database
GPG Key ID: 7343CCAD07E2D0FB

View File

@ -292,8 +292,6 @@ 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
@ -306,7 +304,11 @@ class Cmd
end end
def cppflags def cppflags
path_flags("-isystem", isystem_paths) + path_flags("-I", include_paths) args = []
args += path_flags("-isystem", isystem_paths) + path_flags("-I", include_paths)
# 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
end end
def ldflags_mac(args) def ldflags_mac(args)
@ -324,8 +326,12 @@ class Cmd
def ldflags_linux(args) def ldflags_linux(args)
unless mode == :ld unless mode == :ld
wl = "-Wl," wl = "-Wl,"
if @deps.include?("glibc@2.13")
args << "-B#{@opt}/glibc@2.13/lib"
else
args << "-B#{@opt}/glibc/lib" args << "-B#{@opt}/glibc/lib"
end 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 # Use -rpath-link to make sure linker uses glibc@2.13 rather than the system glibc for indirect