Skip to content

Commit 501f33e

Browse files
cjwinklhoferkartben
authored andcommitted
arch: Unify declaration of text region
The declaration for the text region '__text_region_start' and '__text_region_end' should be consistent with the declaration in the include file 'zephyr/linker/linker-defs.h'. The local declarations are: extern uintptr_t __text_region_start, __text_region_end; whereas 'linker_defs.h' declares them as: extern char __text_region_start[]; extern char __text_region_end[]; This may result in conflicting types when 'linker_defs.h' is indirectly included. Hence, remove the local declarations. Signed-off-by: Christoph Winklhofer <[email protected]>
1 parent 8c7aded commit 501f33e

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

arch/riscv/core/stacktrace.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <zephyr/debug/symtab.h>
88
#include <zephyr/kernel.h>
99
#include <zephyr/kernel_structs.h>
10+
#include <zephyr/linker/linker-defs.h>
1011
#include <kernel_internal.h>
1112
#include <zephyr/logging/log.h>
1213

@@ -90,9 +91,7 @@ static bool in_stack_bound(uintptr_t addr, const struct k_thread *const thread,
9091

9192
static inline bool in_text_region(uintptr_t addr)
9293
{
93-
extern uintptr_t __text_region_start, __text_region_end;
94-
95-
return (addr >= (uintptr_t)&__text_region_start) && (addr < (uintptr_t)&__text_region_end);
94+
return (addr >= (uintptr_t)__text_region_start) && (addr < (uintptr_t)__text_region_end);
9695
}
9796

9897
#ifdef CONFIG_FRAME_POINTER

subsys/profiling/perf/backends/perf_riscv.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include <zephyr/kernel.h>
8+
#include <zephyr/linker/linker-defs.h>
89

910
static bool valid_stack(uintptr_t addr, k_tid_t current)
1011
{
@@ -14,9 +15,7 @@ static bool valid_stack(uintptr_t addr, k_tid_t current)
1415

1516
static inline bool in_text_region(uintptr_t addr)
1617
{
17-
extern uintptr_t __text_region_start, __text_region_end;
18-
19-
return (addr >= (uintptr_t)&__text_region_start) && (addr < (uintptr_t)&__text_region_end);
18+
return (addr >= (uintptr_t)__text_region_start) && (addr < (uintptr_t)__text_region_end);
2019
}
2120

2221
/*

subsys/profiling/perf/backends/perf_x86.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include <zephyr/kernel.h>
9+
#include <zephyr/linker/linker-defs.h>
910

1011
static bool valid_stack(uintptr_t addr, k_tid_t current)
1112
{
@@ -15,9 +16,7 @@ static bool valid_stack(uintptr_t addr, k_tid_t current)
1516

1617
static inline bool in_text_region(uintptr_t addr)
1718
{
18-
extern uintptr_t __text_region_start, __text_region_end;
19-
20-
return (addr >= (uintptr_t)&__text_region_start) && (addr < (uintptr_t)&__text_region_end);
19+
return (addr >= (uintptr_t)__text_region_start) && (addr < (uintptr_t)__text_region_end);
2120
}
2221

2322
/* interruption stack frame */

subsys/profiling/perf/backends/perf_x86_64.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include <zephyr/kernel.h>
9+
#include <zephyr/linker/linker-defs.h>
910

1011
static bool valid_stack(uintptr_t addr, k_tid_t current)
1112
{
@@ -15,9 +16,7 @@ static bool valid_stack(uintptr_t addr, k_tid_t current)
1516

1617
static inline bool in_text_region(uintptr_t addr)
1718
{
18-
extern uintptr_t __text_region_start, __text_region_end;
19-
20-
return (addr >= (uintptr_t)&__text_region_start) && (addr < (uintptr_t)&__text_region_end);
19+
return (addr >= (uintptr_t)__text_region_start) && (addr < (uintptr_t)__text_region_end);
2120
}
2221

2322
/*

0 commit comments

Comments
 (0)