On 22.03.2023 14:51, Julien Grall wrote: > I am a bit puzzled with what you wrote. From my understanding, with > -noPIE, the compiler would be free to use absolute address rather than > pc-relative one. Do you have any pointer to documentation that would > back your reasoning?
It might for RV32 (using lui), but for 64-bit the ISA simply doesn't have any halfway efficient means to load addresses in other than a PC-relative manner [1]. -nopie really suppresses the compiler emitting code going through .got (which then indeed would mean using absolute addresses). I understand that at least for now RV32 isn't really of interest; if it were, I guess the concern would be more significant. Jan [1] There aren't even suitable relocations to express such in ELF, because you'd need to have a way to get at the top 32 bits of an address. The only alternative would be .got-like indirection without actually using .got.