http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49371
--- Comment #13 from Iain Sandoe <iains at gcc dot gnu.org> 2011-06-12 13:00:49
UTC ---
(In reply to comment #12)
> The reason for the error is that no spec matches the option. For most
> targets, the option is matched in LINK_PIE_SPEC (only), which is part of
> LINK_COMMAND_SPEC; Darwin uses its own LINK_COMMAND_SPEC (as does DJGPP).
> I would advise making Darwin behave similarly to other targets by
> including an appropriate spec for this option in Darwin's
> LINK_COMMAND_SPEC.
that's what the attached patch @comment #10 does.
there are some potential refinements;
(a) the warning message from cc1 is a bit non-helpful when mdynamic-no-pic is
combined with pie - since it refers to fpic/fPIC which the user did not
actually supply (although she did imply it).,
(b) something like
#undef PIE_SPEC
#define PIE_SPEC \
"%{fpie|pie|fPIE: \
%{mdynamic-no-pic: %n'-mdynamic-no-pic' overides '-pie', '-fpie' or
'-fPIE'; \
:-pie}}"
would avoid the linker error when the combination is given - since the pic is
already overridden, at least it would be consistent.