From 1207a4cecd0918a3808bf22de517382b676ca12f Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Mon, 11 May 2015 17:25:27 +0200 Subject: [PATCH] fiasco: remove 'const' GCC attribute from some functions Some functions in the kernel, which create a static object and return its address, are declared with a GCC 'const' attribute, which can cause GCC 4.9 to optimize the function call out and use the static object's address without calling the constructor. Fixes #1509 --- repos/base-fiasco/patches/fiasco_const.patch | 39 ++++++++++++++++++++ repos/base-fiasco/ports/fiasco.hash | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 repos/base-fiasco/patches/fiasco_const.patch diff --git a/repos/base-fiasco/patches/fiasco_const.patch b/repos/base-fiasco/patches/fiasco_const.patch new file mode 100644 index 000000000..e15ca34e3 --- /dev/null +++ b/repos/base-fiasco/patches/fiasco_const.patch @@ -0,0 +1,39 @@ +diff --git fiasco/snapshot/kernel/fiasco/src/kern/kernel_console.cpp fiasco/snapshot/kernel/fiasco/src/kern/kernel_console.cpp +index ea632ce..4d88354 100644 +--- fiasco/snapshot/kernel/fiasco/src/kern/kernel_console.cpp ++++ fiasco/snapshot/kernel/fiasco/src/kern/kernel_console.cpp +@@ -9,7 +9,7 @@ public: + int getchar( bool blocking = true ); + void getchar_chance(); + +- static Mux_console *console() FIASCO_CONST; ++ static Mux_console *console(); + + private: + static bool initialized; +diff --git fiasco/snapshot/kernel/fiasco/src/kern/kernel_uart.cpp fiasco/snapshot/kernel/fiasco/src/kern/kernel_uart.cpp +index 42efe5c..0efb426 100644 +--- fiasco/snapshot/kernel/fiasco/src/kern/kernel_uart.cpp ++++ fiasco/snapshot/kernel/fiasco/src/kern/kernel_uart.cpp +@@ -39,7 +39,7 @@ IMPLEMENTATION [serial]: + #include "config.h" + #include "panic.h" + +-PUBLIC static FIASCO_CONST ++PUBLIC static + Uart * + Kernel_uart::uart() + { +diff --git fiasco/snapshot/kernel/fiasco/src/kern/map_util-mem.cpp fiasco/snapshot/kernel/fiasco/src/kern/map_util-mem.cpp +index 2363e65..43d9d8d 100644 +--- fiasco/snapshot/kernel/fiasco/src/kern/map_util-mem.cpp ++++ fiasco/snapshot/kernel/fiasco/src/kern/map_util-mem.cpp +@@ -128,7 +128,7 @@ save_access_attribs (Mapdb* mapdb, const Mapdb::Frame& mapdb_frame, + // Mapdb instance for memory mappings + // + +-Mapdb * mapdb_instance() FIASCO_CONST; ++Mapdb * mapdb_instance(); + + //--------------------------------------------------------------------------- + IMPLEMENTATION[!64bit]: diff --git a/repos/base-fiasco/ports/fiasco.hash b/repos/base-fiasco/ports/fiasco.hash index c9f8558a0..218bec585 100644 --- a/repos/base-fiasco/ports/fiasco.hash +++ b/repos/base-fiasco/ports/fiasco.hash @@ -1 +1 @@ -ac9483f591c9b8dd4ed22b28e3a7e7ee382011bd +7df3c35beaecb0915782bb9d572e2ee973d572c6