gpt4 book ai didi

assembly - 如何在 GAS 汇编程序中导出函数?

转载 作者:行者123 更新时间:2023-12-03 19:58:24 28 4
gpt4 key购买 nike

嗨,我有以下汇编代码,

.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 Non stop 系统、X86-64 位架构上使用 GNU 汇编程序 2.19.1。请帮我解决这个问题。

最佳答案

您需要将您的符号设置为全局,以便它可以外部链接;

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

关于assembly - 如何在 GAS 汇编程序中导出函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17696633/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com