This issue was found on Hirsute 5.11 PowerPC with node "baltar", binutil version 2.36.1-6ubuntu1
With our branch hirsute-WIP and also the latest tip 53017303f8363 upstream
Test build failed with:
Checking powerpc/spapr_hcall.elf for unsupported reloc types... looks good.
gcc -std=gnu99 -ffreestanding -O2 -msoft-float -mabi=no-altivec -mno-altivec -I /home/ubuntu/upstream/kvm-unit-tests/lib -I /home/ubuntu/upstream/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -g -MMD -MF powerpc/.rtas.d -fno-strict-aliasing -fno-common -Wall -Wwrite-strings -Wempty-body -Wuninitialized -Wignored-qualifiers -Werror -fomit-frame-pointer -fno-stack-protector -Wno-frame-address -fno-pic -no-pie -Wclobbered -Wunused-but-set-parameter -Wmissing-parameter-type -Wold-style-declaration -Woverride-init -Wmissing-prototypes -Wstrict-prototypes -mlittle-endian -c -o powerpc/rtas.o powerpc/rtas.c
gcc -std=gnu99 -ffreestanding -O2 -msoft-float -mabi=no-altivec -mno-altivec -I /home/ubuntu/upstream/kvm-unit-tests/lib -I /home/ubuntu/upstream/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -g -MMD -MF powerpc/.rtas.d -fno-strict-aliasing -fno-common -Wall -Wwrite-strings -Wempty-body -Wuninitialized -Wignored-qualifiers -Werror -fomit-frame-pointer -fno-stack-protector -Wno-frame-address -fno-pic -no-pie -Wclobbered -Wunused-but-set-parameter -Wmissing-parameter-type -Wold-style-declaration -Woverride-init -Wmissing-prototypes -Wstrict-prototypes -mlittle-endian -c -o powerpc/rtas.aux.o /home/ubuntu/upstream/kvm-unit-tests/lib/auxinfo.c \
-DPROGNAME=\"powerpc/rtas.elf\"
ld -EL -nostdlib -pie -n -o powerpc/rtas.elf \
-T /home/ubuntu/upstream/kvm-unit-tests/powerpc/flat.lds --build-id=none \
powerpc/rtas.o powerpc/cstart64.o powerpc/reloc64.o lib/libcflat.a lib/libfdt/libfdt.a powerpc/rtas.aux.o
rm -f powerpc/rtas.aux.o
Checking powerpc/rtas.elf for unsupported reloc types... looks good.
gcc -std=gnu99 -ffreestanding -O2 -msoft-float -mabi=no-altivec -mno-altivec -I /home/ubuntu/upstream/kvm-unit-tests/lib -I /home/ubuntu/upstream/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -g -MMD -MF powerpc/.emulator.d -fno-strict-aliasing -fno-common -Wall -Wwrite-strings -Wempty-body -Wuninitialized -Wignored-qualifiers -Werror -fomit-frame-pointer -fno-stack-protector -Wno-frame-address -fno-pic -no-pie -Wclobbered -Wunused-but-set-parameter -Wmissing-parameter-type -Wold-style-declaration -Woverride-init -Wmissing-prototypes -Wstrict-prototypes -mlittle-endian -c -o powerpc/emulator.o powerpc/emulator.c
/tmp/ccVRmsH2.s: Assembler messages:
/tmp/ccVRmsH2.s:335: Error: `lswx' invalid when little-endian
/tmp/ccVRmsH2.s:381: Error: `lswx' invalid when little-endian
/tmp/ccVRmsH2.s:403: Error: `lswx' invalid when little-endian
/tmp/ccVRmsH2.s:432: Error: `lswx' invalid when little-endian
/tmp/ccVRmsH2.s:624: Error: `lswi' invalid when little-endian
/tmp/ccVRmsH2.s:669: Error: `lswi' invalid when little-endian
/tmp/ccVRmsH2.s:690: Error: `lswi' invalid when little-endian
make: *** [<builtin>: powerpc/emulator.o] Error 1
Please find attachment for a more complete build log.
There is a similar issue reported against valgrind
https://<email address hidden>/msg489085.html
It seems to be binutils related.
Test build works in Bionic PowerPC, binutils version 2.30-21ubuntu1~18.04.5
I was able to made it build after conditioning the part of emulator.c that uses lswx and lswi on big endian.
However, one of the points of running those instructions under kvm on a little endian system is to test its behavior. I will see if there is any way to tell binutils to allow those instructions.
Cascardo.