Implement more toolchain fixes

This commit is contained in:
Justine Tunney 2023-06-18 05:39:31 -07:00
parent 0409096658
commit 226375933a
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
35 changed files with 69 additions and 31 deletions

View file

@ -139,6 +139,7 @@ int pipe(int[hasatleast 2]);
int pipe2(int[hasatleast 2], int);
int posix_fadvise(int, int64_t, int64_t, int);
int posix_madvise(void *, uint64_t, int);
int prctl(int, ...);
int raise(int);
int reboot(int);
int remove(const char *);
@ -211,7 +212,6 @@ int memfd_create(const char *, unsigned int);
int personality(uint64_t);
int pivot_root(const char *, const char *);
int pledge(const char *, const char *);
int prctl(int, ...);
int seccomp(unsigned, unsigned, void *);
int sys_iopl(int);
int sys_mlock(const void *, size_t);

View file

@ -30,6 +30,7 @@
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/libgen.h"
#include "libc/intrin/kprintf.h"
#include "libc/intrin/strace.internal.h"
#include "libc/macros.internal.h"

View file

@ -86,9 +86,6 @@ libcesque nosideeffect;
cosmopolitan § conversion » manipulation
*/
char *dirname(char *);
char *basename(char *);
#ifdef COSMO
char *stripext(char *);
char *stripexts(char *);

11
libc/fmt/libgen.h Normal file
View file

@ -0,0 +1,11 @@
#ifndef COSMOPOLITAN_LIBC_FMT_LIBGEN_H_
#define COSMOPOLITAN_LIBC_FMT_LIBGEN_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
char *dirname(char *);
char *basename(char *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_FMT_LIBGEN_H_ */

View file

@ -89,23 +89,21 @@
#endif
#ifndef __cplusplus
#pragma GCC push_options
#pragma GCC diagnostic ignored "-Wc++-compat"
#define HAVE_STDBOOL_H 1
#if __STDC_VERSION__ + 0 >= 201112
typedef _Bool bool;
#define true ((bool)+1)
#define false ((bool)+0)
#else
#define bool int
#endif
#define true 1
#define false 0
#endif
#endif
#ifndef __cplusplus
typedef __WCHAR_TYPE__ wchar_t;
typedef __CHAR16_TYPE__ char16_t;
typedef __CHAR32_TYPE__ char32_t;
#endif
#pragma GCC pop_options
#endif /* __cplusplus */
#define _LIBCPP_STDINT_H

View file

@ -396,6 +396,13 @@ privileged static size_t kformat(char *b, size_t n, const char *fmt,
*p++ = 'm';
ansi = 1;
}
#ifdef __x86_64__
} else if (IsLinux()) {
asm volatile("syscall"
: "=a"(x)
: "0"(__NR_getpid)
: "rcx", "rdx", "r11", "memory");
#endif
} else {
x = 666;
}

View file

@ -1,5 +1,4 @@
#ifndef _LIBGEN_H
#define _LIBGEN_H
#include "libc/fmt/conv.h"
#include "libc/fmt/libgen.h"
#endif /* _LIBGEN_H */

View file

@ -24,7 +24,6 @@ o/$(MODE)/libc: o/$(MODE)/libc/calls \
o/$(MODE)/libc/sock \
o/$(MODE)/libc/stdio \
o/$(MODE)/libc/str \
o/$(MODE)/libc/stubs \
o/$(MODE)/libc/sysv \
o/$(MODE)/libc/testlib \
o/$(MODE)/libc/thread \

View file

@ -18,13 +18,13 @@
*/
#include "libc/calls/blockcancel.internal.h"
#include "libc/calls/calls.h"
#include "libc/stdio/dprintf.h"
#include "libc/calls/struct/stat.h"
#include "libc/calls/struct/timeval.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/libgen.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/intrin/strace.internal.h"
@ -33,6 +33,7 @@
#include "libc/math.h"
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/dprintf.h"
#include "libc/stdio/lock.internal.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/fmt/conv.h"
#include "libc/fmt/libgen.h"
#include "libc/mem/gc.internal.h"
#include "libc/mem/mem.h"
#include "libc/x/x.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/fmt/conv.h"
#include "libc/fmt/libgen.h"
#include "libc/mem/mem.h"
#include "libc/x/x.h"