The cross toolchain now builds real hosted C++: std::string, vector, unique_ptr, iostreams and exceptions all work in a plain x86_64-montauk-g++ invocation with no special flags. This is the library that native cc1plus will link against for the GCC self-host. crt1 now runs .preinit_array/.init_array before main and hooks .fini_array through atexit (main returns via exit(), so destructors run on both exit paths). Global constructors and libgcc's eh_frame registration both ride this. GCC is reconfigured with --enable-initfini-array (modern arrays instead of .ctors), --with-newlib (satisfies libstdc++'s crossconfig for unknown hosts), --disable-wchar_t and --disable-libstdcxx-pch; the montauk gcc patch grows a hunk keeping os/generic ctype under --with-newlib (the Montauk libc is not newlib). libc additions harvested by the libstdc++ build: mbtowc/wctomb, strxfrm, strtok/strtok_r, a real vfscanf/fscanf/scanf (character- driven with widths and l/ll; also unblocks gprof later), fgetpos/ fsetpos/setbuf/fpos_t, modf plus the C99 float math variants (acosf..tanhf, hypot/hypotf as wrappers), FP_* classification macros, the full POSIX errno vocabulary, complete DT_* dirent types, and mbstate_t. The SDK ships the real libstdc++.a (was an empty stand-in), the C++ headers at 0:/sdk/include/c++, and cxx-test.elf (global ctor, string, vector+sort, unique_ptr, throw/catch; exits 0 on 5/5). Ramdisk sits at 1571 files, within the 2048 table. Co-Authored-By: Claude Fable 5 <[email protected]>
45 lines
1.4 KiB
C
45 lines
1.4 KiB
C
#ifndef _LIBC_STRING_H
|
|
#define _LIBC_STRING_H
|
|
|
|
#pragma once
|
|
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
void *memcpy(void *dest, const void *src, size_t n);
|
|
void *memset(void *s, int c, size_t n);
|
|
void *memmove(void *dest, const void *src, size_t n);
|
|
int memcmp(const void *s1, const void *s2, size_t n);
|
|
void *memchr(const void *s, int c, size_t n);
|
|
|
|
size_t strlen(const char *s);
|
|
size_t strspn(const char *s, const char *accept);
|
|
size_t strcspn(const char *s, const char *reject);
|
|
int strcmp(const char *s1, const char *s2);
|
|
int strncmp(const char *s1, const char *s2, size_t n);
|
|
char *strcpy(char *dest, const char *src);
|
|
char *strncpy(char *dest, const char *src, size_t n);
|
|
char *strcat(char *dest, const char *src);
|
|
char *strncat(char *dest, const char *src, size_t n);
|
|
char *strdup(const char *s);
|
|
char *strchr(const char *s, int c);
|
|
char *strrchr(const char *s, int c);
|
|
char *strpbrk(const char *s, const char *accept);
|
|
int strcasecmp(const char *s1, const char *s2);
|
|
int strncasecmp(const char *s1, const char *s2, size_t n);
|
|
int strcoll(const char *s1, const char *s2);
|
|
size_t strxfrm(char *dest, const char *src, size_t n);
|
|
char *strtok(char *str, const char *delim);
|
|
char *strtok_r(char *str, const char *delim, char **saveptr);
|
|
char *strstr(const char *haystack, const char *needle);
|
|
const char *strerror(int errnum);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _LIBC_STRING_H */
|