[build] Update to using pb 3

Updating the build to the new version of bonnibel. This also includes
some updates to make sure things keep working with LLVM 11.
This commit is contained in:
Justin C. Miller
2021-02-28 01:16:27 -08:00
parent e05e05b13a
commit 0ae489f49d
18 changed files with 535 additions and 424 deletions

View File

@@ -10,24 +10,25 @@ SECTIONS
}
.text ALIGN(4096) : {
*(.text)
*(.isrs)
*(.text*)
KEEP(*(.isrs))
}
.data ALIGN(4096) : {
*(.data)
*(.rodata)
*(.data*)
*(.rodata*)
}
.ctors : ALIGN(8) {
__ctors = .;
KEEP(*(.ctors))
KEEP(*(.init_array))
__ctors_end = .;
}
.bss ALIGN(4096) : {
__bss_start = .;
*(.bss)
*(.bss*)
__bss_end = .;
}

17
src/boot/module.toml Normal file
View File

@@ -0,0 +1,17 @@
name = "boot"
kind = "exe"
output = "boot.efi"
targets = ["boot"]
deps = ["cpu"]
sources = [
"main.cpp",
"console.cpp",
"error.cpp",
"fs.cpp",
"hardware.cpp",
"loader.cpp",
"memory.cpp",
"paging.cpp",
"status.cpp",
"support.cpp",
]

View File

@@ -0,0 +1,10 @@
name = "fb"
targets = ["user"]
deps = ["libc"]
sources = [
"font.cpp",
"main.cpp",
"screen.cpp",
"scrollback.cpp",
]

View File

@@ -0,0 +1,8 @@
name = "nulldrv"
targets = ["user"]
deps = ["libc"]
sources = [
"io.cpp",
"main.cpp",
"serial.cpp",
]

View File

@@ -1,48 +0,0 @@
#pragma once
/* elf.h - basic defines for external code written assuming <elf.h> works. Only
* Elf64 values are included.
*/
typedef uint16_t Elf64_Half;
typedef uint32_t Elf64_Word;
typedef int32_t Elf64_Sword;
typedef uint64_t Elf64_Xword;
typedef int64_t Elf64_Sxword;
typedef uint64_t Elf64_Addr;
typedef uint64_t Elf64_Off;
typedef uint16_t Elf64_Section;
typedef Elf64_Half Elf64_Versym;
typedef struct {
Elf64_Addr r_offset;
Elf64_Xword r_info;
} Elf64_Rel;
typedef struct {
Elf64_Addr r_offset;
Elf64_Word r_info;
Elf64_Sword r_addend;
} Elf64_Rela;
typedef struct {
Elf64_Sxword d_tag;
union {
Elf64_Xword d_val;
Elf64_Addr d_ptr;
} d_un;
} Elf64_Dyn;
#define ELF64_R_TYPE(x) ((x) & 0xffffffff)
typedef enum {
DT_NULL = 0,
DT_RELA = 7,
DT_RELASZ = 8,
DT_RELAENT = 9
} ElfDynTag;
typedef enum {
R_X86_64_NONE = 0,
R_X86_64_RELATIVE = 8
} Elf_x86_64_RelType;

56
src/kernel/module.toml Normal file
View File

@@ -0,0 +1,56 @@
name = "kernel"
kind = "exe"
output = "jsix.elf"
targets = ["kernel"]
deps = ["kutil", "cpu"]
includes = ["src/kernel"]
sources = [
"apic.cpp",
"ap_startup.s",
"assert.cpp",
"boot.s",
"clock.cpp",
"console.cpp",
"cpprt.cpp",
"cpu.cpp",
"debug.cpp",
"debug.s",
"device_manager.cpp",
"frame_allocator.cpp",
"gdt.cpp",
"gdtidt.s",
"hpet.cpp",
"idt.cpp",
"interrupts.cpp",
"interrupts.s",
"io.cpp",
"log.cpp",
"main.cpp",
"memory_bootstrap.cpp",
"msr.cpp",
"objects/channel.cpp",
"objects/endpoint.cpp",
"objects/kobject.cpp",
"objects/thread.cpp",
"objects/process.cpp",
"objects/system.cpp",
"objects/vm_area.cpp",
"page_table.cpp",
"page_tree.cpp",
"pci.cpp",
"scheduler.cpp",
"serial.cpp",
"symbol_table.cpp",
"syscall.cpp",
"syscall.s",
"syscalls/channel.cpp",
"syscalls/endpoint.cpp",
"syscalls/object.cpp",
"syscalls/process.cpp",
"syscalls/system.cpp",
"syscalls/thread.cpp",
"syscalls/vm_area.cpp",
"task.s",
"tss.cpp",
"vm_space.cpp",
]

View File

@@ -0,0 +1,4 @@
name = "cpu"
kind = "lib"
includes = ["src/libraries/cpu/include"]
sources = ["cpu_id.cpp"]

View File

@@ -0,0 +1,4 @@
name = "j6"
kind = "lib"
includes = ["src/libraries/j6/include"]
sources = ["syscalls.s"]

View File

@@ -0,0 +1,12 @@
name = "kutil"
kind = "lib"
includes = [ "src/libraries/kutil/include" ]
sources = [
"assert.cpp",
"bip_buffer.cpp",
"heap_allocator.cpp",
"logger.cpp",
"memory.cpp",
"printf.c",
"spinlock.cpp",
]

View File

@@ -0,0 +1,178 @@
name = "libc"
kind = "lib"
output = "libc.a"
includes = "src/libraries/libc/include"
deps = ["j6"]
sources = [
"arch/x86_64/_Exit.s",
"arch/x86_64/crt0.s",
"arch/x86_64/init_libc.c",
"ctype/isalnum.c",
"ctype/isalpha.c",
"ctype/isblank.c",
"ctype/iscntrl.c",
"ctype/isdigit.c",
"ctype/isgraph.c",
"ctype/islower.c",
"ctype/isprint.c",
"ctype/ispunct.c",
"ctype/isspace.c",
"ctype/isupper.c",
"ctype/isxdigit.c",
"ctype/tolower.c",
"ctype/toupper.c",
"inttypes/imaxabs.c",
"inttypes/imaxdiv.c",
"inttypes/strtoimax.c",
"inttypes/strtoumax.c",
"locale/localeconv.c",
"locale/setlocale.c",
"j6libc/assert.c",
"j6libc/errno.c",
"j6libc/allocpages.c",
"j6libc/atomax.c",
"j6libc/closeall.c",
"j6libc/close.c",
"j6libc/digits.c",
"j6libc/filemode.c",
"j6libc/fillbuffer.c",
"j6libc/flushbuffer.c",
"j6libc/is_leap.c",
"j6libc/load_lc_collate.c",
"j6libc/load_lc_ctype.c",
"j6libc/load_lc_messages.c",
"j6libc/load_lc_monetary.c",
"j6libc/load_lc_numeric.c",
"j6libc/load_lc_time.c",
"j6libc/load_lines.c",
"j6libc/open.c",
"j6libc/prepread.c",
"j6libc/prepwrite.c",
"j6libc/print.c",
"j6libc/rename.c",
"j6libc/scan.c",
"j6libc/seed.c",
"j6libc/seek.c",
"j6libc/stdinit.c",
"j6libc/strtox_main.c",
"j6libc/strtox_prelim.c",
"j6libc/sbrk.c",
"signal/raise.c",
"signal/signal.c",
"stdio/clearerr.c",
"stdio/fclose.c",
"stdio/feof.c",
"stdio/ferror.c",
"stdio/fflush.c",
"stdio/fgetc.c",
"stdio/fgetpos.c",
"stdio/fgets.c",
"stdio/fopen.c",
"stdio/fprintf.c",
"stdio/fputc.c",
"stdio/fputs.c",
"stdio/fread.c",
"stdio/freopen.c",
"stdio/fscanf.c",
"stdio/fseek.c",
"stdio/fsetpos.c",
"stdio/ftell.c",
"stdio/fwrite.c",
"stdio/getc.c",
"stdio/getchar.c",
"stdio/perror.c",
"stdio/printf.c",
"stdio/putc.c",
"stdio/putchar.c",
"stdio/puts.c",
"stdio/remove.c",
"stdio/rename.c",
"stdio/rewind.c",
"stdio/scanf.c",
"stdio/setbuf.c",
"stdio/setvbuf.c",
"stdio/snprintf.c",
"stdio/sprintf.c",
"stdio/sscanf.c",
"stdio/tmpfile.c",
"stdio/tmpnam.c",
"stdio/ungetc.c",
"stdio/vfprintf.c",
"stdio/vfscanf.c",
"stdio/vprintf.c",
"stdio/vscanf.c",
"stdio/vsnprintf.c",
"stdio/vsprintf.c",
"stdio/vsscanf.c",
"stdlib/abort.c",
"stdlib/abs.c",
"stdlib/atexit.c",
"stdlib/atoi.c",
"stdlib/atol.c",
"stdlib/atoll.c",
"stdlib/bsearch.c",
"stdlib/div.c",
"stdlib/exit.c",
"stdlib/_Exit.c",
"stdlib/getenv.c",
"stdlib/labs.c",
"stdlib/ldiv.c",
"stdlib/llabs.c",
"stdlib/lldiv.c",
"stdlib/malloc.c",
"stdlib/qsort.c",
"stdlib/rand.c",
"stdlib/srand.c",
"stdlib/strtol.c",
"stdlib/strtoll.c",
"stdlib/strtoul.c",
"stdlib/strtoull.c",
"stdlib/system.c",
"string/memchr.c",
"string/memcmp.c",
"string/memcpy.c",
"string/memmove.c",
"string/memset.c",
"string/strcat.c",
"string/strchr.c",
"string/strcmp.c",
"string/strcoll.c",
"string/strcpy.c",
"string/strcspn.c",
"string/strerror.c",
"string/strlen.c",
"string/strncat.c",
"string/strncmp.c",
"string/strncpy.c",
"string/strpbrk.c",
"string/strrchr.c",
"string/strspn.c",
"string/strstr.c",
"string/strtok.c",
"string/strxfrm.c",
"time/asctime.c",
"time/clock.c",
"time/ctime.c",
"time/difftime.c",
"time/gmtime.c",
"time/localtime.c",
"time/mktime.c",
"time/strftime.c",
"time/time.c",
"time/timespec_get.c",
]
[variables]
ccflags = [
"${ccflags}",
"-DDISABLE_SSE",
"-DLACKS_UNISTD_H",
"-DLACKS_FCNTL_H",
"-DLACKS_SYS_PARAM_H",
"-DLACKS_SYS_MMAN_H",
"-DLACKS_SCHED_H",
"-DLACKS_STRINGS_H",
"-DHAVE_MMAP=0",
]