OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Dec 12, 2017 10:18 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Abou Meaty Skeleton
PostPosted: Sat Nov 11, 2017 9:07 pm 
Offline

Joined: Wed Nov 01, 2017 7:41 pm
Posts: 19
So I compiled mah first kernel with success! But when reading http://wiki.osdev.org/Meaty_Skeleton#libc_and_libk and http://wiki.osdev.org/Hosted_GCC_Cross-Compiler I found a mistake.

in the first link we can see in libc's string.h:
Code:
#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


My question is about the include #include <sys/cdefs.h> where in the code I need to create this? Or this is provided by the compiler? Because in the Hosted GCC Cross-Compiler we can read:
Quote:
To 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().

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 Advice ;)

_________________
OS Development is awesome!

|AetherOS Project|


Top
 Profile  
 
 Post subject: Re: Abou Meaty Skeleton
PostPosted: Sat Nov 11, 2017 11:26 pm 
Offline
Member
Member

Joined: Mon Jan 03, 2011 6:58 pm
Posts: 277
Wiki wrote:
The standard headers use a BSD-like scheme where sys/cdefs.h declares a bunch of useful preprocessor macros meant for internal use by the standard library.

http://wiki.osdev.org/Meaty_Skeleton#libc_and_libk_Design

- Amy


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: MichaelPetch and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group