Closed Slamy closed 1 year ago
This is just a side-effect of LTO/-fwhole-program
: (see also [https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html])
Just put __attribute__((externally_visible))
in front of void HerpDerp()
and it will work fine. However be careful and read the link above to avoid any strange duplication behavior.
This solved the issue and I do have to admit that I wasn't aware of the effect of '-fwhole-program'. Still two things bother me:
With the keyword
xref
I'm usually able to reference symbols external to my module. With something likeINCBIN(player, "player610.6.no_cia.bin")
this works and the linker is happy. But with a global variable defined in C or a function it is an undefined symbol.I've prepared a minimal example in a fork of the project: https://github.com/BartmanAbyss/vscode-amiga-debug/compare/master...Slamy:vscode-amiga-debug:feature/broken
It confuses me because the object files clearly contain what should be needed for linking. But sadly I'm not an expert concerning the elf format. Maybe some attributes aren't right.
I have the feeling that this relates to the GNU part of this project as I have a vanilla m68k-elf-gcc around which is happy with the vasm output. At least it links...