如何导出气体汇编函数? [英] how to export a function in GAS assembler?

查看:226
本文介绍了如何导出气体汇编函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下组装code,

Hi I have the following assembly code ,

.export __ls__11NSDOM_EncapFf
.text 
__ls__11NSDOM_EncapFf:
/* first load the symbolic constant*/
movq _IEEE_FP@GOTPCREL(%rip), %r8  /*%r8 is a scratch register*/
movq (%r8), %r9  /* %r9 and %r11 are scratch registers*/
movl (%r9), %r11d
/* second, see if it is zero and branch accordingly */
test %r11d, %r11d   /* zero call TNS procedure */
                    /* non-zero call IEEE procedure */
je  ____ls__11NSDOM_EncapFf_tns/* constant equals 0 */
jmp  ____ls__11NSDOM_EncapFf_ieee/* constant not equal to 0 */
ret

我编译.s文件,以.o文件中(编译是好的),但是当我与其他.o文件是没有这个链接的.o由于尚未解决的参考_ LS 的_11NSDOM_EncapFf。我使用HP不停止系统,X86-64位架构的GNU汇编2.19.1。请帮我解决这个问题。

I compile the .s file to .o file(compilation is fine) , but when I link this .o with other .o files it is failing due to unresolved reference to _ls_11NSDOM_EncapFf. I am using GNU assembler 2.19.1 on HP Non stop system, X86-64 bit architecture. Please help me to resolve the issue.

推荐答案

您需要设置你的符号全球为它是外联;

You'll need to set your symbol global for it to be externally linkable;

.text 
.global __ls__11NSDOM_EncapFf          /* Sets the symbol externally linkable */
__ls__11NSDOM_EncapFf:
/* first load the symbolic constant*/
...

这篇关于如何导出气体汇编函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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