Build failure on macOS 10.15
Russ Allbery
eagle at eyrie.org
Mon Nov 30 19:17:00 UTC 2020
Julien ÉLIE <julien at trigofacile.com> writes:
>> Don't you want something like this?
>> RRA_PROG_CC_FLAG([-fPIE],
>> [CFLAGS="$CFLAGS -fPIE"
>> RRA_PROG_LD_FLAG([-pie], [LDFLAGS="$LDFLAGS -pie"])])
>> I could support checking both at the same time, but I think the above
>> is equivalent for all systems I'm aware of and makes it fairly clear
>> what's going on.
> Couldn't we have linkers that do not know how to link PIE executables?
> The compiler would support PIE but the linker would not, so we would not
> want to have CFLAGS with -fPIE if RRA_PROG_LD_FLAG([-pie]) failed.
> That's why I thought setting both CFLAGS and LDFLAGS at the same time
> would be better to handle that case (which maybe does not exist in
> practice).
Oh, I see, and it's otherwise a bit awkward because you have to write:
RRA_PROG_CC_FLAG([-fPIE],
[save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -fPIE"
RRA_PROG_LD_FLAG([-pie],
[LDFLAGS="$LDFLAGS -pie"],
[CFLAGS=$save_CFLAGS])])
That said, I haven't seen that combination, and I also don't think it's
harmful to have the compiler generate PIE code even if the linker doesn't
create PIE executables. (There's a minor performance penalty, but I'm not
sure it's worth worrying about for this edge case.)
The main reason why I'm reluctant is that I think it makes the macro a bit
hard to understand when it takes both compiler and linker flags. Hm, if
we go that route, I think I'd want to make a third macro called
RRA_PROG_CC_LD_FLAGS to make it explicit and separate from the macros to
probe compiler and linker flags independently.
--
Russ Allbery (eagle at eyrie.org) <https://www.eyrie.org/~eagle/>
Please send questions to the list rather than mailing me directly.
<https://www.eyrie.org/~eagle/faqs/questions.html> explains why.
More information about the inn-workers
mailing list