fuhsnn / slimcc

C11 compiler with GNU / C23 extensions for x86-64 Linux, able to build Python and PostgreSQL
MIT License
24 stars 3 forks source link

`-x` option affect prior input file #47

Closed fuhsnn closed 6 months ago

fuhsnn commented 6 months ago

asmfn.s

.text
.globl asmfn
asmfn:
  movl $-123, %eax
  ret
.section .note.GNU-stack,"",@progbits

main.c

#include <stdio.h>
extern int asmfn(void);
int main() {
  printf("%d\n", asmfn());
}

run

chibicc asmfn.s -xc main.c

got

asmfn.s:1: .text
           ^ variable name omitted

due to the driver treat .s file as c source