Introduce cosmocc flags -mdbg -mtiny -moptlinux

The cosmocc.zip toolchain will now include four builds of the libcosmo.a
runtime libraries. You can pass the -mdbg flag if you want to debug your
cosmopolitan runtime. You can pass the -moptlinux flag if you don't want
windows code lurking in your binary. See tool/cosmocc/README.md for more
details on how these flags may be used and their important implications.
This commit is contained in:
Justine Tunney 2024-07-26 05:10:25 -07:00
parent 59692b0882
commit 642e9cb91a
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
22 changed files with 404 additions and 56 deletions

View file

@ -17,7 +17,6 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/internal.h"
#include "libc/intrin/fds.h"
#include "libc/calls/syscall-nt.internal.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/calls/syscall_support-nt.internal.h"
@ -25,6 +24,7 @@
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/itoa.h"
#include "libc/intrin/fds.h"
#include "libc/intrin/strace.h"
#include "libc/mem/alloca.h"
#include "libc/nt/comms.h"
@ -52,6 +52,7 @@ static const char *DescribeFlush(char buf[12], int action) {
}
static dontinline textwindows int sys_tcflush_nt(int fd, int queue) {
#ifdef __x86_64__
if (!sys_isatty(fd)) {
return -1; // ebadf, enotty
}
@ -59,6 +60,9 @@ static dontinline textwindows int sys_tcflush_nt(int fd, int queue) {
return 0; // windows console output is never buffered
}
return FlushConsoleInputBytes();
#else
return enosys();
#endif
}
/**