tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Force gcc for x86_64 --enable-cross


From: Henry Kroll
Subject: Re: [Tinycc-devel] Force gcc for x86_64 --enable-cross
Date: Tue, 30 Nov 2010 02:25:29 -0800

-snip-
> Also win32/lib/libtcc1.a is composed
> from wrong objects (i.e. x86-64 libtcc1.o).
I meant I was using --with-libgcc option which doesn't build libtcc1.o
and friends. :) However...

libtcc1.o needs to be x86-64 because i386-win32-tcc has been 64-bit on
x86_64 for a while now. I'm not sure what introduced this change, but it
seems to work just as well, as long as libtcc1.o is also 64-bit...

$ file i386-win32-tcc
i386-win32-tcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not
stripped

After testing this for a while, libtcc1.o(64-bit) is needed by
alloca86.* in the archive and this test works with it.

#include <stdio.h>
int main (int argc, char **argv) {
    char *a=alloca (25); strcpy (a,"Hello");
    printf ("%s alloca!",a);
    return 0;
}

cd win32/examples
../../i386-win32-tcc -B.. -I../../include hello_win.c #works
../../i386-win32-tcc -B.. -I../../include hello_alloca.c #works

wine hello_win.exe
wine hello_alloca.exe
Hello alloca!

I tried not including libtcc1.o(64-bit) into the libtcc1.a archive, but
the above test then generated an error: undefined reference to _main

I tried not including alloca* in the archive and got alloca: undefined
symbol, so they are both needed. Anyway, this latest makefile tweak will
t least keep the cross-build from overwriting libtcc1.a without the -mv
kludge. :)

> Same thing basically with the install locations.  Cross compilers
> should each use their own CONFIG_TCCDIR.
The stage is set for that finally by making libtcc1.a a variable make
target:
$(LIBTCC1_DIR)/libtcc1.a:
#defaults to ./libtcc1.a

Now just need to build it to separate folders. It is also possible to
rename libtcc1.a to something else, but I am undecided about that. It is
nice implicitly knowing it comes from the same sources. i386-win32-tcc
does look for libtcc1.dll though, which *might* be a fair compromise for
win32-cross, even though it's not really a dll... I did a make install
and checked them after last push.

$ ar t /usr/lib64/tinycc/libtcc1.a
libtcc1.o
alloca86_64.o

$ ar t /usr/lib64/tinycc/lib/libtcc1.a
libtcc1.o
alloca86.o
alloca86-bt.o
crt1.o
wincrt1.o
dllcrt1.o
dllmain.o
chkstk.o
bcheck.o

> Last, when cross-compilers are not configured, it should not build
> i386-win32-tcc.
> 
done




reply via email to

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