| Hi - I believe I've run into the same issue which I've attempted unsuccessfully to resolve. Any suggestions on building a 64-bit shared library would be greatly appreciated as I need it as a language extension to a commercial language (q from kx Systems) so static linkage isn't an option. I’m able to create the file “libasm.so” (with just A_strstr) on 64-bit Red Hat Enterprise Linux Server release 6.3 without errors and it loads in a c program but I get a seg fault when A_strstr is called. I suspect my build process merely hides the issue, allowing to build and load but not actually call the function. The seg fault happens on the jmpq instruction – Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7df05c0 in A_strstr () from libasm.so From gdb: 0x7ffff7df05c0 <A_strstr> jmpq *0x20017a(%rip) # 0x7ffff7ff0740
0x7ffff7df05c6 <A_strstr+6> nopw %cs:0x0(%rax,%rax,1)
0x7ffff7df05d0 <strstrSSE42> movdqu (%rsi),%xmm1
0x7ffff7df05d4 <strstrSSE42+4> pcmpistrm $0xc,(%rdi),%xmm1 Build: yasm -fELF64 -DUNIX -Worphan-labels -Werror instrset64.asm
yasm -fELF64 -DUNIX -Worphan-labels -Werror strstr64.asm
ld -Bsymbolic -Bsymbolic-functions strstr64.o instrset64.o -o mylib.o
gcc -o libasm.so -Wall -shared -fPIC mylib.o Versions: gcc 4.4.6 20120305 (Red Hat 4.4.6-4)
ld 2.20.51.0.2-5.34.el6 20100205
yasm 1.2.0 Thanks, Charles |