Icenowy / aw-el2-barebone

Allwinner SoCs' 64-bit EL2 barebone
GNU General Public License v2.0
16 stars 2 forks source link

Fix build with recent toolchain #5

Open clementperon opened 2 years ago

clementperon commented 2 years ago

Hi,

Trying to retest the PCIe, but with a newer toolchain it doesn't compile anymore.

This fix issue #4

Icenowy commented 2 years ago

Precisely, -nostartfiles is a GCC flag when linking, not a LD flag.

As we call LD directly, we can just drop it, I think.

Icenowy commented 2 years ago

BTW will this newest commit break old compilers?

clementperon commented 2 years ago

@Icenowy on Ubuntu 18.04

$> aarch64-linux-gnu-gcc --version
aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0

Build is fine

 make CROSS_COMPILE=aarch64-linux-gnu-
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -D__ASSEMBLY__   -c -o start.o start.S
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2   -c -o init.o init.c
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2   -c -o uart.o uart.c
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -D__ASSEMBLY__   -c -o stack.o stack.S
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -D__ASSEMBLY__   -c -o exceptions.o exceptions.S
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2   -c -o exception_funcs.o exception_funcs.c
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2   -c -o panic.o panic.c
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2   -c -o pgtables.o pgtables.c
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2   -c -o trapped_funcs.o trapped_funcs.c
aarch64-linux-gnu-ld -nostdlib -nostartfiles -static -T ldscripts/a64.ld start.o init.o uart.o stack.o exceptions.o exception_funcs.o panic.o pgtables.o trapped_funcs.o -o el2-bb.elf
aarch64-linux-gnu-objcopy -O binary el2-bb.elf el2-bb.bin

didn't test it right now, new uboot doesn't have the "mksunxi_fit_atf.sh" and I run out of time to dig on what's the new procedure.

Icenowy commented 2 years ago

@Icenowy on Ubuntu 18.04

$> aarch64-linux-gnu-gcc --version
aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0

Build is fine

make CROSS_COMPILE=aarch64-linux-gnu-
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -D__ASSEMBLY__   -c -o start.o start.S
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2   -c -o init.o init.c
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2   -c -o uart.o uart.c
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -D__ASSEMBLY__   -c -o stack.o stack.S
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -D__ASSEMBLY__   -c -o exceptions.o exceptions.S
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2   -c -o exception_funcs.o exception_funcs.c
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2   -c -o panic.o panic.c
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2   -c -o pgtables.o pgtables.c
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2   -c -o trapped_funcs.o trapped_funcs.c
aarch64-linux-gnu-ld -nostdlib -nostartfiles -static -T ldscripts/a64.ld start.o init.o uart.o stack.o exceptions.o exception_funcs.o panic.o pgtables.o trapped_funcs.o -o el2-bb.elf
aarch64-linux-gnu-objcopy -O binary el2-bb.elf el2-bb.bin

didn't test it right now, new uboot doesn't have the "mksunxi_fit_atf.sh" and I run out of time to dig on what's the new procedure.

The log here looks like you used the old code to build on old compiler, what I want to ensure is that new code can build with old compiler.

clementperon commented 2 years ago

Correct i cloned your repo instead of mine :facepalm:

root@09c4405a8e2e:/aw-el2-barebone# make CROSS_COMPILE=aarch64-linux-gnu-
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -D__ASSEMBLY__   -c -o start.o start.S
aarch64-linux-gnu-gcc -I ./include -I ./uboot-headers -ffreestanding -DSOC_HEADER="\"h6.h\"" -DNDEBUG -O2 -mno-outline-atomics   -c -o init.o init.c
aarch64-linux-gnu-gcc: error: unrecognized command line option '-mno-outline-atomics'; did you mean '-fno-inline-atomics'?
<builtin>: recipe for target 'init.o' failed