lkml.org 
[lkml]   [2022]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v7 0/5] LoongArch: Support toolchain with new relocation types
From
Date
On Tue, 2022-09-06 at 09:52 +0800, Huacai Chen wrote:
> >   cflags-$(CONFIG_LOONGARCH)     := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \
> > -                                  -fpic
> > +                                  -fpie
> >
> >   cflags-$(CONFIG_EFI_GENERIC_STUB) += -I$(srctree)/scripts/dtc/libfdt
> >
> > (Some explanation: -fpic does not only mean "generate position-
> > independent code", but "generate position-independent code *suitable for
> > use in a shared library*".  On LoongArch -mdirect-extern-access cannot
> > work for a shared library so the "-fpic -mdirect-extern-access"
> > combination is rejected deliberately.)
> >
> > Not sure how to submit these changes properly...  Do you prefer me to
> > send V8 of this series or a single patch on top of your tree on GitHub?

> Don't need V8, I will squash it into the previous patch myself. But
> can we keep efistub as is?

No, we can't allow -mdirect-extern-access -fpic on LoongArch because
without copy relocation such a combination just does not make sense (i.
e. we cannot find a sensible way to handle such a combination in GCC).
So such a combination will cause GCC refuse to run.

Note that -fpic/-fPIC is "position-independent code *suitable for
use in a shared library*", while -fpie/-fPIE is more like just
"position-independent code". The names of those options are confusing.
(When -fpic was invented first time, people mostly believed "PIC had
been only for shared libraries", so it's named -fpic instead of -shlib
or something.) IMO in the EFI stub for other ports, -fpie should be
used instead of -fpic as well because the EFI stub is not similar to a
shared library in any means.

--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

\
 
 \ /
  Last update: 2022-09-06 06:28    [W:0.152 / U:0.680 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site