[PATCH] firmware: Detect whether the toolchain supports pie and automatically disable the FW_PIC option

Xiang W wxjstz at 126.com
Sat Jul 10 12:11:31 PDT 2021


在 2021-07-10星期六的 19:24 +0100,Jessica Clarke写道:
> On 10 Jul 2021, at 19:21, Xiang W <wxjstz at 126.com> wrote:
> > 
> > Signed-off-by: Xiang W <wxjstz at 126.com>
> > ---
> > firmware/objects.mk | 4 ++++
> > 1 file changed, 4 insertions(+)
> > 
> > diff --git a/firmware/objects.mk b/firmware/objects.mk
> > index ce91c2f..96a8d7d 100644
> > --- a/firmware/objects.mk
> > +++ b/firmware/objects.mk
> > @@ -17,6 +17,10 @@ ifndef FW_PIC
> > FW_PIC := y
> > endif
> > 
> > +ifeq ($(FW_PIC),y)
> > +FW_PIC := $(shell $(CC) -nostdlib -fPIE -Wl,-pie /dev/null  -o
> > /dev/null 2>/dev/null && echo y || echo n)
> > +endif
> 
> /dev/null is not a valid object. This always gives n.

Yes, you are right. We still need a simple test file. This can run just
by luck. The command I actually ran did have an error output, but the
return value was exactly 0.

/usr/lib/gcc-cross/riscv64-linux-gnu/10/../../../../riscv64-linux-
gnu/bin/ld: warning: cannot find entry symbol _start; not setting start
address
> 
> Jess





More information about the opensbi mailing list