[PATCH 1/3] firmware: Support position independent execution

Vincent Chen vincent.chen at sifive.com
Thu Mar 4 05:54:28 GMT 2021


On Thu, Mar 4, 2021 at 2:22 AM Jessica Clarke <jrtc27 at jrtc27.com> wrote:
>
> On 2 Mar 2021, at 15:25, Vincent Chen <vincent.chen at sifive.com> wrote:
> >
> > Enable OpenSBI to support position independent execution. Because the
> > position independent code will cause an additional GOT reference when
> > accessing the global variables, it will reduce performance a bit. Therefore,
> > the position independent execution is disabled by default. Users can
> > through specifying "FW_PIC=y" on the make command to enable this feature.
> >
> > In theory, after enabling position-independent execution, the OpenSBI
> > can run at arbitrary address with appropriate alignment. Therefore, the
> > original relocation mechanism will be skipped. In other words, OpenSBI will
> > directly run at the load address without any code movement.
> >
> > Signed-off-by: Vincent Chen <vincent.chen at sifive.com>
> > ---
> > index ab33e11..8f8e5dc 100644
> > --- a/firmware/fw_base.S
> > +++ b/firmware/fw_base.S
> > +#ifdef FW_PIC
> > +     .option pic
> > +#endif
>
> This should be implied if you use the right flags when assembling.
>
> Jess

You are right. The ".option pic" directive is unneeded if I add
"-fpic" option to the ASFLAGS.
 I will modify it in my next version patch. Thank you very much for
this suggestion.



More information about the opensbi mailing list