On 23/09/09 08:41PM, david.k...@libertysurf.fr wrote:
> The stdlib is just a glue/wrapper to the underlying operating system, here 
> Windows or Linux.

What is weird is that tcc requires a libc function, memset, when none is 
explicitly requested, when for example this code:

//------------------------------ test1.c -----------------------------------
int
main()
{
        char buf[16] = {0};
        return 0;
}
//--------------------------------------------------------------------------

compiles with GCC and executes correctly with

        $ gcc -o test1 -Wl,-nostdlib test1.c
        $ ./test1
        $

with the relevant code compiled into

# t.c:8: {
        movq    %fs:40, %rax    # MEM[(<address-space-1> long unsigned int 
*)40B], tmp85
        movq    %rax, -8(%rbp)  # tmp85, D.1986
        xorl    %eax, %eax      # tmp85
# t.c:9:        char buf[16] = {0};
        movq    $0, -32(%rbp)   #, buf
        movq    $0, -24(%rbp)   #, buf
# t.c:10:       return 0;
        movl    $0, %eax        #, _3
# t.c:11: }
        movq    -8(%rbp), %rdx  # D.1986, tmp86
        subq    %fs:40, %rdx    # MEM[(<address-space-1> long unsigned int 
*)40B], tmp86
        je      .L3     #,
        call    __stack_chk_fail@PLT    #

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to