diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index 62194c8dd0..79fb571024 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -191,7 +191,12 @@ class Cmd syslibpath end def ldflags - libpath.to_flags('-L') + args = libpath.to_flags('-L') + case mode + when :ld then args << '-headerpad_max_install_names' + when :ccld then args << '-Wl,-headerpad_max_install_names' + end + args end def cppflags sys, opt = cpath diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index 204b636a28..c760902697 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -55,6 +55,8 @@ module Stdenv # Os is the default Apple uses for all its stuff so let's trust them set_cflags "-Os #{SAFE_CFLAGS_FLAGS}" + append 'LDFLAGS', '-Wl,-headerpad_max_install_names' + # set us up for the user's compiler choice self.send self.compiler