如何为 MMIX 链接多个汇编程序文件
假设,我编写了一个小库,实现了类似“fprint”的功能。教我MMIX(Das MMIX-Buch,德语)的书总是将整个库复制到新程序中,但我不喜欢这种方法。有没有办法将库组装成一个目标文件,将主程序组装成另一个目标文件并将这两个链接在一起?如何做到这一点?
Assume, I wrote a small lib 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查mmix存储库www.mmix.cs.hm.edu,示例文件夹中有两个示例:Hello World GNU,逐步描述如何获取和使用GNU工具以及编译和链接hello.s(汇编器)或hello .c 与 C 库链接,第二个示例是在 MMIX 上运行 MMIX,它将来自不同 c 文件的 MMIX 的 MMIX 可执行文件链接在一起,并将多个汇编程序文件和 C 库链接在一起以实现 MMIX 的 fat32 文件系统。
马丁
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
根据我从简短的互联网搜索中了解到的信息,mmix 工具使用普通的 gcc 和 binutils 软件包。因此,我希望多个目标文件甚至标准静态库都能“正常工作”。我想知道您遇到了什么具体问题。
编辑:显然与 asm 源类似,只需使用 .s 或 .S 扩展名。当然,您也可以使用 gcc 在幕后使用的适当的汇编器和链接器命令。命令行选项 -v 将显示这些。
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.
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.