0

我的基本汇编文件foidlrt.asm开始变得有点太大,所以我把它分成两部分。这是第二个文件的全部内容folder_stdio.asm

; foidl_stdio.asm

%include   "foidlstnd.inc"


        section .text

        DEFAULT REL

global foidl_fclose           ; Raw file close

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; foidl_close
; Raw file close
; REGISTERS (1):
; RDI file handle
; CALLS:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

foidl_fclose:
    mov       rax,SYSCALL_FILE_CLOSE  ; 0x2000006
    syscall
    ret

global但是,现在当我构建时,尽管新文件中有声明,但我现在从 make 中收到此错误:

nasm src/foidlrt.asm -f macho64 --prefix _ -g -O0 -Iincludes/ -o asmobjs/foildrt.o
nasm src/foidlrt.asm -f macho64 --prefix _ -g -O0 -Iincludes/ -o asmobjs/foidl_stdio.o
libtool -static -s -o libs/libfoidlrt.a asmobjs/foildrt.o asmobjs/foidl_stdio.o
gcc src/testlink.c -L libs -l foidlrt -Wall -g -L. -Wl,-pie -I. -o bin/testlink
Undefined symbols for architecture x86_64:
  "_foidl_fclose", referenced from:
      _main in testlink-4b5ad3.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

版本信息:

XCode - 7.2.1 (7C1002)
nasm  - NASM version 2.12 compiled on Feb 28 2016
gcc   - Apple LLVM version 7.0.2 (clang-700.1.81)

解决

错误都是我的,makefile 规则很糟糕。现在按预期工作。

4

0 回答 0