[Top][All Lists]

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

Re: [Tinycc-devel] Add support of musl-libc to tinycc

From: Michael Matz
Subject: Re: [Tinycc-devel] Add support of musl-libc to tinycc
Date: Sun, 7 May 2017 08:16:08 +0200 (CEST)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)


On Sat, 6 May 2017, Larry Doolittle wrote:

Micheal, Marc, and tinycc lurkers -

On Sun, May 07, 2017 at 04:54:38AM +0200, Michael Matz wrote:
On Thu, 20 Apr 2017, Marc Vertes wrote:
I just committed the patch to support musl-libc in the tcc
compiler development branch: http://repo.or.cz/w/tinycc.git
Dear tinycc developers, let me know if this feature can be added
to the upcoming 0.9.27 version, and also how to fix the DLL
bootstrap problem.
Fixed in mob.  The problem is the stricter dynamic loader of musl,
which ignores all STB_LOCAL symbols for symbol resolution [...]
With that the tests also run on musl.  [...]

On Debian Jessie amd64 with musl-dev installed, tinycc (commit 5732a188)
detects that musl exists (CONFIG_musl=yes in config.mak), builds OK, but
fails on make test at dlltest:

./tcc2 -B.. -I/home/larry/git/tinycc/include -I/home/larry/git/tinycc -I.. 
-DCONFIG_TRIPLET="\"x86_64-linux-gnu\"" -DTCC_TARGET_X86_64 -DTCC_MUSL 
-DONE_SOURCE -run /home/larry/git/tinycc/tcc.c -B.. -I/home/larry/git/tinycc/include 
-I/home/larry/git/tinycc -I.. -run /home/larry/git/tinycc/examples/ex1.c
/usr/lib/x86_64-linux-gnu/libc.so:2: error: unrecognized file type
tcc: error: Unknown relocation type: 23

On debain, if you have libc6-dev and musl-dev installed you get a strange mix of glibc and musl objects and shared libraries linked into the exe. E.g. in the above it picks up /usr/lib/x86_64-linux-gnu/libc.a (from glibc), which has TPOFF32 relocs and those aren't handled by TCC.

Removing libc6-dev, installing musl-tools, and using musl-gcc for compilation ensures that there's no mixture at least. But that then fails because TCC itself isn't prepared to look into e.g. /usr/include/x86_64-linux-musl for standard headers like e.g. stdio.h, neither does it look into /usr/lib/x86_64-linux-musl/ for startup files like crt1.o. So, yeah, the detection/support of musl is early and doesn't work with the split-mind approach that debian is using.

It does work for the setup of musl as the main libc, like with alpine linux; so I'm not sure the detection should be disabled or rather be improved (or there should perhaps be a configure option to override the detection by users).

I just made a quick attempt to build gcc-4.7.4 with current git tcc.
It made it through about 337 compiles before failing on
../.././gcc/c-family/c-opts.c:141: error: ';' expected (got "=")

Yeah, thanks for finding the cause downthread. extern file-scope declarations with initializer are questionable style but indeed allowed by the standard, i.e. the above rejection is a bug in TCC. Fixed in mob.


reply via email to

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