将程序集文件包含在另一个程序集文件中 [英] Include assembly file in another assembly file

查看:67
本文介绍了将程序集文件包含在另一个程序集文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个文件main.s和test.s,其中test.s看起来像这样:

I have two files, main.s and test.s where test.s looks like this:

test:
   add a1,a2,a2

...和main.s看起来像这样:

...and main.s looks like this:

main:
   call test

(很多毫无意义的例子).如何在main中包含测试?我正在使用这样的gcc:

(very senseless examples). How can I include test in main? I am using gcc like this:

gcc -o main main.c

gcc -o main main.c

但是我不知道如何在其中使用测试...任何帮助?

But I have no idea how I can use test in there...any help?

推荐答案

您可以像在GCC中添加其他文件一样包含文件:

You can include the file just as you would with anything else in GCC:

 #include"test.S"

您是否正在使用NASM:

Were you using NASM you would use:

 %include "test.s"

这篇关于将程序集文件包含在另一个程序集文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆