Iain Sandoe <i...@sandoe.co.uk> writes: > Hi Richard, >> Maybe it would be easier to have the makefile fragments determine >> something like CODE_MODEL_CFLAGS, which can be "-fPIC", "-mdynamic-no-pic", >> etc., and use: >> >> COMPILER += $(NO_PIE_CFLAGS) $(CODE_MODEL_CFLAGS) > > OK. I have misgivings about this - the problem is that: > > -fPIC -fno-PIE != -fno-PIE -fPIC, which is not obvious to many folks - who > expect that > the “last edition of a flag will be the one in force”. > > So the PIE-ness and the PIC-ness are decoupled in the configury but they need > to be > ordered specifically for targets that want PIC code by default (FWIW, I don’t > think Darwin > is the only default-PIC case here, from discussions on irc).
Yeah, that's what the above was supposed to achieve. In other words, if you force non-PIE, you also need to follow that by $(CODE_MODEL_CFLAGS), which restates whatever the base code model is. If it's the decoupling you're worried about, then an alternative would be to have: NO_PIE_CFLAGS="-fno-PIE \$(CODE_MODEL_CFLAGS)" I was going to suggest that originally, but thought the above might be simpler to follow later. Thanks, Richard