summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/nds32/__builtin.c2
-rw-r--r--core/nds32/build.mk5
-rw-r--r--core/nds32/task.c5
3 files changed, 9 insertions, 3 deletions
diff --git a/core/nds32/__builtin.c b/core/nds32/__builtin.c
index 45baa59aff..7b1d5eea62 100644
--- a/core/nds32/__builtin.c
+++ b/core/nds32/__builtin.c
@@ -10,7 +10,7 @@
* Returns one plus the index of the least significant 1-bit of x,
* or if x is zero, returns zero.
*/
-int __ffssi2(int x)
+int __keep __ffssi2(int x)
{
return 32 - __builtin_clz(x & -x);
}
diff --git a/core/nds32/build.mk b/core/nds32/build.mk
index aee656ef93..db2a52d1b1 100644
--- a/core/nds32/build.mk
+++ b/core/nds32/build.mk
@@ -15,5 +15,10 @@ $(call set-option,CROSS_COMPILE,$(CROSS_COMPILE_nds32),$(NDS32_DEFAULT_COMPILE))
# CPU specific compilation flags
CFLAGS_CPU+=-march=v3m -Os
+ifneq ($(CONFIG_LTO),)
+CFLAGS_CPU+=-flto
+LDFLAGS_EXTRA+=-flto
+endif
+
core-y=cpu.o init.o panic.o task.o switch.o __muldi3.o math.o __builtin.o
core-$(CONFIG_FPU)+=__libsoftfpu.o
diff --git a/core/nds32/task.c b/core/nds32/task.c
index 54b7b5ed77..788f0c66bf 100644
--- a/core/nds32/task.c
+++ b/core/nds32/task.c
@@ -256,7 +256,8 @@ int get_sw_int(void)
*
* Also includes emulation of software triggering interrupt vector
*/
-void __ram_code syscall_handler(int desched, task_id_t resched, int swirq)
+void __ram_code __keep syscall_handler(int desched, task_id_t resched,
+ int swirq)
{
/* are we emulating an interrupt ? */
if (swirq) {
@@ -416,7 +417,7 @@ void end_irq_handler(void)
#endif
}
-static uint32_t __wait_evt(int timeout_us, task_id_t resched)
+static uint32_t __ram_code __wait_evt(int timeout_us, task_id_t resched)
{
task_ *tsk = current_task;
task_id_t me = tsk - tasks;