From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heinrich Schuchardt Date: Mon, 6 Aug 2018 18:56:23 +0200 Subject: [U-Boot] [PATCH v1] Makefile: Don't generate position independent code In-Reply-To: <20180806160022.43698-1-andriy.shevchenko@linux.intel.com> References: <20180806160022.43698-1-andriy.shevchenko@linux.intel.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 08/06/2018 06:00 PM, Andy Shevchenko wrote: > Since gcc-8 the --enabled-default-pie starts producing code which assembler > can't translate in case of U-Boot. The build fails with > > {standard input}: Assembler messages: > {standard input}:21100: Error: junk at end of line, first unrecognized character is `@' > {standard input}:21120: Error: junk at end of line, first unrecognized character is `@' > > and so on. > > This is usually the case for x86 platform because in many cases it uses host > compiler from the Linux distributions, where PIE is enabled by default. > Previously (gcc-7 and earlier) that was a potential issue due to absence of > constructions like > > .long end.5561 at gotoff-start.5558@gotoff > > which are a cause of above error messages in gcc-8. > > Fix all these by disabling PIE on Makefile level. > > Reported-by: Heinrich Schuchardt > Suggested-by: Mika Westerberg > Signed-off-by: Andy Shevchenko > --- > Makefile | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/Makefile b/Makefile > index 884b7d943c..e2310f3552 100644 > --- a/Makefile > +++ b/Makefile > @@ -375,6 +375,10 @@ KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ > KBUILD_CFLAGS += -fshort-wchar > KBUILD_AFLAGS := -D__ASSEMBLY__ > > +# Don't generate position independent code > +KBUILD_CFLAGS += $(call cc-option,-fno-PIE) > +KBUILD_AFLAGS += $(call cc-option,-fno-PIE) > + > # Read UBOOTRELEASE from include/config/uboot.release (if it exists) > UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null) > UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) > With the patch building with gcc-8.1 works on i386. But the interesting question is whether the EFI subsystem will be able to relocate the runtime code when the EFI service SetVirtualAddressMap() is called. Did you boot Linux with the patch via bootefi and call any of the EFI runtime services from Linux? As you are changing this for all architectures this needs to be tested on all (ARM, RISC-V, and x86) architectures supporting the EFI subsystem. Best regards Heinrich