Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 在编译库时尝试在另一个库中使用asm函数。因此使用nasm_Assembly_64 Bit_Nasm - Fatal编程技术网

Assembly 在编译库时尝试在另一个库中使用asm函数。因此使用nasm

Assembly 在编译库时尝试在另一个库中使用asm函数。因此使用nasm,assembly,64-bit,nasm,Assembly,64 Bit,Nasm,如上所述,我试图在另一个中重新使用asm函数,同时在libasm.so中编译它们。 基本上,我是这样做的: strpbrk: init: push rbp mov rbp, rsp mov r9, rdi mov r10, rsi mov rdx, -1 loop: mov rbx, r9 inc rdx add rbx, rdx movzx ebx, BYTE[rbx] mov [b

如上所述,我试图在另一个中重新使用asm函数,同时在libasm.so中编译它们。 基本上,我是这样做的:

    strpbrk:

    init:  
    push rbp
    mov rbp, rsp
    mov r9, rdi
    mov r10, rsi
    mov rdx, -1
    loop:
    mov rbx, r9
    inc rdx
    add rbx, rdx
    movzx ebx, BYTE[rbx]

    mov [buf], ebx
    movzx rsi, WORD[buf]
    mov rdi, r10
    call strstr
    cmp rax, 0
    jne end

    cmp bl, 0
    jne loop

    end:
    leave
    ret

    SECTION .data

    buf db 0, 0
下面是错误:

    nasm -f elf64 src/strstr.asm -o src/strstr.o
    nasm -f elf64 src/strpbrk.asm -o src/strpbrk.o
    src/strpbrk.asm:23: error: symbol `strstr' undefined
    make: *** [Makefile:28: src/strpbrk.o] Error 1
考虑到我试图调用的strstr函数是在同一个makefile上生成的


一个如何使用bot编译的想法?

使用nasm,您需要将来自其他翻译单元的符号声明为
extern
,否则汇编器会抱怨。详细信息请阅读

针对你的问题,写

extern strstr
strpbrk.asm
中告诉nasm
strstr
是外部提供的符号