[U-Boot] [BUG] qemu-x86_defconfig does not build with GCC 8.1

Debian Buster has upgraded gcc to version 8.1.
With gcc 8.1 I get an error when trying to build qemu-x86_defconfig
{standard input}: Assembler messages: {standard input}:7465: Error: junk at end of line, first unrecognized character is `@'
The problematic line in the generated assembler code is
.long end.6133@gotoff-start.6130@gotoff
This difference relates to the length of a linker generated list and is only needed for debugging. It is not generated when compiling without option -g.
Compilation on x86 works fine with gcc 7.3. gcc 7.3 simply does not generate the line at all.
To generate the complete assembler code use gcc with options -S -fverbose-asm.
Best regards
Heinrich
gcc -Wp,-MD,common/.command.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/8/include -Iinclude -I./arch/x86/include -include ./include/linux/kconfig.h -D__KERNEL__ -D__UBOOT__ -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -Os -fno-stack-protector -fno-delete-null-pointer-checks -fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral -Werror=date-time -fno-strict-aliasing -fomit-frame-pointer -fno-toplevel-reorder -fno-dwarf2-cfi-asm -march=i386 -m32 -mregparm=3 -D__I386__ -ffunction-sections -fvisibility=hidden -pipe -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(command)" -D"KBUILD_MODNAME=KBUILD_STR(command)" -c -o common/command.o common/command.c {standard input}: Assembler messages: {standard input}:7465: Error: junk at end of line, first unrecognized character is `@' {standard input}:10573: Error: junk at end of line, first unrecognized character is `@' {standard input}:10587: Error: junk at end of line, first unrecognized character is `@' {standard input}:7465: Error: can't resolve `end.6133' {.u_boot_list_2_cmd_3 section} - `start.6130' {.u_boot_list_2_cmd_1 section} {standard input}:10573: Error: can't resolve `end.6164' {.u_boot_list_2_cmd_3 section} - `start.6161' {.u_boot_list_2_cmd_1 section} {standard input}:10587: Error: can't resolve `end.6164' {.u_boot_list_2_cmd_3 section} - `start.6161' {.u_boot_list_2_cmd_1 section}

Hi Heinrich,
On Sat, Jul 28, 2018 at 11:42 PM, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Debian Buster has upgraded gcc to version 8.1.
Do you know any pre-built gcc 8.1 that can be used on other distributions than Debian Buster, so that I can take a look? I am currently on Ubuntu 16.04.
With gcc 8.1 I get an error when trying to build qemu-x86_defconfig
{standard input}: Assembler messages: {standard input}:7465: Error: junk at end of line, first unrecognized character is `@'
The problematic line in the generated assembler code is
.long end.6133@gotoff-start.6130@gotoff
This difference relates to the length of a linker generated list and is only needed for debugging. It is not generated when compiling without option -g.
Without '-g', does gcc 8.1 build?
Compilation on x86 works fine with gcc 7.3. gcc 7.3 simply does not generate the line at all.
Does gcc 8.1 on Debin Buster come with multilib support? I vaguely remember old version did not which would cause build error.
To generate the complete assembler code use gcc with options -S -fverbose-asm.
Regards, Bin

On 07/29/2018 02:40 AM, Bin Meng wrote:
Hi Heinrich,
On Sat, Jul 28, 2018 at 11:42 PM, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Debian Buster has upgraded gcc to version 8.1.
Do you know any pre-built gcc 8.1 that can be used on other distributions than Debian Buster, so that I can take a look? I am currently on Ubuntu 16.04.
Ubuntu Cosmic has gcc 8.2. Setting up a virtual machine with virt-manager is quite easy.
With gcc 8.1 I get an error when trying to build qemu-x86_defconfig
{standard input}: Assembler messages: {standard input}:7465: Error: junk at end of line, first unrecognized character is `@'
The problematic line in the generated assembler code is
.long end.6133@gotoff-start.6130@gotoff
This difference relates to the length of a linker generated list and is only needed for debugging. It is not generated when compiling without option -g.
Without '-g', does gcc 8.1 build?
Yes, if I remove the lines setting -g in /Makefile I have no build problem.
Compilation on x86 works fine with gcc 7.3. gcc 7.3 simply does not generate the line at all.
Does gcc 8.1 on Debin Buster come with multilib support? I vaguely remember old version did not which would cause build error.
There is also a gcc-multilib package with version 8.1 in Debian Buster.
Best regards
Heinrich
To generate the complete assembler code use gcc with options -S -fverbose-asm.
Regards, Bin

On Sun, Jul 29, 2018 at 3:09 PM, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
On 07/29/2018 02:40 AM, Bin Meng wrote:
Ubuntu Cosmic has gcc 8.2. Setting up a virtual machine with virt-manager is quite easy.
Can you check if output of `gcc -v` has --enable-default-pie? If so (I bet it is the case), can you try the following patch (sorry, it's mangled, needs manual apply)
--- a/Makefile +++ b/Makefile @@ -371,6 +371,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ -Wno-format-security \ + -fno-pie \ -fno-builtin -ffreestanding $(CSTD_FLAG) KBUILD_CFLAGS += -fshort-wchar KBUILD_AFLAGS := -D__ASSEMBLY__
P.S. I have no time right now to test this myself though.

On 08/06/2018 05:13 PM, Andy Shevchenko wrote:
On Sun, Jul 29, 2018 at 3:09 PM, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
On 07/29/2018 02:40 AM, Bin Meng wrote:
Ubuntu Cosmic has gcc 8.2. Setting up a virtual machine with virt-manager is quite easy.
Can you check if output of `gcc -v` has --enable-default-pie?
The flag is enabled both for gcc-7 and gcc-8 in Debian Buster.
If so (I bet it is the case), can you try the following patch (sorry, it's mangled, needs manual apply)
--- a/Makefile +++ b/Makefile @@ -371,6 +371,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ -Wno-format-security \
-fno-pie \ -fno-builtin -ffreestanding $(CSTD_FLAG)
KBUILD_CFLAGS += -fshort-wchar KBUILD_AFLAGS := -D__ASSEMBLY__
P.S. I have no time right now to test this myself though.
With the flag building with gcc-8.1 works. But the interesting question is whether the EFI subsystem will be able to relocate the runtime code when the EFI sercice SetVirtualAddressMap is called.
Best regards
Heinrich
participants (3)
-
Andy Shevchenko
-
Bin Meng
-
Heinrich Schuchardt