Is there any way to use symbols from another file without statically linking them to produce a single binary?
The particular scenario I'm trying to solve is where you have a bootloader and a kernel, with the bootloader being a flat binary. It would be useful for the bootloader to be able to access kernel data structures after loading the kernel to initialize it. They can't be statically linked, as they have different base addresses, but the bootloader still needs access to kernel symbols.
For data only, you could have a shared assembly file with the kernel's BSS at a fixed address, but this doesn't handle changes in kernel size well.
If I make the kernel flat binary, NASM's [map] directive outputs the appropriate information, but not in a format that can easily be fed into the bootloader.
If I make the kernel ELF, the information is in the kernel file itself, but I don't know how to make use of that information when assembling the bootloader.