diff options
| -rw-r--r-- | src/lib/user/user.lds | 6 | ||||
| -rw-r--r-- | src/tests/filst/sc-bad-write.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/user/user.lds b/src/lib/user/user.lds index cc6d6c0..27ea4be 100644 --- a/src/lib/user/user.lds +++ b/src/lib/user/user.lds @@ -16,7 +16,11 @@ SECTIONS . = DATA_SEGMENT_ALIGN (0x1000, 0x1000); .data : { *(.data) } - .bss : { *(.bss) } + .bss : { + *(.bss) + /* Get the end of the bss segment as a symbol linkable from C */ + _end_bss = .; + } /* Stabs debugging sections. */ .stab 0 : { *(.stab) } diff --git a/src/tests/filst/sc-bad-write.c b/src/tests/filst/sc-bad-write.c index 28e0409..4d04155 100644 --- a/src/tests/filst/sc-bad-write.c +++ b/src/tests/filst/sc-bad-write.c @@ -19,14 +19,14 @@ static inline void *pg_round_up (const void *va) { } /** - * A global variable that will give us an address in the BSS segment. + * External symbol which address is the first address after all data in the BSS segment. */ -int global = 3; +extern int _end_bss; void test_main(void) { // Get the addres of the first unmapped page in the system. - unsigned page = (unsigned)pg_round_up(&global); + unsigned page = (unsigned)pg_round_up(&_end_bss); // Reserve space for 4 parameters. unsigned base = page - sizeof(int) * 4; |
