tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Re : Re: win32: -Wl,-nostdlib: undefined symbol 'mem


From: Страхиња Радић
Subject: Re: [Tinycc-devel] Re : Re: win32: -Wl,-nostdlib: undefined symbol 'memset'
Date: Sun, 10 Sep 2023 09:13:41 +0200

On 23/09/09 08:41PM, david.koch@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


reply via email to

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