On 14.03.2023 17:00, Oleksii Kurochko wrote: > The patch is needed to keep all addresses PC-relative. > > Pseudoinstruction 'la' can be transformed to 'auipc/addi' or > 'auipc/l{w|d}'. It depends on the .option directive: nopic and pic. > > Right now, 'la' transforms to 'auipc/l{w|d}',
I'm afraid I cannot confirm this. Is it possible that your and my gas are configured differently (i.e. can the default of nopic vs pic vary)? > which in case of > cpu0_boot_stack[] will lead to the usage of _GLOBAL_OFFSET_TABLE_ > where all addresses will be without counting that it might happen > that linker address != load address. > > To be sure that SP is loaded always PC-relative address > 'la' should be changed to 'lla', which always transforms to > 'auipc/addi'. While I agree with the adjustment in principle, I'd like to raise the question of the suitablity of such macro insns for purposes like the one here. In principle I would assume it would be better if sp was written only once, with the final value. That would then also remove the dependency on a possibly differing default gas may be using. Jan