[PATCH] efi_loader: Enable run-time variable support for tee based variables
Ilias Apalodimas
ilias.apalodimas at linaro.org
Fri Jan 15 18:42:30 CET 2021
Hi Andreas,
On Fri, Jan 15, 2021 at 05:34:04PM +0100, Andreas Schwab wrote:
> On Jan 14 2021, Atish Patra wrote:
>
> > I am a bit confused how this will work. This means it will reside in GOT
> > which is not mapped in virtual address for Linux. Whenever we try to
> > invoke get_variable service, it will panic.
> > Did we miss a trick in RISC-V ?
>
> I think the problem really is that RISC-V use -fpic for compiling. If I
> change that to -fpie, there is no longer a GOT reference.
The -fpic explains why the GOT is there to begin with, as you say. Keep in mind it's
present in Arm as well. What I am trying to explain in the mail is that regardless
of the -fpic, Arm gets rid of all GOT indirections. The section is actually
empty and they all turn into relative references. That's why that works fine
on Arm.
The reason for that (I think, if I am wrong somebody shout please), is that you only
need a GOT in shared libraries for symbol pre-emption. So if both the library
and the executable define a global 'bar', the lib is supposed to switch the
references to the executable exposed symbol.
So on Arm the linker observes that's not the case, and uses relative
references, while it gets rid of the GOT section entries (again shout if I am wrong :)).
Anyway removing -fpic should work as well, but I'd rather do this [1],
instead of relying on linker flags.
[1] https://lists.denx.de/pipermail/u-boot/2021-January/437478.html
Cheers
/Ilias
>
> Andreas.
>
> --
> Andreas Schwab, SUSE Labs, schwab at suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
More information about the U-Boot
mailing list