I want to statically compile a program with tcc. tcc complains with error: Unknown relocation type: 23
. This is apparently caused by my libc implementation (glibc 2.28-10) using thread-local storage to implement errno
, which tcc does not support. The program that I'd like to compile does not use threads, and so it would not be a problem if errno
was implemented as a global, which would fix it for tcc. Does anyone know if there's a libc implementation that can be configured to do this?
Asked
Active
Viewed 145 times
5

Tom
- 61
- 1
- 4
-
3why tcc? ----------- – 0___________ May 18 '21 at 22:12
-
why `-static`? What OS/environment? It's the OS in conjunction with the compiler that specifies how TLS is done. The _TL;DR:_ use `gcc` [and/or `clang`]. Or, try `tcc` _without_ `-static` – Craig Estey May 18 '21 at 23:21
-
tcc has many benefits over gcc/clang, including a [demonstrable defense](https://dwheeler.com/trusting-trust/) for the [trust problem](https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_ReflectionsonTrustingTrust.pdf). static linking also [has many benefits](http://harmful.cat-v.org/software/dynamic-linking/). Although these are large topics of discussion, that will quickly get off-topic here. – Tom May 19 '21 at 09:05