Bug 1860937

Summary: failures when building kernel on rhel-8.3 s390x with gcc-toolset-10
Product: Red Hat Enterprise Linux 8 Reporter: Edjunior Barbosa Machado <emachado>
Component: gcc-toolset-10Assignee: Marek Polacek <mpolacek>
Status: CLOSED NOTABUG QA Contact: qe-baseos-tools-bugs
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.3CC: nickc, tschelle
Target Milestone: rc   
Target Release: 8.0   
Hardware: s390x   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-27 20:56:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
full rpmbuild output on s390x none

Description Edjunior Barbosa Machado 2020-07-27 13:59:38 UTC
Created attachment 1702540 [details]
full rpmbuild output on s390x

Description of problem:
rpmbuild kernel-4.18.0-221.el8.src.rpm on s390x fails with the following errors:

(...)
+ make 'HOSTCFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection' 'HOSTLDFLAGS=-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' -s ARCH=s390 oldnoconfig
+ make 'HOSTCFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection' 'HOSTLDFLAGS=-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' -s ARCH=s390 V=1 -j2 KCFLAGS= WITH_GCOV=0 bzImage
./arch/s390/include/asm/jump_label.h: Assembler messages:
./arch/s390/include/asm/jump_label.h:22: Error: junk at end of line, first unrecognized character is `('
make[2]: *** [scripts/Makefile.build:315: init/main.o] Error 1
make[1]: *** [Makefile:1072: init] Error 2
make[1]: *** Waiting for unfinished jobs....
In file included from ././include/linux/compiler_types.h:58,
                 from <command-line>:
arch/s390/pci/pci.c: In function 'pci_iounmap':
./include/linux/compiler-gcc.h:305:38: error: invalid 'asm': invalid expression - try using an output modifier
  305 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
      |                                      ^~~
./arch/s390/include/asm/jump_label.h:33:2: note: in expansion of macro 'asm_volatile_goto'
   33 |  asm_volatile_goto("0: brcl 15, %l[label]\n"
      |  ^~~~~~~~~~~~~~~~~
./include/linux/compiler-gcc.h:305:38: error: invalid 'asm': invalid expression - try using an output modifier
  305 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
      |                                      ^~~
./arch/s390/include/asm/jump_label.h:33:2: note: in expansion of macro 'asm_volatile_goto'
   33 |  asm_volatile_goto("0: brcl 15, %l[label]\n"
      |  ^~~~~~~~~~~~~~~~~
./arch/s390/include/asm/jump_label.h: Assembler messages:
./arch/s390/include/asm/jump_label.h:36: Warning: zero assumed for missing expression
./arch/s390/include/asm/jump_label.h:36: Warning: zero assumed for missing expression
make[3]: *** [scripts/Makefile.build:315: arch/s390/pci/pci.o] Error 1
make[2]: *** [scripts/Makefile.build:556: arch/s390/pci] Error 2
make[2]: *** Waiting for unfinished jobs....
arch/s390/kernel/ftrace.c: In function 'prepare_ftrace_return':
arch/s390/kernel/ftrace.c:188:43: error: taking address of packed member of 'struct ftrace_graph_ent' may result in an unaligned pointer value [-Werror=address-of-packed-member]
  188 |  if (ftrace_push_return_trace(parent, ip, &trace.depth, 0,
      |                                           ^~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:315: arch/s390/kernel/ftrace.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:556: arch/s390/kernel] Error 2
make[1]: *** [Makefile:1072: arch/s390] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.7fn2LE (%build)


Version-Release number of selected component (if applicable):
gcc-toolset-10-binutils-2.35-3.el8.s390x
gcc-toolset-10-gcc-10.1.1-1.1.el8.s390x
RHEL-8.3.0-20200701.2


Steps to Reproduce:
1. rpm -ivh kernel-4.18.0-221.el8.src.rpm
2. yum-builddep -y --nobest rpmbuild/SPECS/kernel.spec
3. CC=/opt/rh/gcc-toolset-10/root/usr/bin/gcc rpmbuild -bb --target=s390x --clean rpmbuild/SPECS/kernel.spec

Comment 3 Edjunior Barbosa Machado 2020-07-27 14:04:02 UTC
FWIW, an error similar to "taking address of packed member of 'struct ftrace_graph_ent' may result in an unaligned pointer value" was also seen when building rhel-8.3 kernel on x86_64 (bug #1860933).

Comment 4 Edjunior Barbosa Machado 2020-07-27 14:28:14 UTC
(In reply to Edjunior Barbosa Machado from comment #0)
> Steps to Reproduce:
> 1. rpm -ivh kernel-4.18.0-221.el8.src.rpm
> 2. yum-builddep -y --nobest rpmbuild/SPECS/kernel.spec
> 3. CC=/opt/rh/gcc-toolset-10/root/usr/bin/gcc rpmbuild -bb --target=s390x
> --clean rpmbuild/SPECS/kernel.spec

Forgot to mention that you should have gcc-toolset-10 enabled beforehand with:

# scl enable gcc-toolset-10 bash

Comment 5 Marek Polacek 2020-07-27 20:56:39 UTC
error: taking address of packed member of... is a kernel bug as in bug #1860933.

./arch/s390/include/asm/jump_label.h:22: Error: junk at end of line, first unrecognized character is `('
didn't work with GCC 9, either.  I believe we'd need this kernel patch to fix it:

commit 146448524bddbf6dfc62de31957e428de001cbda
Author: Ilya Leoshkevich <iii.com>
Date:   Wed Feb 6 12:35:58 2019 +0100

    s390/jump_label: Use "jdd" constraint on gcc9
    
    [heiko.carstens.com]:
    -----
    Laura Abbott reported that the kernel doesn't build anymore with gcc 9,
    due to the "X" constraint. Ilya provided the gcc 9 patch "S/390:
    Introduce jdd constraint" which introduces the new "jdd" constraint
    which fixes this.
    -----
    
    The support for section anchors on S/390 introduced in gcc9 has changed
    the behavior of "X" constraint, which can now produce register
    references. Since existing constraints, in particular, "i", do not fit
    the intended use case on S/390, the new machine-specific "jdd"
    constraint was introduced. This patch makes jump labels use "jdd"
    constraint when building with gcc9.
    
    Reported-by: Laura Abbott <labbott>
    Signed-off-by: Ilya Leoshkevich <iii.com>
    Signed-off-by: Heiko Carstens <heiko.carstens.com>
    Signed-off-by: Martin Schwidefsky <schwidefsky.com>

Not a gcc bug though.