Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Make -Wl,-headerpad_max_install_names a default compiler flag #20233

Closed
jacknagel opened this issue Jun 3, 2013 · 6 comments
Closed

Make -Wl,-headerpad_max_install_names a default compiler flag #20233

jacknagel opened this issue Jun 3, 2013 · 6 comments
Labels

Comments

@jacknagel
Copy link
Contributor

Since we use install_name_tool liberally, we should be using this flag by default. This would resolve some issues that happen from time to time (we may seem similar issues when we start bottling more stuff).

It's trivial to add it to stdenv, but to add it to superenv we need to be able to use -Wl,-headerpad_max_install_names when the cc wrapper is invoked in :cc and :ccld mode and just -headerpad_max_install_names when invoked in :ld mode.

@MikeMcQuaid
Copy link
Member

Good idea/points.

@cooljeanius
Copy link

For reference, MacPorts started doing this in trunk as of their r104258

@samueljohn
Copy link
Contributor

+1

@jacknagel
Copy link
Contributor Author

Okay, I tried adding this to superenv: https://github.com/jacknagel/homebrew/compare/headerpad

I don't like the conditional and I'm not confident that it won't break, but the idea is that when the wrapper is in :ld mode, we omit the leading -Wl, (which would make the linker choke).

I see that I stated earlier that it would be "trivial" to add to stdenv, but of course I don't remember why. Perhaps we can just add -Wl,-headerpad_max_install_names to CFLAGS and -headerpad_max_install_names to LDFLAGS.

/cc @adamv @mistydemeo

@jacknagel
Copy link
Contributor Author

Okay, both gentoo and macports treat LDFLAGS as suitable for passing to cc rather than directly to ld, so going with that in stdenv for now.

@mistydemeo
Copy link
Member

Sounds good to me. From what I can see this is supported back to 10.4 (though at least at one point it was 32-bit only), so no compatibility issues to worry about.

handyman5 pushed a commit to handyman5/homebrew that referenced this issue Oct 7, 2013
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#20233.
Fixes Homebrew#17984.
Fixes Homebrew#22078.
@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants