[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] asm labels
From: |
grischka |
Subject: |
Re: [Tinycc-devel] asm labels |
Date: |
Mon, 13 Sep 2010 16:56:33 +0200 |
User-agent: |
Thunderbird 2.0.0.23 (Windows/20090812) |
Thomas Preud'homme wrote:
Greetings everyone,
I've just added support for asm labels for functions. The syntax is the same
as in gcc:
Well, feel free to answer this or not, but I'm just curious: Do you have
an idea what the gcc people had in mind (if anything) when they added this
feature? I mean, I declare "foo" but it's "bar" really? Why not declare
it as "bar"? Or why not write "#define foo bar"? And what has this feature
to do with asm, exactly?
Anyway, as to tinycc, I noticed that it fails to compile with NOTALLINONE
defined. So if this is not an "asm-feature" really I'd suggest to move
the two functions "parse_asm_str" and "asm_label_instr" elsewhere (e.g.
to libtcc.c or tccgen.c) and remove CONFIG_TCC_ASM from tccasm.c again.
The idea is that tccasm.c can stay out from compilation on platforms without
asm support.
Cheers,
--- grischka
==== test1.c ====
int foo(void) __asm__("bar");
int main(void)
{
return foo();
}
==== test2.c ====
#include <stdio.h>
int foo(void)
{
puts("foo called);
return 0;
}
int bar(void)
{
puts("bar called");
return 0;
}
and then tcc -o test test1.c test2.c && ./test will print "bar called".
Asm label will come in another commit. Relevant commit for this change is
9b09fc3
Best regards,
Thomas Preud'homme