[libcpu] fix cpp11 error

This commit is contained in:
guozhanxin 2022-12-14 10:37:13 +08:00 committed by guo
parent 89c3bf5f92
commit e2bdd8a184
2 changed files with 21 additions and 39 deletions

View File

@ -1,3 +1,13 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2019-03-29 Jesven the first version
*/
#ifndef __CHECKER__ #ifndef __CHECKER__
#if !defined (__ARM_EABI__) #if !defined (__ARM_EABI__)
#warning Your compiler does not have EABI support. #warning Your compiler does not have EABI support.
@ -31,30 +41,17 @@ rt_inline void arm_get_current_stackframe(struct pt_regs *regs, struct stackfram
frame->pc = regs->ARM_pc; frame->pc = regs->ARM_pc;
} }
/* Dummy functions to avoid linker complaints */
void __aeabi_unwind_cpp_pr0(void)
{
};
void __aeabi_unwind_cpp_pr1(void)
{
};
void __aeabi_unwind_cpp_pr2(void)
{
};
struct unwind_ctrl_block { struct unwind_ctrl_block {
unsigned long vrs[16]; /* virtual register set */ unsigned long vrs[16]; /* virtual register set */
const unsigned long *insn; /* pointer to the current instructions word */ const unsigned long *insn; /* pointer to the current instructions word */
unsigned long sp_high; /* highest value of sp allowed */ unsigned long sp_high; /* highest value of sp allowed */
/* /*
* 1 : check for stack overflow for each register pop. * 1 : check for stack overflow for each register pop.
* 0 : save overhead if there is plenty of stack remaining. * 0 : save overhead if there is plenty of stack remaining.
*/ */
int check_each_pop; int check_each_pop;
int entries; /* number of entries left to interpret */ int entries; /* number of entries left to interpret */
int byte; /* current byte number in the instructions word */ int byte; /* current byte number in the instructions word */
}; };
enum regs enum regs
@ -75,11 +72,11 @@ static int core_kernel_text(unsigned long addr)
} }
/* Convert a prel31 symbol to an absolute address */ /* Convert a prel31 symbol to an absolute address */
#define prel31_to_addr(ptr) \ #define prel31_to_addr(ptr) \
({ \ ({ \
/* sign-extend to 32 bits */ \ /* sign-extend to 32 bits */ \
long offset = (((long)*(ptr)) << 1) >> 1; \ long offset = (((long)*(ptr)) << 1) >> 1; \
(unsigned long)(ptr) + offset; \ (unsigned long)(ptr) + offset; \
}) })
/* /*
@ -376,6 +373,7 @@ static char *unwind_get_function_name(void *address)
return RT_NULL; return RT_NULL;
} }
#endif #endif
/* /*
* Unwind a single frame starting with *sp for the symbol at *pc. It * Unwind a single frame starting with *sp for the symbol at *pc. It
* updates the *pc and *sp with the new values. * updates the *pc and *sp with the new values.
@ -542,4 +540,3 @@ void rt_backtrace(void)
asm volatile ("mov %0, pc":"=r"(regs.pc)); asm volatile ("mov %0, pc":"=r"(regs.pc));
rt_unwind(&regs, 8); rt_unwind(&regs, 8);
} }

View File

@ -187,21 +187,6 @@ bss_loop:
bl rt_hw_mmu_init bl rt_hw_mmu_init
#endif #endif
/* call C++ constructors of global objects */
ldr r0, =__ctors_start__
ldr r1, =__ctors_end__
ctor_loop:
cmp r0, r1
beq ctor_end
ldr r2, [r0], #4
stmfd sp!, {r0-r1}
mov lr, pc
bx r2
ldmfd sp!, {r0-r1}
b ctor_loop
ctor_end:
/* start RT-Thread Kernel */ /* start RT-Thread Kernel */
ldr pc, _rtthread_startup ldr pc, _rtthread_startup
_rtthread_startup: _rtthread_startup: