https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81342
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |RESOLVED Resolution|--- |INVALID --- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- Well, if you do gcc -m32 -flto -c x.c you can't simply "objcopy" that x.o file to 64bits as objcopy doesn't know how to handle LTO bytecode. I suppose lto-wrapper could diagnose mismatched -m32/-m64 (but those are target flags). The solution is to _not_ use -flto for the 32bit bootloader part. Thus ${PREFIX}gcc -c $CFLAGS -m32 code32.c -o code32.o32 -fno-lto ${PREFIX}objcopy -O elf64-x86-64 code32.o32 code32.o