[Tinycc-devel] Building a 32 bit cross compiler on x86_64 Linux?

2014-04-04 Thread Aharon Robbins
Hi All.

What is the magic incantation to build an i386 version of tcc running
on x86_64 Linux?  It looks like 'make i386-tcc' builds the compiler itself.
After installing that, though, tcc -m32 hello.c fails to find the C
runtime start off and library files.

I'm on Ubuntu 12.04, and I have all the i386 libraries and stuff installed;
gcc -m32 works just fine. Same for clang.

Much thanks!

Arnold

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Tinycc for ARM help needed !

2014-04-04 Thread Aharon Robbins
Hi. I just wanted to report that on x86_64, gawk builds and passes
all its tests!

Michael - I think the failures you saw are related to locale settings
and not the changes you've made.

Do things work also using i386 tcc?

Thanks,

Arnold

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] tcc i386 test failures after commit ea2805f

2014-04-04 Thread Michael Matz
Hello Ramsay,

On Thu, 3 Apr 2014, Ramsay Jones wrote:

 After commit ea2805f (shared libs: Build libtcc1.a with -fPIC, 02-04-2014),
 this now fails like so:

Fixed with 2024c445.  Indeed PIC input wasn't handled correctly in 
connection with -run (emitting a real ELF executable worked).  So the 
testsuite is now back to the state before ea2805f, that is known VLA 5 
fail in test1b and known bad pointer in strlen() in test3b.


Ciao,
Michael.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Fwd: Bug#675024: tcc: errors Symbol `mpfr_xxx' causes overflow in R_X86_64_PC32 relocation

2014-04-04 Thread Vincent Lefevre
Hi,

On 2014-04-02 21:45:54 +0200, Michael Matz wrote:
 On Wed, 2 Apr 2014, Michael Matz wrote:
 Another report about the current state of shared libraries produced by
 tcc. Michael, I'm just copying it here because you asked. It's ok if you
 don't want or can't work on this.
 
 Reporting it here is fine, especially with reduced testcases.  That was
 the point :)  (And yeah, I'll work on it when time and mood permits)
 
 Actually I just fixed a similar error for gawk (libtcc1.a containing non-PIC
 code), which has exactly that symptom ('abort' and _PC32 reloc overflowing).
 So it's worth a new try with mob branch.

This doesn't change anything in MPFR:

ypig:...ftware/mpfr/tests ./texceptions
./texceptions: Symbol `stderr' causes overflow in R_X86_64_PC32 relocation
./texceptions: Symbol `abort' causes overflow in R_X86_64_PC32 relocation
zsh: segmentation fault (core dumped)  ./texceptions

I don't know the cause of the segmentation fault. Other tests give
error messages, but they don't fail:

ypig:...ftware/mpfr/tests ./tversion
./tversion: Symbol `stderr' causes overflow in R_X86_64_PC32 relocation
./tversion: Symbol `abort' causes overflow in R_X86_64_PC32 relocation
[tversion] GMP: header 6.0.0, library 6.0.0
[tversion] MPFR tuning parameters from default

-- 
Vincent Lefèvre vinc...@vinc17.net - Web: https://www.vinc17.net/
100% accessible validated (X)HTML - Blog: https://www.vinc17.net/blog/
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] tcc i386 test failures after commit ea2805f

2014-04-04 Thread Ramsay Jones
On 04/04/14 16:59, Michael Matz wrote:
 Hello Ramsay,
 
 On Thu, 3 Apr 2014, Ramsay Jones wrote:
 
 After commit ea2805f (shared libs: Build libtcc1.a with -fPIC, 02-04-2014),
 this now fails like so:
 
 Fixed with 2024c445.  Indeed PIC input wasn't handled correctly in 
 connection with -run (emitting a real ELF executable worked).  So the 
 testsuite is now back to the state before ea2805f, that is known VLA 5 
 fail in test1b and known bad pointer in strlen() in test3b.

Yep, I can confirm that it now fails in the old familiar way! :-P

Thanks! (that was a fast response!).

ATB,
Ramsay Jones




___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Zeroing stack variables CValue

2014-04-04 Thread grischka

Michael Matz wrote:
Thanks.  While it doesn't crash for me on x86-64 (with rev aa561d70, 
i.e. before your memset patch) I do see the wrong vset flowing into 
init_putv; it's unary(), case TOK_LAND, which does


vset(s-type, VT_CONST | VT_SYM, 0);
vtop-sym = s;


Using
 vpushsym(s-type, s);
instead of the two lines above seems to fix it.

Also I renamed the CValue member void *ptr to addr_t ptr_offset
and started to use that in some obvious places.  This could help
avoiding target size confusions.

Also: __attribute__ ((noreturn)): gnuism

http://repo.or.cz/w/tinycc.git/commitdiff/5879c854fb94f722a7ffdd4e895c9ce418548959

Thanks,

--- grischka


Ciao,
Michael.



___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] x86_64: shared libs

2014-04-04 Thread grischka

Question apropos:

On linux x86_64 there is still the ugly
runtime_plt_and_got
hack which is a replacement for PLT in the tcc -run case
to forward 32bit calls to extern libraries.

On win64 the same problem is solved by building the IAT
(import address table) also in the -run case.

From your estimation, would it be possible to do the same on ELF?
That is build the PLT/GOT as if we were making an executable and
then use that with tcc -run?

--- grischka

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Fwd: Bug#675024: tcc: errors Symbol `mpfr_xxx' causes overflow in R_X86_64_PC32 relocation

2014-04-04 Thread Michael Matz

Hi,

On Fri, 4 Apr 2014, Vincent Lefevre wrote:


Actually I just fixed a similar error for gawk (libtcc1.a containing non-PIC
code), which has exactly that symptom ('abort' and _PC32 reloc overflowing).
So it's worth a new try with mob branch.


This doesn't change anything in MPFR:

ypig:...ftware/mpfr/tests ./texceptions
./texceptions: Symbol `stderr' causes overflow in R_X86_64_PC32 relocation
./texceptions: Symbol `abort' causes overflow in R_X86_64_PC32 relocation
zsh: segmentation fault (core dumped)  ./texceptions


Have you rebuilt libtcc1.a (e.g. make clean before redoing make in tcc)? 
And reinstalled it?  How did you configure tinycc?  How did you configure 
mpfr.  Because I can't reproduce:


% tcc ./configure  make -j8
% tcc cd /tmp/mpfr-3.1.2
% mpfr-3.1.2 CC=/matz/git/tinycc/tcc -B/matz/git/tinycc/ ./configure
...
% mpfr-3.1.2 make -j8  make check
...
[tversion] GMP: header 5.0.2, library 5.0.2
[tversion] MPFR tuning parameters from default
PASS: tversion

All 160 tests passed
(1 test was not run)

...

(The skipped test is tget_set_d64).  In particular:

% mpfr-3.1.2 cd tests  ./texceptions
% tests echo $?
0
% ldd ./texceptions
linux-vdso.so.1 =  (0x7fffd336f000)
libm.so.6 = /lib64/libm.so.6 (0x7f36ffd28000)
libc.so.6 = /lib64/libc.so.6 (0x7f36ff9bb000)
libmpfr.so.4 = /tmp/mpfr-3.1.2/src/.libs/libmpfr.so.4 
(0x7f36ff714000)
libgmp.so.10 = /usr/lib64/libgmp.so.10 (0x7f36ff496000)
/lib64/ld-linux-x86-64.so.2 (0x7f36fff7f000)


Ciao,
Michael.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] x86_64: shared libs

2014-04-04 Thread Michael Matz

Hi,

On Fri, 4 Apr 2014, grischka wrote:


Question apropos:

On linux x86_64 there is still the ugly
   runtime_plt_and_got
hack which is a replacement for PLT in the tcc -run case
to forward 32bit calls to extern libraries.

On win64 the same problem is solved by building the IAT
(import address table) also in the -run case.

From your estimation, would it be possible to do the same on ELF?
That is build the PLT/GOT as if we were making an executable and
then use that with tcc -run?


Yes, that's something on my TODO.  Theoretically having 
runtime_plt_and_got makes code emission a tiny bit faster because having a 
proper PLT and GOT also for -run means first creating and second applying 
intermediate relocations (the _GLOB_DAT and _JUMP_SLOT relocs), which is 
cut short with the hack.  OTOH removing the hack would remove deviation 
depending on output type, so I think it's a good idea nevertheless.



Ciao,
Michael.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Fwd: Bug#675024: tcc: errors Symbol `mpfr_xxx' causes overflow in R_X86_64_PC32 relocation

2014-04-04 Thread Vincent Lefevre
On 2014-04-04 20:52:13 +0200, Michael Matz wrote:
 Hi,
 
 On Fri, 4 Apr 2014, Vincent Lefevre wrote:
 
 Actually I just fixed a similar error for gawk (libtcc1.a containing non-PIC
 code), which has exactly that symptom ('abort' and _PC32 reloc overflowing).
 So it's worth a new try with mob branch.
 
 This doesn't change anything in MPFR:
 
 ypig:...ftware/mpfr/tests ./texceptions
 ./texceptions: Symbol `stderr' causes overflow in R_X86_64_PC32 relocation
 ./texceptions: Symbol `abort' causes overflow in R_X86_64_PC32 relocation
 zsh: segmentation fault (core dumped)  ./texceptions
 
 Have you rebuilt libtcc1.a (e.g. make clean before redoing make in tcc)?

I didn't do make clean (I thought dependency rules would have
rebuilt it). Problem solved after make clean and reinstall.

-- 
Vincent Lefèvre vinc...@vinc17.net - Web: https://www.vinc17.net/
100% accessible validated (X)HTML - Blog: https://www.vinc17.net/blog/
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Building a 32 bit cross compiler on x86_64 Linux?

2014-04-04 Thread Thomas Preud'homme
Le vendredi 4 avril 2014, 11:49:49 Aharon Robbins a écrit :
 Hi All.
 
 What is the magic incantation to build an i386 version of tcc running
 on x86_64 Linux?  It looks like 'make i386-tcc' builds the compiler itself.
 After installing that, though, tcc -m32 hello.c fails to find the C
 runtime start off and library files.
 
 I'm on Ubuntu 12.04, and I have all the i386 libraries and stuff installed;
 gcc -m32 works just fine. Same for clang.

I didn't look at the source but in the case of cross compilers multiarch 
cannot be detected and when using the cross compiler it cannot find everything 
which is stored in the multiarch qualified path. I'm working on a patch to 
build only one cross compiler instead of many which would allow to configure it 
(say, configure its library path :)). That would allow to make it work.

Best regards,

Thomas

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel