in the first link we can see in libc's string.h:
Code: Select all
#ifndef _STRING_H
#define _STRING_H 1
#include <sys/cdefs.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
int memcmp(const void*, const void*, size_t);
void* memcpy(void* __restrict, const void* __restrict, size_t);
void* memmove(void*, const void*, size_t);
void* memset(void*, int, size_t);
size_t strlen(const char*);
#ifdef __cplusplus
}
#endif
#endif
So, these imports are provided by the compiler or I have to write all of them? If I need to write all of them, how? Thanks in AdviceTo correctly complete this tutorial, your libc must need particular minimum requirements. The libgcc will be built with libc support, meaning that your libc needs a few standard headers that define particular types, constants and functions. In particular, you need to supply:
sys/types.h: This header is just required to exist and can be empty.
errno.h: This header is just required to exist and can be empty.
stdlib.h: abort(), free(), malloc().
stdio.h: FILE, stderr, fflush(), fprintf().
string.h: size_t, memcpy, memset(), strlen().
time.h: This header is just required to exist and can be empty.
unistd.h: This header is just required to exist and can be empty.
Additionally, the all-target-libgcc target also unconditionally builds the libgcov support library, which has these additional requirements:
sys/types.h: pid_t.
stdlib.h: atexit(), atoi(), getenv().
stdio.h: size_t, SEEK_SET, fclose(), fopen(), fread(), fseek(), ftell(), fwrite(), setbuf(), vfprintf().
string.h: strcpy().
unistd.h: pid_t, fork(), execv(), execve(), execvp().