Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-compiliation fails due to invocation of objstrip during build #5

Open
glaubitz opened this issue Dec 23, 2023 · 0 comments
Open

Comments

@glaubitz
Copy link
Contributor

The aboot boot loader is currently not cross-buildable on x86_64 since the build process invokes tools/objstrip at some point during the build to strip the ELF headers from both the aboot and bootlx binaries:

glaubitz@nofan:..glaubitz/aboot> make all CC=alpha-linux-gnu-gcc LD=alpha-linux-gnu-ld
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -D__ASSEMBLY__ -c -o head.o head.S
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -c -o aboot.o aboot.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -c -o cons.o cons.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -c -o utils.o utils.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -c -o zip/misc.o zip/misc.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -c -o zip/unzip.o zip/unzip.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -c -o zip/inflate.o zip/inflate.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -c -o disk.o disk.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -c -o fs/ext2.o fs/ext2.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -c -o fs/ufs.o fs/ufs.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -c -o fs/dummy.o fs/dummy.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -c -o fs/iso.o fs/iso.c
make -C lib libaboot.a CPPFLAGS=" -U_FORTIFY_SOURCE -Iinclude" TESTING=""
make[1]: Entering directory '/local_scratch/glaubitz/aboot/lib'
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -Os -Wall -mno-fp-regs -ffreestanding -U_FORTIFY_SOURCE -Iinclude -U_FORTIFY_SOURCE -I../include  -c -o vsprintf.o vsprintf.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -Os -Wall -mno-fp-regs -ffreestanding -U_FORTIFY_SOURCE -Iinclude -U_FORTIFY_SOURCE -I../include  -c -o memcpy.o memcpy.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -Os -Wall -mno-fp-regs -ffreestanding -U_FORTIFY_SOURCE -Iinclude -U_FORTIFY_SOURCE -I../include  -c -o memset.o memset.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -Os -Wall -mno-fp-regs -ffreestanding -U_FORTIFY_SOURCE -Iinclude -U_FORTIFY_SOURCE -I../include  -c -o string.o string.c
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -U_FORTIFY_SOURCE -Iinclude -U_FORTIFY_SOURCE -I../include -D__ASSEMBLY__ -U_FORTIFY_SOURCE -Iinclude -U_FORTIFY_SOURCE -I../include  -c -o _setjmp.o _setjmp.S
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -U_FORTIFY_SOURCE -Iinclude -U_FORTIFY_SOURCE -I../include -D__ASSEMBLY__ -U_FORTIFY_SOURCE -Iinclude -U_FORTIFY_SOURCE -I../include  -c -o _longjmp.o _longjmp.S
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -Os -Wall -mno-fp-regs -ffreestanding -U_FORTIFY_SOURCE -Iinclude -U_FORTIFY_SOURCE -I../include  -c -o isolib.o isolib.c
alpha-linux-gnu-gcc -DDIV -c -o __divqu.o divide.S
alpha-linux-gnu-gcc -DREM -c -o __remqu.o divide.S
alpha-linux-gnu-gcc -DDIV -DINTSIZE -c -o __divlu.o divide.S
alpha-linux-gnu-gcc -DREM -DINTSIZE -c -o __remlu.o divide.S
ar cru libaboot.a vsprintf.o memcpy.o memset.o string.o _setjmp.o _longjmp.o isolib.o __divqu.o __remqu.o __divlu.o __remlu.o
ar: `u' modifier ignored since `D' is the default (see `U')
make[1]: Leaving directory '/local_scratch/glaubitz/aboot/lib'
alpha-linux-gnu-ld -static -N -Taboot.lds --relax head.o aboot.o cons.o utils.o zip/misc.o zip/unzip.o zip/inflate.o disk.o fs/ext2.o fs/ufs.o fs/dummy.o fs/iso.o -o aboot lib/libaboot.a
alpha-linux-gnu-ld: warning: __remlu.o: missing .note.GNU-stack section implies executable stack
alpha-linux-gnu-ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
alpha-linux-gnu-ld: warning: aboot has a LOAD segment with RWX permissions
make -C tools objstrip CPPFLAGS=" -U_FORTIFY_SOURCE -Iinclude"
make[1]: Entering directory '/local_scratch/glaubitz/aboot/tools'
alpha-linux-gnu-gcc  -U_FORTIFY_SOURCE -Iinclude -Os -Wall -ffreestanding -mno-fp-regs -msmall-data -msmall-text -g -O2 -Wall -I. -I../include -U_FORTIFY_SOURCE -Iinclude -U_FORTIFY_SOURCE -Iinclude   objstrip.c   -o objstrip
make[1]: Leaving directory '/local_scratch/glaubitz/aboot/tools'
tools/objstrip -vb aboot bootlx
qemu-alpha-static: /lib/ld-linux.so.2: Invalid ELF image for this architecture
make: *** [Makefile:90: bootlx] Error 255
glaubitz@nofan:..glaubitz/aboot>

The build process should probably be modified so that objstrip is always built natively so that it can be run even for cross-builds. Unfortunately, objstrip currently does not build on x86_64, so that would have to be addressed first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant