Closed the-grue closed 1 year ago
That was fun.
the-grue, thanks for all the hard work. Question: what are all the *.n files? Are they necessary?
Ah, the .n files. So is there no way to tell nasm to let the linker deal with undefined global symbols? I just tried to add some code to cgn.c to print out the C_EXTERN symbols in the symbol table, but none of the symbols in the include/ directory files are marked as extern. Sigh. I really don't want to pollute the tree with dozens of .n files, especially when gas doesn't need them.
Hi Warren! It doesn't get to the linking step as nasm doesn't seem to like the undefined externals. They can certainly be consolidated elsewhere but I haven't found a way to get around having them other than hard-coding them into the code generator, which isn't a good solution either. I can do some more work on it, I just didn't want to extend more effort if there wasn't any interest.
Thanks the-grue. We have to find a way so that cwn
can be a general-purpose compiler, not just one that can compile itself. All C compilers can do this: cc -o hello hello.c
without needing the programmer to also create a hello.n
file first. Surely there has to be a way to tell nasm
to ignore undefined symbols and let the linker take care of them.
Of course. Let me see what I can do.
Ok, please review the changes in the 62_Cleanup lesson. If this is acceptable, please let me know and I will correct the deficiencies in prior lessons. The solution was in the code and not trying to bend nasm into conforming. :)
Also open to other suggestions.
Looks good James, thanks!
In case there is any interest, I am adding a code generation option that creates nasm code instead of gas as I am working through the project steps.