开发者

How to link multiple assembler files for MMIX

开发者 https://www.devze.com 2023-02-11 11:27 出处:网络
Assume, I wrote a small li开发者_运维问答b implementing something \"fprint\"-likely. The book that teaches me MMIX (Das MMIX-Buch, german) always copies the whole lib into the new program, but I disli

Assume, I wrote a small li开发者_运维问答b implementing something "fprint"-likely. The book that teaches me MMIX (Das MMIX-Buch, german) always copies the whole lib into the new program, but I dislike this approach. Is there any way to assemble the library into one object file, the main program into another and link these two together? How to do this?


Check the mmix repository www.mmix.cs.hm.edu there are two examples in the examples folder: Hello World GNU, descrobes step by step how to get and use the GNU Tools and compile and link hello.s (assembler) or hello.c linked with the C library and a second example, running MMIX on MMIX which links together the MMIX executable for MMIX from different c files, and linking together several assembler files and a C library to implement a fat32 file system for MMIX. Martin


According to what I have learned from a brief internet search, the mmix tools use the normal gcc and binutils packages. As such, I expect multiple object files and even standard static libraries to "just work". I wonder what exact problem you have run into.

gcc -c lib.c -o lib.o
gcc -c main.c -o main.o
gcc lib.o main.o -o program

EDIT: obviously similar for asm sources, just use .s or .S extension. You can of course use the appropriate assembler and linker commands that gcc uses behind the scenes too. The command line option -v will show those.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号