how to export a function in GAS assembler?
assembly, gnu-assembler, x86-64
Solution
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*/
...
Problem
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 ``` 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.