I am woking on a compiler and using NASM to make the object files from the output .s files. It works for Linux, and Windows, both in both 32 and 64 bit and I am porting to OSX (32 bit first). I am using it with ld for osx and I am getting a strange linking error for one of my programs. The only difference between the .s files that I have for the operating system is a runtime that has its own file (runtime.s) and output format. There is a strange test programs that act differently when I am using OSX and I am wondering if there is a strange reason with NASM and "Mach-O object i386"? There is only one of my hundreds of tests that for some reason won't link on OSX. The output .o files all seem good and the test links on other platforms.
I have the following code in my pipeline after I generate the .s files
nasm -O1 -f macho <file>.s -o <DIR>/<file>.o (for each file)
ld -macosx_version_min 10.4 -e _start -o main <DIR>/*.o
I am getting the following error when I get to ld:
Undefined symbols for architecture i386:
"List.A.this$", referenced from:
?default?.Main.test$ in Main.o
"List.A@SIT", referenced from:
?default?.Main.test$ in Main.o
"List.A@Subtype", referenced from:
?default?.Main.test$ in Main.o
ld: symbol(s) not found for inferred architecture i386
but I can see each of the defines with nm
nm List.A.o
00000010 T List.A.this$
nm _joos.sit.o | grep List.A
00000770 D List.A@SIT
nm _joos.subtypeIT.o | grep List.A
00000000 D List.A@Subtype
Any help would be greatly appreciated.