I am using gcc (cross compiler djgpp from github, which is based on gcc 12.2.0) to compile my c files. Before I used an very old compiler (CC386) to compile the same files. Both just create object files which I link afterwards. I found out, that CC386 set its addresses of external functions to 0 but gcc does not.
I’ve seen the differences when I created listing (.lst) files in compilation process.
CC386 for example created this line:
00000FE1 E8 00000000 E CALL _math_init
The first Hex number seems to be the line number, E8 is the CALL, 00000000 is the (relative?) address.
For the same line of c code, gcc creates this line inside its listing file:
2037 1631 E8CAE9FF call _math_init
Here E8 again is the call, but the number after E8 is not 0. Is it because off different target architectures? Gcc creates object files in COFF format (.o, starting with “L”, while CC386 created object files on OMF format (.obj, starting with “€”).
I am not exactly sure if or how I can make gcc also set the addresses the same way.
CC386 only set addresses to 0 if the function called is not in the same module (math_init is from a file calles math.c but I compiled a file called start.c, where the main calls math_init();)
I also tried to create an .asm file by using the -masm=intel option, and then use my assembler (ml version 6.15.8803) where I know, that it created correct addresses here. But the resilting .asm file has a bad syntax for that assembler.