aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2016-08-16 13:48:21 +0100
committerMike McQuaid2016-08-16 15:26:28 +0100
commit560918356738ee71aa7e7110d0e8aa6c8b3dbe4f (patch)
tree9f16996cbb2f7f53900e7c74ebda0a79c9e61fe5
parent53d1000739bc29913ab956cff2748428b66f969d (diff)
downloadbrew-560918356738ee71aa7e7110d0e8aa6c8b3dbe4f.tar.bz2
superenv: add LDFLAGS if disabling weak imports.
-rw-r--r--Library/Homebrew/extend/os/mac/extend/ENV/super.rb4
-rwxr-xr-xLibrary/Homebrew/shims/super/cc6
2 files changed, 10 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb
index 1976f5312..e482020e8 100644
--- a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb
@@ -81,6 +81,10 @@ module Superenv
s << "s" if MacOS.version >= :mountain_lion
# Fix issue with >= 10.8 apr-1-config having broken paths
s << "a" if MacOS.version >= :mountain_lion
+ # Xcode 8 should be told to fail to link against weak links
+ # Issue from Apple engineer:
+ # https://github.com/Homebrew/homebrew-core/issues/3727
+ s << "w" if no_weak_imports?
s
end
diff --git a/Library/Homebrew/shims/super/cc b/Library/Homebrew/shims/super/cc
index e7ab6500f..8404e29f2 100755
--- a/Library/Homebrew/shims/super/cc
+++ b/Library/Homebrew/shims/super/cc
@@ -258,8 +258,10 @@ class Cmd
case mode
when :ld
args << "-headerpad_max_install_names"
+ args << "-no_weak_imports" if no_weak_imports?
when :ccld, :cxxld
args << "-Wl,-headerpad_max_install_names"
+ args << "-Wl,-no_weak_imports" if no_weak_imports?
end
args
end
@@ -305,6 +307,10 @@ class Cmd
config.include?("K")
end
+ def no_weak_imports?
+ config.include?("w")
+ end
+
def canonical_path(path)
path = Pathname.new(path)
path = path.realpath if path.exist?