58
58
// ensure compiles to simple, position-independent code. It is implemented in C
59
59
// for readability/maintainability. It is placed in its own code section to
60
60
// simplify calculating its size.
61
- __attribute__((noinline , used , section (".text.remote " )))
61
+ __attribute__((noinline , used , section ("heap_iterator " )))
62
62
static void heap_iterate_callback (unsigned long base , unsigned long size , void * arg ) {
63
63
volatile uint64_t * data = (uint64_t * )arg ;
64
64
while (data [NEXT_FREE_IDX ] >= data [MAX_VALID_IDX ]) {
@@ -77,17 +77,16 @@ static void heap_iterate_callback(unsigned long base, unsigned long size, void *
77
77
data [data [NEXT_FREE_IDX ]++ ] = size ;
78
78
}
79
79
80
- // Linker-populated symbol defined in section-text-remote.ld. Used to calculate
81
- // the size of the heap_iterate_callback function when copying it to a remote
82
- // process for execution.
83
- extern char _remote_code_section_end ;
80
+ // Both clang and gcc implicitly define __start- and __stop- prefixed symbols
81
+ // that mark the start and end of user defined sections.
82
+ extern char __stop_heap_iterator [];
84
83
85
84
void * heap_iterate_callback_start () {
86
85
return (void * )heap_iterate_callback ;
87
86
}
88
87
89
88
size_t heap_iterate_callback_len () {
90
- return (uintptr_t )& _remote_code_section_end - (uintptr_t )heap_iterate_callback ;
89
+ return (uintptr_t )__stop_heap_iterator - (uintptr_t )heap_iterate_callback ;
91
90
}
92
91
93
92
bool heap_iterate_metadata_init (void * data , size_t len ) {
0 commit comments