[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] error: Unknown relocation type for got: 23 with -stat
From: |
Michael Matz |
Subject: |
Re: [Tinycc-devel] error: Unknown relocation type for got: 23 with -static |
Date: |
Wed, 3 Jun 2020 17:16:03 +0200 (CEST) |
User-agent: |
Alpine 2.21 (LSU 202 2017-01-01) |
Hello,
On Sun, 31 May 2020, Christian Jullien wrote:
I confirm! I tested this sample with mod on Debian RPi 4 armv7l and had a
similar error:
$ tcc -static foo.c
tcc: error: Unknown relocation type for got: 107
This, as well as Scotts problem, are relocations for thread local storage.
Several facilities of glibc (and other libc's) are implemented as thread
local variables (e.g. 'errno' is thread local, as well as some management
structures for the malloc implementation) and when linking statically all
of these are exposed to TCC.
TCC doesn't implement thread local storage, so that's why there's the
error. As long as that's the case static linking against glibc (or any
other library containing such variables) isn't going to work.
I have a patch somewhere that implements TLS at least for x86-64, maybe I
find time to dust it off over the next days. Until then: missing feature
in TCC with not workaround except not linking statically.
$ tcc foo.c
-hh help says:
-static link to static libraries (not recommended)
Why is it not recommended? Because it is not well supported or just because
shared lib, by ideology, is generally preferred?
I think the comment is indeed about the general recommendation to not link
statically. But it should be noted that linking statically against glibc
specifically is even more discouraged. I.e. even if you link most of an
executable statically glibc should stay as shared library dependency.
My OpenLisp comes in two flavors with gcc: static and shared. When speed
matters, I recommend the static one which is significantly faster.
A significant performance difference should only happen in fairly special
circumstances. Out of couriosity: do you happen to know which ones are
the case for you? (E.g. register reduction due to position independend
code on i386; or function call overhead for do-mostly-nothing functions;
or something else?)
Ciao,
Michael.
C.
-----Original Message-----
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org]
On Behalf Of John Scott
Sent: Saturday, May 30, 2020 16:55
To: tinycc-devel@nongnu.org
Subject: [Tinycc-devel] error: Unknown relocation type for got: 23 with
-static
Hi,
I was trying to do a build of Tor statically but ran into this issue with
current master and 0.9.27 package in Debian. I can reproduce with this:
#include <stdlib.h>
int main(){ char *p = NULL; free(p); }
and tcc -static gives the error. Is this a bug in tcc or elsewhere?
Sincerely,
John Scott
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
- Re: [Tinycc-devel] error: Unknown relocation type for got: 23 with -static,
Michael Matz <=