Can I compile a 32-bit .a
and then link it into a 64-bit application? This is x86 specifically.
At the moment, I have a file written in assembly, with nasm, that uses BITS 32
to ensure that it's only generating x86 stuff. I then link it into my x86-64 code generated from Rust. I'd like to port that asm to Rust. (which will of course also need some inline asm but that's a distraction). I have that compiling into a .a
, but when I try to link that into my x86-64 code, ld
isn't happy:
note: /usr/bin/ld: skipping incompatible ./libboot.a when searching for -lboot
Any thoughts?
(This is specifically doing the "GRUB dumps you in protected mode and I need to transition to long mode" code.)