Always pass -headerpad_max_install_names to the linker

We use install_name_tool pretty liberally, so we need to take steps to
ensure libraries and executables are always linked with this flag.

Closes Homebrew/homebrew#20233.
Fixes Homebrew/homebrew#17984.
Fixes Homebrew/homebrew#22078.
This commit is contained in:
Jack Nagel 2013-08-23 11:36:03 -05:00
parent ebae9ca7bb
commit 84369dd949
2 changed files with 8 additions and 1 deletions

View File

@ -191,7 +191,12 @@ class Cmd
syslibpath syslibpath
end end
def ldflags 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 end
def cppflags def cppflags
sys, opt = cpath sys, opt = cpath

View File

@ -55,6 +55,8 @@ module Stdenv
# Os is the default Apple uses for all its stuff so let's trust them # Os is the default Apple uses for all its stuff so let's trust them
set_cflags "-Os #{SAFE_CFLAGS_FLAGS}" set_cflags "-Os #{SAFE_CFLAGS_FLAGS}"
append 'LDFLAGS', '-Wl,-headerpad_max_install_names'
# set us up for the user's compiler choice # set us up for the user's compiler choice
self.send self.compiler self.send self.compiler