tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] Self hosting issues with tcc 0.9.27


From: avih
Subject: [Tinycc-devel] Self hosting issues with tcc 0.9.27
Date: Wed, 15 Mar 2023 13:27:48 +0000 (UTC)

I thought it would be useful to be able to reach from tcc 0.9.27
to the current mob HEAD cleanly, and I've encountered several issues:


1. On Ubuntu 64 22.04 LTS (gcc 11.3), tcc 0.9.27 does not build.

git clean -xfd
git checkout release_0_9_27
./configure --prefix=$PWD/../tcc0927
make

# ends with this error:

../tcc -c bcheck.c -o bcheck.o -B..
bcheck.c:738: error: '__malloc_hook' undeclared
make[1]: *** [Makefile:64: bcheck.o] Error 1


I could not find a configure option to disable bcheck, so I edited
lib/Makefile and hardcoded "BCHECK_O =" (not only with uclibc/musl).

And now "make" works, but "make test" fails:

------------ asm-c-connect-test ------------
./asm-c-connect > asm-c-connect.out1 && cat asm-c-connect.out1
Segmentation fault
make[1]: *** [Makefile:245: asm-c-connect-test] Error 139


Disabling asm-c-connect-test (deleting line 19 at tests/Makefile),
and now "make test" succeeds. I did not try to fix the test.

Now run "make install", and keep this install (at $PWD/../tcc0927)

FWIW, gentoo bumped into the same issue, and their solution was
to ditch 0.9.27 in favor of mob from 20211022:
https://bugs.gentoo.org/806511
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=717eba5b5cfb78b1438c348882b34c88b3dc173a


2. Building mob using 0.9.27 works, but tests fail

test3:

As far as I can tell, because in test3, tcc 0.9.27 fails to compile
the reference in tests/tcctest.c in various cases where the test file
expects gcc or other working compiler to succeed, but 0.9.27 fails.

I did my best with a crude axe to at least allow it to compile,
and then test3 failed some diffs with about 7 sub-tests, so I
disabled it completely (delete line 16 of tests/Makefile).

test1b:
failed too, so I disabled it too, without looking into it.

dlltest:
fails with:
------------ dlltest with PIC ------------
./tcc2: symbol lookup error: ./libtcc2.so: undefined symbol: __va_start
make[2]: *** [Makefile:164: dlltest] Error 127

Disabled it too (deleted at tests/Makefile)

With test3, test1b, dlltest disabled at tests/Makefile,
this works with mob:

git clean -xfd
./configure --cc=$PWD/../tcc0927/bin/tcc --prefix=$PWD/../mob-pre
make
make test
make install


3. Finally, with this new mob-pre, we can build+test mob proper:

git reset --hard  # restore stock mob (with test3, test1b, dlltest)
git clean -xfd
./configure --cc=$PWD/../mob-pre/bin/tcc --prefix=$PWD/../mob
make
make test


--------------------

Conclusions:

- This is not ideal. It's hard to build 0.9.27 these days, and
  even once built, it fails some tests, and ignoring that, it can
  build current mob but some tests fail.

- Luckily, using this last "broken tests mob" build it is possible
  to build mob-proper with all tests passing.

What might be be ideal, IMVHO, is:

- A new release 0.9.27.1 with minimal diff from 0.9.27, which:
  - Could be built with modern compilers and pass (enabled) tests.
  - Preferably can be built and pass tests with tcc 0.9.26 too.
    - Or at least have a documented path to build from 0.9.26.
  - E.g. maybe just disable bcheck and asm-c-connect-test.

- That mob is modified to allow to be built and pass (Enabled) tests
  using a newly built tcc 0.9.27[.1]. This could be tricky, as
  I think it would have to be detected in configure tests or options,
  because tcc version has not changed for years, so hard to test...
  - maybe add a configure option --with-tcc-0-9-27 or some such.

- Finally, a new release (0.9.28 or 1.0, which can be built and
  pass tests using 0.9.27[.1]), because it's been years, and
  to serve as a new baseline to build future tcc versions.

Cheers,
- avih


reply via email to

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