tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] forward asm symbols vs static


From: grischka
Subject: Re: [Tinycc-devel] forward asm symbols vs static
Date: Thu, 23 Nov 2017 21:17:43 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

avih wrote:
- tcc 64 fails the asm tests (again, all versions regardless of how it was 
built).

Different calling convention on win64.  I'd suggest the attached
version which is more platform neutral.

-- gr

    On Thursday, November 23, 2017 8:17 PM, grischka <address@hidden> wrote:
 I've seen a segfault under some other circumstances on linux 64.

Using "lea str(%rip),%rdi" instead of "mov $str,%rdi" in asm-c-connect-1.c
did fix it.  (I can't tell right now whether that is expected behavior or
points to a bug though.)

Also I noticed that apparently 'U' is a string prefix in newer gcc versions.
(Don't know, maybe for unicode?).

Btw, what about the "vide" hack on tccasm.c:1020 from commit 6afe668ec
Can we delete it?

Ciao,

--- grischka


#include <stdio.h>

#if defined _WIN32 && !defined __TINYC__
# define _ "_"
#else
# define _
#endif

static int x1_c(void)
{
    printf("x1\n");
    return 1;
}

asm(".text;"_"x1: call "_"x1_c; ret");

int main(int argc, char *argv[])
{
    asm("call "_"x1");
    asm("call "_"x2");
    asm("call "_"x3");
    return 0;
}

static
int x2(void)
{
    printf("x2\n");
    return 2;
}

extern int x3(void);


reply via email to

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