Build LibC and Userland with clang as well.

This commit is contained in:
Andreas Kling 2018-11-09 14:29:00 +01:00
parent ebf308d413
commit 4914f3b837
8 changed files with 46 additions and 37 deletions

View file

@ -46,6 +46,36 @@ void* kmalloc_eternal(size_t size)
}
void* operator new(size_t size)
{
return kmalloc(size);
}
void* operator new[](size_t size)
{
return kmalloc(size);
}
void operator delete(void* ptr)
{
return kfree(ptr);
}
void operator delete[](void* ptr)
{
return kfree(ptr);
}
void operator delete(void* ptr, size_t)
{
return kfree(ptr);
}
void operator delete[](void* ptr, size_t)
{
return kfree(ptr);
}
#else
extern "C" {

View file

@ -27,36 +27,6 @@ void* kmalloc_eternal(size_t) MALLOC_ATTR;
}
inline void* operator new(size_t size)
{
return kmalloc(size);
}
inline void* operator new[](size_t size)
{
return kmalloc(size);
}
inline void operator delete(void* ptr)
{
return kfree(ptr);
}
inline void operator delete[](void* ptr)
{
return kfree(ptr);
}
inline void operator delete(void* ptr, size_t)
{
return kfree(ptr);
}
inline void operator delete[](void* ptr, size_t)
{
return kfree(ptr);
}
inline void* operator new(size_t, void* p) { return p; }
inline void* operator new[](size_t, void* p) { return p; }
#endif

View file

@ -34,14 +34,14 @@ ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
LIBC_FLAGS = -ffreestanding -fno-stack-protector -fno-ident
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings
FLAVOR_FLAGS = -fomit-frame-pointer -mregparm=3 -march=i386 -m32 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -fmerge-all-constants -fno-unroll-loops -falign-functions=1 -falign-jumps=1 -falign-loops=1 -fno-pie -fno-pic
OPTIMIZATION_FLAGS = -Os -fno-asynchronous-unwind-tables
FLAVOR_FLAGS = -fomit-frame-pointer -mregparm=3 -march=i386 -m32 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -fmerge-all-constants -fno-unroll-loops -fno-pie -fno-pic
OPTIMIZATION_FLAGS = -Oz -fno-asynchronous-unwind-tables
INCLUDE_FLAGS = -I.. -I.
DEFINES = -DSERENITY -DUSERLAND -DSANITIZE_PTRS
CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(LIBC_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = g++-8
CXX = clang
LD = ld
AR = ar
LDFLAGS = -T linker.ld --strip-debug -melf_i386 --gc-sections --build-id=none -z norelro -z now

View file

@ -16,3 +16,6 @@
#undef __P
#define __P(a) a
extern "C" int main(int, char**);

View file

@ -45,13 +45,13 @@ STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
USERLAND_FLAGS = -ffreestanding -fno-stack-protector -fno-ident
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings
FLAVOR_FLAGS = -march=i386 -mregparm=3 -m32 -fno-exceptions -fno-rtti -fmerge-all-constants -fno-unroll-loops -fno-pie -fno-pic
OPTIMIZATION_FLAGS = -Os -fno-asynchronous-unwind-tables
OPTIMIZATION_FLAGS = -Oz -fno-asynchronous-unwind-tables
INCLUDE_FLAGS = -I.. -I. -I../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = g++-8
CXX = clang
LD = ld
AR = ar
LDFLAGS = -static --strip-debug -melf_i386 --build-id=none -z norelro -z now -e _start --gc-sections

View file

@ -1,4 +1,6 @@
int main()
#include <sys/cdefs.h>
int main(int, char**)
{
return 1;
}

View file

@ -4,6 +4,8 @@
#include <grp.h>
#include <alloca.h>
extern "C" int main(int, char**);
int main(int argc, char** argv)
{
(void) argc;

View file

@ -1,4 +1,6 @@
int main()
#include <sys/cdefs.h>
int main(int, char**)
{
return 0;
}