Hi,

On Mon, 10 Oct 2016, Christian JULLIEN wrote:

> The problem is perhaps different:
> ./tcc -B. -Iinclude -I. -run tests/tcctest.c
> Compiles and works well. This one ic compiled with GCC
> 
> I get this issue only with:
> ../tcc -B.. -I../include -I.. -I.. -DTCC_TARGET_I386 -DONE_SOURCE -run
> ../tcc.c -B.. -I../include -I.. -I.. -DTCC_TARGET_I386 -DONE_SOURCE -run
> ../tcc.c -B.. -I../include -I.. -I.. -DTCC_TARGET_I386 -DONE_SOURCE -run
> ../tcc.c -B.. -I../include -I.. -I.. -run tcctest.c > test.out3
> 
> If understand well, when tcc is compiled by itself.
> 
> It I add:
>     tcc_define_symbol(s, "__aligned(n)",
> "__attribute__((aligned(n)))");                     


TCC shouldn't define __aligned, GCC doesn't either.  Some FreeBSD headers 
contain the equivalent of the above define, you need to find out which, 
and you need to find out why it doesn't get used when using TCC.  You 
could use grep or "gcc -E -dD" on a file showing the problem.  Search for 
"define.*__aligned" and take it from there.

> The issue is different, it compiles fine this time but I get:
> ------------ test3 ------------
> ../tcc -B.. -I../include -I.. -I.. -DTCC_TARGET_I386 -DONE_SOURCE -run
> ../tcc.c -B.. -I../include -I.. -I.. -DTCC_TARGET_I386 -DONE_SOURCE -run
> ../tcc.c -B.. -I../include -I.. -I.. -DTCC_TARGET_I386 -DONE_SOURCE -run
> ../tcc.c -B.. -I../include -I.. -I.. -run tcctest.c > test.out3
> tcc: error: undefined symbol 'memmove'
> tcc: error: undefined symbol 'memcpy'
> tcc: error: undefined symbol 'strlen'
> tcc: error: undefined symbol 'memset'
> tcc: error: undefined symbol 'memcmp'
> ....
> 
> i.e. no stdlib function is found.

Does this also happen with simpler programs containing a call to e.g. 
strlen?  Does it only happen with -run, or also when compiling to an 
executable?  I.e.:

% cat x.c
extern long strlen(const char *);
int main(int argc, char*argv[]) {
  return strlen(argv[0]);
}
% tcc x.c
% tcc -run x.c

If the first tcc run already fails the output of "gcc -v x.c" would be 
interesting.  Otherwise it's something to do with the dynamic linker or 
the TCCs link editor itself and would need further investigation.


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

Reply via email to