mirror of
git://repo.or.cz/tinycc.git
synced 2026-11-04 21:26:36 +08:00
tccelf: Fix static linking with musl
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-arm64-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled
build and test / test-i386-linux (push) Has been cancelled
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-arm64-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled
build and test / test-i386-linux (push) Has been cancelled
tccelf.c:
- tcc_add_runtime()
Add a second tcc_add_library(s1, "c"). The libtcc1.a references at
least abort() from the C library. After libtcc1.a the libc.a needs
to be linked again to resolve abort(). For similar reasons gcc
passes --start-group -lgcc -lc --end-group to the linker.
This solves:
./configure '--sysincludepaths=<musl>/include:{B}/include' \
'--libpaths={B}:<musl>/lib' \
'--crtprefix=<musl>/lib' \
'--tcc-switches=-static'
make -j
make test
…
------------ hello-exe ------------
tcc: error: unresolved reference to 'abort'
This commit is contained in:
parent
9db1105c32
commit
43c7708b85
4
tccelf.c
4
tccelf.c
@ -1873,8 +1873,10 @@ ST_FUNC void tcc_add_runtime(TCCState *s1)
|
||||
#if defined TCC_TARGET_ARM && TARGETOS_FreeBSD
|
||||
tcc_add_library(s1, "gcc_s"); // unwind code
|
||||
#endif
|
||||
if (TCC_LIBTCC1[0])
|
||||
if (TCC_LIBTCC1[0]) {
|
||||
tcc_add_support(s1, TCC_LIBTCC1);
|
||||
tcc_add_library(s1, "c");
|
||||
}
|
||||
#ifndef TCC_TARGET_MACHO
|
||||
if (s1->output_type != TCC_OUTPUT_MEMORY)
|
||||
tccelf_add_crtend(s1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user