ibm-s390-linux / s390-tools

Tools for use with the s390 Linux kernel and device drivers
MIT License
63 stars 59 forks source link

genprotimg/boot fails to compile and doesn't abort build #86

Closed vapier closed 3 years ago

vapier commented 4 years ago

the new genprotimg doesn't compile with recent tools, and when it fails, it doesn't correctly abort the build.

$ gcc --version
gcc (Gentoo 9.3.0 p2) 9.3.0
$ as --version
GNU assembler (Gentoo 2.33.1 p2) 2.33.1

snippet:

make[2]: Entering directory '/var/tmp/portage/sys-apps/s390-tools-2.13.0/work/s390-tools-2.13.0/genprotimg/boot'
s390x-ibm-linux-gnu-gcc -fno-pie -Os -g -I../..//zipl/boot -I../..//zipl/include -I../..//include -DENABLE_SCLP_ASCII=1 -DS390_TOOLS_RELEASE=2.13.0-bui
ld-20200531 -fno-builtin -ffreestanding -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -fexec-charset=IBM1047 -m64 -mpacked-stack -mst
ack-size=4096 -mstack-guard=128 -msoft-float -Wall -Wformat-security -Wextra -Werror -c -o head.o head.S
s390x-ibm-linux-gnu-gcc -fno-pie -Os -g -I../..//zipl/boot -I../..//zipl/include -I../..//include -DENABLE_SCLP_ASCII=1 -DS390_TOOLS_RELEASE=2.13.0-bui
ld-20200531 -fno-builtin -ffreestanding -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -fexec-charset=IBM1047 -m64 -mpacked-stack -mst
ack-size=4096 -mstack-guard=128 -msoft-float -Wall -Wformat-security -Wextra -Werror -c -o stage3a_init.o stage3a_init.S
head.S: Assembler messages:
head.S:27: Error: Unrecognized opcode: `lgfi'
make[2]: *** [Makefile:36: head.o] Error 1
make[2]: *** Waiting for unfinished jobs....
stage3a_init.S: Assembler messages:
stage3a_init.S:24: Error: Unrecognized opcode: `lgfi'
make[2]: *** [Makefile:36: stage3a_init.o] Error 1
make[2]: Leaving directory '/var/tmp/portage/sys-apps/s390-tools-2.13.0/work/s390-tools-2.13.0/genprotimg/boot'
make[2]: Entering directory '/var/tmp/portage/sys-apps/s390-tools-2.13.0/work/s390-tools-2.13.0/genprotimg/src'
echo "  SKIP    genprotimg due to unresolved dependencies"
  SKIP    genprotimg due to unresolved dependencies
make[2]: Leaving directory '/var/tmp/portage/sys-apps/s390-tools-2.13.0/work/s390-tools-2.13.0/genprotimg/src'
make[2]: Entering directory '/var/tmp/portage/sys-apps/s390-tools-2.13.0/work/s390-tools-2.13.0/genprotimg/man'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/var/tmp/portage/sys-apps/s390-tools-2.13.0/work/s390-tools-2.13.0/genprotimg/man'
make[1]: Leaving directory '/var/tmp/portage/sys-apps/s390-tools-2.13.0/work/s390-tools-2.13.0/genprotimg'
>>> Source compiled.
mhartmay commented 3 years ago

Hi @vapier, sorry for the very late reply! I was not aware of this issue for a long time. Can you please list the version of the cross compiler(s) used? e.g. s390x-linux-gnu-gcc --version and s390x-linux-gnu-as --version. Thanks in advance.

hoeppnerj commented 3 years ago

The build issue is fixed via https://github.com/ibm-s390-tools/s390-tools/commit/6db7fbe0187042f44a63a5c7dbeb9f116909d02e

borntraeger commented 3 years ago

FWIW, lgfi was added with the extended immediate facility (z990). The problem is probably that on gentoo there is no architecture level set to anything newer than z900 for gcc. The binutils will reject mnemonics that are newer than the architecture level. So The fix would be to compile this file with march=z990 or newer or - which is better - to change the code to not use lgfi.

borntraeger commented 3 years ago

@vapier Does something like the following work for you (replace llill with lgfi)

in genprotimg/boot/head.S This line lgfi %r15, STACK_ADDRESS + STACK_SIZE - STACK_FRAME_OVERHEAD to llill %r15, STACK_ADDRESS + STACK_SIZE - STACK_FRAME_OVERHEAD

borntraeger commented 3 years ago

Just checked. It looks like stage3a_init.S also needs a change.