tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] [PATCH 0/3] Adjust linker-related command line options


From: remph
Subject: [Tinycc-devel] [PATCH 0/3] Adjust linker-related command line options
Date: Sun, 16 Feb 2025 16:56:42 +0000

Improves compatibility with other toolchains, and allows a single TCC
build/install to support multiple targets, eg. glibc and musl. Currently the
convention is to build/install TCC twice (see eg. tcc-musl on the AUR). A
hack[1] allows an existing TCC to partially support glibc and musl, with
caveats. For most compilers, to target musl I would run:

        cc -nostdinc -nostdlib -Wl,-nostdlib \
                -isystem /usr/lib/musl/include -L /usr/lib/musl/lib \
                -Wl,-I/lib/ld-musl-`uname -m`.so.1      \
                -l:crt1.o -l:crti.o [FILES...] -lc -l:crtn.o

These patches allow the above command line to work on TCC (obviously with -ltcc1
appended).

[1]: https://git.sr.ht/~remph/misc-scripts/tree/master/item/musl-tcc.sh

remph (3):
  Add -Wl,-I and -Wl,-dynamic-linker options
  Fix -Wl,-nostdlib behaviour for compatibility with other compilers
  Process linker directives beginning with a colon

 libtcc.c     | 53 +++++++++++++++++++++++++++++++++++-----------------
 tcc-doc.texi | 16 +++++++++++++---
 tcc.c        |  5 ++++-
 tcc.h        |  2 ++
 tccelf.c     |  4 +++-
 5 files changed, 58 insertions(+), 22 deletions(-)

-- 
2.48.1




reply via email to

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