This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [DARWIN]: Add -mdynamic-no-pic to Darwin-specific options
Robert Bowdidge <bowdidge@apple.com> writes:
> On Aug 16, 2004, at 4:35 PM, Zack Weinberg wrote:
>
>> Based on your description, it seems to me that this flag ought to be
>> on for all executables - in other words, it should be on unless -fpic
>> or -fPIC has been specified. Why is this not done?
>
> The convention on Mac OS X and Darwin is that you don't need to add any
> special options to permit an object file to be used in a shared library
> -- -fPIC is always on. The NeXT folks probably made this choice in the
> mid 1990's because position-independent-code is required (not merely an
> optimization) for shared libraries, so not requiring the flag made life
> easier for developers. These days, we could (in theory) change the
> convention... but that would require changes to our developer tools,
> getting external developers to change their Makefiles, etc.
I ... see ...
> The key detail for this checkin is that this fix gives a non-trivial
> compile time improvement for Darwin. We can talk about changing Mac OS
> X conventions (and in fact Mike Stump wishes Darwin and Mac OS X
> behaved like other OSs in this regard), but that's a bigger issue for
> us to discuss with management. For now, this os-specific patch gives a
> non-trivial performance improvement and correctly matches the OS
> behavior, and for those reasons alone deserves to be accepted.
Yes. The patch is OK. I just wanted to make sure there was a good
reason why it wasn't on by default.
zw