简体   繁体   English

在另一个程序集文件中包含程序集文件

[英]Include assembly file in another assembly file

I have two files, main.s and test.s where test.s looks like this: 我有两个文件main.s和test.s,其中test.s看起来像这样:

test:
   add a1,a2,a2

...and main.s looks like this: ...和main.s看起来像这样:

main:
   call test

(very senseless examples). (很多毫无意义的例子)。 How can I include test in main? 如何在main中包含测试? I am using gcc like this: 我正在像这样使用gcc:

gcc -o main main.c gcc -o main main.c

But I have no idea how I can use test in there...any help? 但是我不知道如何在其中使用测试...有什么帮助吗?

You can include the file just as you would with anything else in GCC: 您可以像在GCC中进行其他操作一样包含文件:

 #include"test.S"

Were you using NASM you would use: 如果您使用NASM,您将使用:

 %include "test.s"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM