I'm compiling C code with GCC and assembling some x86 code with NASM on Windows.
Now, GCC by default (and I haven't been able to find an option to change this) prepends an underscore _
to all external symbol names (and expected names).
I need this assembly code to work with GCC on both Windows and Linux and would like to avoid hacks as much as possible (and code duplication; I had separate .s
files for Windows/Linux at first).
I found out about (and used) the --prefix
flag in NASM. Now for some symbols I'd like NASM to treat them as without the leading underscore (exact situation right now is that I need to reference the entry point in a linker script without the leading underscore). Hence the question here on how to override, per symbol, the --prefix
/--postfix
flags of NASM.
Feel free to treat this as an XY problem. If there's a way to set the mangling scheme of GCC for C that'd be great, for example.