19 lines
438 B
C
19 lines
438 B
C
// Stateful library using BSS (zero-init global) and .data (init global).
|
|
// Exercises PC32 relocs from .text to .bss/.data across segments.
|
|
|
|
static int call_count = 0; // BSS: zero-initialized
|
|
static int step = 1; // .data: initialized to 1
|
|
|
|
void counter_reset(void) {
|
|
call_count = 0;
|
|
}
|
|
|
|
int counter_step_up(void) {
|
|
call_count += step;
|
|
return call_count;
|
|
}
|
|
|
|
int counter_get(void) {
|
|
return call_count;
|
|
}
|