tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Seg fault when compiling with -nostdlib


From: Konstantinos Agiannis
Subject: [Tinycc-devel] Seg fault when compiling with -nostdlib
Date: Fri, 27 Sep 2019 12:47:38 +0300

The following program causes segmentation fault during compilation tcc -nostdlib

#include <unistd.h>
#include <sys/syscall.h>

void _start()
{
    register int    syscall_no  asm("rax") = 1;
  register int    arg1        asm("rdi") = 1;
  register char*  arg2        asm("rsi") = "hello, world!\n";
  register int    arg3        asm("rdx") = 14;
  asm("syscall");
        
        asm("movl $1,%eax;"
        "xorl %ebx,%ebx;"
        "int  $0x80"
    );
}

gcc and clang work normally.
Tested debian buster with tcc 0.9.27



reply via email to

[Prev in Thread] Current Thread [Next in Thread]