From 53d1000739bc29913ab956cff2748428b66f969d Mon Sep 17 00:00:00 2001
From: Mike McQuaid <mike@mikemcquaid.com>
Date: Tue, 16 Aug 2016 13:48:08 +0100
Subject: [PATCH] ENV/std: add LDFLAGS if disabling weak imports.

---
 Library/Homebrew/extend/os/mac/extend/ENV/std.rb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb
index 817b4a0ff7..d9cabc50e4 100644
--- a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb
+++ b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb
@@ -28,6 +28,11 @@ module Stdenv
       # depend on it already being installed to build itself.
       ld64 if Formula["ld64"].installed?
     end
+
+    # Xcode 8 should be told to fail to link against weak links
+    # Issue from Apple engineer:
+    # https://github.com/Homebrew/homebrew-core/issues/3727
+    append "LDFLAGS", "-Wl,-no_weak_imports" if no_weak_imports?
   end
 
   def homebrew_extra_pkg_config_paths
-- 
GitLab