mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
Make kernel build with clang.
It's a bit faster than g++ and seems to generate perfectly fine code. The kernel is also roughly 10% smaller(!)
This commit is contained in:
parent
7b3b5f745f
commit
ebf308d413
10 changed files with 40 additions and 27 deletions
|
@ -55,19 +55,19 @@ BOOTLOADER = Boot/boot.bin
|
|||
IMAGE = .floppy-image
|
||||
ARCH_FLAGS =
|
||||
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib #-nostdinc
|
||||
KERNEL_FLAGS = -ffreestanding -fno-stack-protector -fno-ident
|
||||
KERNEL_FLAGS = -ffreestanding -fno-stack-protector -fno-ident -fno-builtin
|
||||
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings
|
||||
FLAVOR_FLAGS = -mregparm=3 -march=i386 -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.
|
||||
SUGGEST_FLAGS = -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override #-Wsuggest-attribute=noreturn
|
||||
#SUGGEST_FLAGS = -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override #-Wsuggest-attribute=noreturn
|
||||
|
||||
DEFINES = -DSERENITY -DKERNEL -DSANITIZE_PTRS
|
||||
|
||||
CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(KERNEL_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(SUGGEST_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
|
||||
#CXX = /usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-g++
|
||||
#LD = /usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-ld
|
||||
CXX = g++-8
|
||||
CXX = clang
|
||||
LD = ld
|
||||
LDFLAGS = -T linker.ld --strip-debug -melf_i386 --gc-sections --build-id=none -z norelro -z now
|
||||
|
||||
|
|
|
@ -52,7 +52,8 @@ private:
|
|||
PhysicalAddress m_paddr;
|
||||
};
|
||||
|
||||
struct PageDirectory {
|
||||
class PageDirectory {
|
||||
public:
|
||||
dword entries[1024];
|
||||
RetainPtr<PhysicalPage> physical_pages[1024];
|
||||
|
||||
|
@ -91,7 +92,8 @@ private:
|
|||
Vector<RetainPtr<PhysicalPage>> m_physical_pages;
|
||||
};
|
||||
|
||||
struct Region : public Retainable<Region> {
|
||||
class Region : public Retainable<Region> {
|
||||
public:
|
||||
Region(LinearAddress, size_t, String&&, bool r, bool w, bool cow = false);
|
||||
Region(LinearAddress, size_t, RetainPtr<VMObject>&&, size_t offset_in_vmo, String&&, bool r, bool w, bool cow = false);
|
||||
Region(LinearAddress, size_t, RetainPtr<VirtualFileSystem::Node>&&, String&&, bool r, bool w);
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "kmalloc.h"
|
||||
#include <AK/Types.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
void memcpy(void *dest, const void *src, DWORD n)
|
||||
{
|
||||
BYTE* bdest = (BYTE*)dest;
|
||||
|
@ -71,8 +73,10 @@ int memcmp(const void* v1, const void* v2, size_t n)
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern "C" void __cxa_pure_virtual() NORETURN;
|
||||
extern "C" void __cxa_pure_virtual()
|
||||
void __cxa_pure_virtual() NORETURN;
|
||||
void __cxa_pure_virtual()
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
void memcpy(void*, const void*, DWORD);
|
||||
void strcpy(char*, const char*);
|
||||
int strcmp(char const*, const char*);
|
||||
|
@ -10,3 +12,5 @@ void *memset(void*, BYTE, DWORD);
|
|||
char *strdup(const char*);
|
||||
int memcmp(const void*, const void*, size_t);
|
||||
char* strrchr(const char* str, int ch);
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ extern "C" void syscall_entry(RegisterDump&);
|
|||
extern "C" void syscall_ISR();
|
||||
extern volatile RegisterDump* syscallRegDump;
|
||||
|
||||
asm volatile(
|
||||
asm(
|
||||
".globl syscall_ISR \n"
|
||||
"syscall_ISR:\n"
|
||||
" pusha\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue