From e2bdd8a184deccf813c032875ad49bfdca882932 Mon Sep 17 00:00:00 2001 From: guozhanxin Date: Wed, 14 Dec 2022 10:37:13 +0800 Subject: [PATCH] [libcpu] fix cpp11 error --- libcpu/arm/cortex-a/backtrace.c | 45 +++++++++++++++------------------ libcpu/arm/cortex-a/start_gcc.S | 15 ----------- 2 files changed, 21 insertions(+), 39 deletions(-) diff --git a/libcpu/arm/cortex-a/backtrace.c b/libcpu/arm/cortex-a/backtrace.c index 1d4d444aa9..4a5718bf9f 100644 --- a/libcpu/arm/cortex-a/backtrace.c +++ b/libcpu/arm/cortex-a/backtrace.c @@ -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__ #if !defined (__ARM_EABI__) #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; } -/* 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 { - unsigned long vrs[16]; /* virtual register set */ - const unsigned long *insn; /* pointer to the current instructions word */ - unsigned long sp_high; /* highest value of sp allowed */ + unsigned long vrs[16]; /* virtual register set */ + const unsigned long *insn; /* pointer to the current instructions word */ + unsigned long sp_high; /* highest value of sp allowed */ /* * 1 : check for stack overflow for each register pop. * 0 : save overhead if there is plenty of stack remaining. */ int check_each_pop; - int entries; /* number of entries left to interpret */ - int byte; /* current byte number in the instructions word */ + int entries; /* number of entries left to interpret */ + int byte; /* current byte number in the instructions word */ }; enum regs @@ -75,11 +72,11 @@ static int core_kernel_text(unsigned long addr) } /* Convert a prel31 symbol to an absolute address */ -#define prel31_to_addr(ptr) \ - ({ \ - /* sign-extend to 32 bits */ \ - long offset = (((long)*(ptr)) << 1) >> 1; \ - (unsigned long)(ptr) + offset; \ +#define prel31_to_addr(ptr) \ + ({ \ + /* sign-extend to 32 bits */ \ + long offset = (((long)*(ptr)) << 1) >> 1; \ + (unsigned long)(ptr) + offset; \ }) /* @@ -376,6 +373,7 @@ static char *unwind_get_function_name(void *address) return RT_NULL; } #endif + /* * Unwind a single frame starting with *sp for the symbol at *pc. It * 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)); rt_unwind(®s, 8); } - diff --git a/libcpu/arm/cortex-a/start_gcc.S b/libcpu/arm/cortex-a/start_gcc.S index 5ddb7311a8..e77579ff21 100644 --- a/libcpu/arm/cortex-a/start_gcc.S +++ b/libcpu/arm/cortex-a/start_gcc.S @@ -187,21 +187,6 @@ bss_loop: bl rt_hw_mmu_init #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 */ ldr pc, _rtthread_startup _rtthread_startup: