Include assembly file in another assembly file

╄→гoц情女王★ 提交于 2020-05-16 01:09:54

问题


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

test:
   add a1,a2,a2

...and main.s looks like this:

main:
   call test

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

gcc -o main main.c

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


回答1:


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

 #include"test.S"

Were you using NASM you would use:

 %include "test.s"


来源:https://stackoverflow.com/questions/39457263/include-assembly-file-in-another-assembly-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!