summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-07-14 16:19:58 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-07-14 16:19:58 +0200
commitec0810b91aba837f684ed15f0b8abfb03299f661 (patch)
tree42d8e318d5cb084d9103f569c442be6841305b5b /tests
parentf31f7960bd260cb90ffdd766393d51bd85a547d1 (diff)
downloadabaos-ec0810b91aba837f684ed15f0b8abfb03299f661.tar.gz
abaos-ec0810b91aba837f684ed15f0b8abfb03299f661.tar.bz2
some linkage tweaking, the kernel is not linked against libssp (which
is using linux/glibc), we provide our own SSP guards leading to kernel_panic (for now). per default build the kernel with ld (as we need precise control how we link it) the libc tests are per default linked with the same compiler as provided with $(CC) using #include_next of gcc/clang to include the real stdint.h header file in stdint.h stub
Diffstat (limited to 'tests')
-rw-r--r--tests/libc/Makefile4
-rw-r--r--tests/libc/kernel_stub.c7
-rw-r--r--tests/libc/kernel_stub.h9
3 files changed, 18 insertions, 2 deletions
diff --git a/tests/libc/Makefile b/tests/libc/Makefile
index d9d2927..2d89940 100644
--- a/tests/libc/Makefile
+++ b/tests/libc/Makefile
@@ -2,8 +2,8 @@ CC := gcc
DEFINES = -DOS_LINUX
INCLUDES = -I. -I../../src/libc -I../../src/kernel -I/home/abaumann/cross-compilers/include
CFLAGS := -std=c99 -m32 -ffreestanding -O0 -g -Wall -Werror $(INCLUDES) $(DEFINES)
-LD := ld
-LDFLAGS :=
+LD := $(CC)
+LDFLAGS :=
NASMFLAGS := -f elf32
NASM := nasm
diff --git a/tests/libc/kernel_stub.c b/tests/libc/kernel_stub.c
index 610c3d3..cacab34 100644
--- a/tests/libc/kernel_stub.c
+++ b/tests/libc/kernel_stub.c
@@ -22,3 +22,10 @@ void kernel_panic( const char *format, ... )
exit( 255 );
}
+uintptr_t __stack_chk_guard = STACK_CHK_GUARD;
+
+__attribute__( ( noreturn ) )
+void __stack_chk_fail_local( void )
+{
+ abort( );
+}
diff --git a/tests/libc/kernel_stub.h b/tests/libc/kernel_stub.h
index 467ad20..65047f9 100644
--- a/tests/libc/kernel_stub.h
+++ b/tests/libc/kernel_stub.h
@@ -24,4 +24,13 @@ long syscall1( long n, long a1 );
long syscall2( long n, long a1, long a2 );
long syscall3( long n, long a1, long a2, long a3 );
+// SSP stub, we don't want to link against libssp
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#define STACK_CHK_GUARD 0xe2dee396
+
+extern uintptr_t __stack_chk_guard;
+
#endif