-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eac5720
commit 2b8b778
Showing
3 changed files
with
25 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,15 +45,29 @@ def homebrew_extra_paths | |
|
||
def homebrew_extra_isystem_paths | ||
paths = [] | ||
# Add paths for GCC headers when building against [email protected] because we have to use -nostdinc. | ||
if deps.any? { |d| d.name == "[email protected]" } | ||
# Add paths for GCC headers when building against [email protected] or [email protected] | ||
# because we have to use -nostdinc. | ||
if deps.any? { |d| d.name == "[email protected]" || d.name == "[email protected]" } | ||
gcc_include_dir = Utils.safe_popen_read(cc, "--print-file-name=include").chomp | ||
gcc_include_fixed_dir = Utils.safe_popen_read(cc, "--print-file-name=include-fixed").chomp | ||
paths << gcc_include_dir << gcc_include_fixed_dir | ||
end | ||
paths | ||
end | ||
|
||
sig { returns(String) } | ||
def determine_optflags | ||
if effective_arch == :armv8 && | ||
compiler.match?(GNU_GCC_REGEXP) && | ||
DevelopmentTools.gcc_version(compiler.to_s) >= "9.3.1" | ||
# Out-of-line atomics are not supported out-of-the-box on all systems. | ||
# https://learn.arm.com/learning-paths/servers-and-cloud-computing/lse/intro/ | ||
"#{generic_determine_optflags} -mno-outline-atomics" | ||
else | ||
generic_determine_optflags | ||
end | ||
end | ||
|
||
def determine_rpath_paths(formula) | ||
PATH.new( | ||
*formula&.lib, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -313,8 +313,9 @@ class Cmd | |
def cppflags | ||
args = [] | ||
args += path_flags("-isystem", isystem_paths) + path_flags("-I", include_paths) | ||
# Add -nostdinc when building against [email protected] to avoid mixing system and brewed glibc headers. | ||
args << "-nostdinc" if @deps.include?("[email protected]") | ||
# Add -nostdinc when building against [email protected] or [email protected] to avoid | ||
# mixing system and brewed glibc headers. | ||
args << "-nostdinc" if (@deps & ["[email protected]", "[email protected]"]).any? | ||
# Ideally this would be -ffile-prefix-map, but that requires a minimum of GCC 8, LLVM Clang 10 or Apple Clang 12 | ||
# and detecting the version dynamically based on what `HOMEBREW_CC` may have been rewritten to point to is awkward | ||
args << "-fdebug-prefix-map=#{formula_buildpath}=." if formula_buildpath && !debug_symbols? | ||
|
@@ -340,19 +341,20 @@ class Cmd | |
end | ||
|
||
def ldflags_linux(args) | ||
versioned_glibc_dep = (@deps & ["[email protected]", "[email protected]"]).first | ||
unless mode == :ld | ||
wl = "-Wl," | ||
if @deps.include?("[email protected]") | ||
args << "-B#{@opt}/[email protected]/lib" | ||
if versioned_glibc_dep | ||
args << "-B#{@opt}/#{versioned_glibc_dep}/lib" | ||
else | ||
args << "-B#{@opt}/glibc/lib" | ||
end | ||
end | ||
args += rpath_flags("#{wl}-rpath=", rpath_paths) | ||
args += ["#{wl}--dynamic-linker=#{dynamic_linker_path}"] if dynamic_linker_path | ||
# Use -rpath-link to make sure linker uses [email protected] rather than the system glibc for indirect | ||
# Use -rpath-link to make sure linker uses [email protected] or [email protected] rather than the system glibc for indirect | ||
# dependencies because -L will only handle direct dependencies. | ||
args << "#{wl}-rpath-link=#{@opt}/[email protected]/lib" if @deps.include?("[email protected]") | ||
args << "#{wl}-rpath-link=#{@opt}/#{versioned_glibc_dep}/lib" if versioned_glibc_dep | ||
args | ||
end | ||
|
||
|