UBSan conditional compilation
This commit is contained in:
@@ -2,12 +2,21 @@
|
|||||||
BUILDDIR := build
|
BUILDDIR := build
|
||||||
ELFFILE := pepperk
|
ELFFILE := pepperk
|
||||||
SRC := src
|
SRC := src
|
||||||
|
|
||||||
|
CC_PROBLEMATIC_FLAGS:=-Wno-unused-parameter -Wno-unused-variable
|
||||||
|
|
||||||
|
ifeq ($(UBSAN),true)
|
||||||
SOURCES := $(shell find src -name '*.c')
|
SOURCES := $(shell find src -name '*.c')
|
||||||
|
CC_PROBLEMATIC_FLAGS:= -fsanitize=undefined
|
||||||
|
else
|
||||||
|
SOURCES := $(shell find src -name '*.c')
|
||||||
|
SOURCES := $(filter-out src/security/ubsan.c, $(SOURCES))
|
||||||
|
endif
|
||||||
|
|
||||||
OBJFILES := $(patsubst $(SRC)/%.c, $(BUILDDIR)/%.o, $(SOURCES))
|
OBJFILES := $(patsubst $(SRC)/%.c, $(BUILDDIR)/%.o, $(SOURCES))
|
||||||
|
|
||||||
CC := x86_64-elf-gcc
|
CC := x86_64-elf-gcc
|
||||||
CC_FLAGS=-Wall -Wextra -std=gnu99 -nostdlib -ffreestanding -fstack-protector -fno-omit-frame-pointer -fno-stack-check -fno-PIC -ffunction-sections -fdata-sections -mcmodel=kernel
|
CC_FLAGS=-Wall -Wextra -std=gnu99 -nostdlib -ffreestanding -fstack-protector -fno-omit-frame-pointer -fno-stack-check -fno-PIC -ffunction-sections -fdata-sections -mcmodel=kernel
|
||||||
CC_PROBLEMATIC_FLAGS=-Wno-unused-parameter -Wno-unused-variable -fsanitize=undefined
|
|
||||||
|
|
||||||
LD := x86_64-elf-ld
|
LD := x86_64-elf-ld
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,20 @@ Compile the kernel and generate an ISO image like described above, then burn the
|
|||||||
sudo dd if=pepper.iso of=/dev/sdX
|
sudo dd if=pepper.iso of=/dev/sdX
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Compilation options
|
||||||
|
|
||||||
|
By default, PepperOS is compiled without the following features:
|
||||||
|
|
||||||
|
```
|
||||||
|
UBSAN - undefined behavior sanitization
|
||||||
|
```
|
||||||
|
|
||||||
|
These features can be activated by setting them to "true" at the end of the make command, for example:
|
||||||
|
|
||||||
|
```
|
||||||
|
make UBSAN=true
|
||||||
|
```
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
The basics that I'm targeting are:
|
The basics that I'm targeting are:
|
||||||
|
|||||||
Reference in New Issue
Block a user