https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119386

--- Comment #41 from Ard Biesheuvel <ardb at kernel dot org> ---
(In reply to Alexander Monakov from comment #40)
> > In Linux, we don't even bother with PIC codegen, even though we link with 
> > -pie.
> 
> Earlier you said that building with -fPIC may be desirable, and your patch
> was dealing with PIC codegen in GCC for mcount.

... on x86_64, where PIC and non-PIC codegen are radically different, and
non-PIC codegen for the kernel is different again from non-PIC codegen for user
space.

> To me, there's now a contradiction.

No there is not. I was referring to arm64 before, where non-PIC codegen is
actually better for us than PIC codegen, because it omits all the GOT stuff and
other things that are only relevant to shared libraries in user space (symbol
preemption, reducing the CoW footprint of writable segments, etc)

In summary, we just need what you refer to as -fstatic-pie, and the main
difference here is that on arm64, the non-PIC small code model is already 99%
compatible with that.

Reply via email to