Question

when a compile all my .S, i have this error anywhere : "binary format does not support any special symbol types"

in this code for example

    [BITS 64]

        global strcspn:function
        section .text

strcspn:
        push    rbp
        mov     rbp, rsp
        mov     r8, 0

.while:
        cmp     byte[rdi + r8], 0
        je      .goodEnd
        mov     r9, 0
        jmp     .check
.incr:
        inc     r8
        jmp     .while

.check:
        cmp     byte[rsi + r9], 0
        je      .incr
        cmp     byte[rdi + r8], byte[rsi + r9]
        je      .goodEnd
        inc     r9
        jmp     .check

.goodEnd:
        mov     rax, [r8 - 1]
        leave
        ret
Was it helpful?

Solution

That looks like nasm code (please add tag next time) and you probably forgot to specify output format -f elf64 so it defaults to binary which doesn't support the :function symbol type (which you don't need anyway). Note that you will at least need to fix the cmp byte[rdi + r8], byte[rsi + r9] too, because cmp doesn't accept two memory references. Also the mov rax, [r8 - 1] looks very suspicious.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top