start writing STDC functions that are necessary for correct linking.
gcc will optimise calls to these four functions, and requires definitions to these funcitons. It is better to let it make these optimisations, rather than disabling this functionality with the `-nostdc` flag.
This commit is contained in:
4
src/atrb.h
Normal file
4
src/atrb.h
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define restrict __restrict__
|
||||||
|
#endif
|
||||||
10
src/string.c
Normal file
10
src/string.c
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
int memcmp(const void *s1, const void *s2, usize n) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void *memset(void *s, int c, usize n) { }
|
||||||
|
|
||||||
|
void *memcpy(void *restrict dst, const void *restrict src, usize n) { }
|
||||||
|
|
||||||
|
void *memmove(void *dst, const void *src, usize n) { }
|
||||||
8
src/string.h
Normal file
8
src/string.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "types.h"
|
||||||
|
#include "atrb.h"
|
||||||
|
|
||||||
|
int memcmp(const void *s1, const void *s2, usize n);
|
||||||
|
void *memset(void *s, int c, usize n);
|
||||||
|
void *memcpy(void *restrict dst, const void *restrict src, usize n);
|
||||||
|
void *memmove(void *dst, const void *src, usize n);
|
||||||
Reference in New Issue
Block a user