Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compile when using tcc >0.9.27 on Linux
This allows ksh to be compiled with versions of tcc that define __dso_handle in libtcc1.a[*], although only on Linux. The two problems that remain are the following: 1) Older versions of tcc still fail to compile ksh, although now they fail after reaching the libdll feature test. I'm not sure if fixing that is feasible since even if I hack out the failing libdll feature test, ksh fails to link with a '__dso_handle' error. 2) tcc fails to build ksh on FreeBSD. For some reason tcc imitates GCC on FreeBSD but not on Linux. As a result the FreeBSD math.h header tries to define macros that call GCC/Clang builtins. This results in undefined symbol errors since tcc doesn't have those builtins. src/cmd/INIT/iffe.sh: compile(): - tcc forbids combining the -c compiler flag with -l* linker flags. Strip all -l* flags when -c was passed to the compiler. This is only done when tcc is the compiler to prevent build failures on some platforms (such as illumos). src/lib/libast/comp/atexit.c, src/lib/libast/features/lib, src/lib/libast/vmalloc/vmexit.c: - From what I've been able to gather the only OSes with support for on_exit are Linux and SunOS 4. However, on_exit takes two arguments, so the macro that defines it as taking one argument is incorrect. Since Solaris (SunOS 5) no longer has this call and the macro breaks on Linux, the clean fix is to remove it (atexit(3) is used instead). [*]: https://repo.or.cz/tinycc.git/commit/dd60b20c6e0d01df8e332b0234125abaa964d324 Progresses: ksh93#232
- Loading branch information