1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:57:47 +00:00

More compat work. Rename libraries from LibFoo.a => libfoo.a

This makes it more straightforward to build a cross-compiler toolchain.
Also move math stuff from LibC to LibM.
This commit is contained in:
Andreas Kling 2019-02-26 13:30:57 +01:00
parent cccc8d8aeb
commit 3f29a12d90
23 changed files with 140 additions and 79 deletions

2
LibC/.gitignore vendored
View file

@ -1,4 +1,4 @@
*.o
*.no
*.d
LibC.a
libc.a

View file

@ -32,7 +32,6 @@ LIBC_OBJS = \
ulimit.o \
qsort.o \
ioctl.o \
math.o \
utime.o \
sys/select.o \
sys/socket.o \
@ -45,7 +44,7 @@ ASM_OBJS = setjmp.no
CPP_OBJS = $(AK_OBJS) $(WIDGETS_OBJS) $(LIBC_OBJS)
LIBRARY = LibC.a
LIBRARY = libc.a
STANDARD_FLAGS = -std=c++17
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -fno-exceptions -fno-rtti

13
LibC/fd_set.h Normal file
View file

@ -0,0 +1,13 @@
#pragma once
#define FD_SETSIZE 64
#define FD_ZERO(set) memset((set), 0, sizeof(fd_set));
#define FD_CLR(fd, set) ((set)->bits[(fd / 8)] &= ~(1 << (fd) % 8))
#define FD_SET(fd, set) ((set)->bits[(fd / 8)] |= (1 << (fd) % 8))
#define FD_ISSET(fd, set) ((set)->bits[(fd / 8)] & (1 << (fd) % 8))
struct __fd_set {
unsigned char bits[FD_SETSIZE / 8];
};
typedef struct __fd_set fd_set;

View file

@ -1,5 +1,7 @@
#!/bin/bash
mkdir -p ../Root/usr/include/sys/
mkdir -p ../Root/usr/lib/
cp *.h ../Root/usr/include/
cp sys/*.h ../Root/usr/include/sys/
cp libc.a ../Root/usr/lib/

View file

@ -1,14 +0,0 @@
#include <math.h>
#include <assert.h>
extern "C" {
double pow(double x, double y)
{
(void) x;
(void) y;
assert(false);
}
}

View file

@ -1,57 +0,0 @@
#pragma once
#include <sys/cdefs.h>
__BEGIN_DECLS
#define HUGE_VAL 1e10000
double acos(double);
float acosf(float);
double asin(double);
float asinf(float);
double atan(double);
float atanf(float);
double atan2(double, double);
float atan2f(float, float);
double cos(double);
float cosf(float);
double cosh(double);
float coshf(float);
double sin(double);
float sinf(float);
double sinh(double);
float sinhf(float);
double tan(double);
float tanf(float);
double tanh(double);
float tanhf(float);
double ceil(double);
float ceilf(float);
double floor(double);
float floorf(float);
double round(double);
float roundf(float);
double fabs(double);
float fabsf(float);
double fmod(double, double);
float fmodf(float, float);
double exp(double);
float expf(float);
double frexp(double, int* exp);
float frexpf(float, int* exp);
double log(double);
float logf(float);
double log10(double);
float log10f(float);
double sqrt(double);
float sqrtf(float);
double modf(double, double*);
float modff(float, float*);
double ldexp(double, int exp);
float ldexpf(float, int exp);
double pow(double x, double y);
__END_DECLS

View file

@ -3,21 +3,10 @@
#include <sys/cdefs.h>
#include <sys/types.h>
#include <string.h>
#include <fd_set.h>
__BEGIN_DECLS
#define FD_SETSIZE 64
#define FD_ZERO(set) memset((set), 0, sizeof(fd_set));
#define FD_CLR(fd, set) ((set)->bits[(fd / 8)] &= ~(1 << (fd) % 8))
#define FD_SET(fd, set) ((set)->bits[(fd / 8)] |= (1 << (fd) % 8))
#define FD_ISSET(fd, set) ((set)->bits[(fd / 8)] & (1 << (fd) % 8))
struct __fd_set {
unsigned char bits[FD_SETSIZE / 8];
};
typedef struct __fd_set fd_set;
int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, struct timeval* timeout);
__END_DECLS