Skip to content

Commit 244c99b

Browse files
build(canary): support libcalls
1 parent a8a92d3 commit 244c99b

File tree

7 files changed

+11
-6
lines changed

7 files changed

+11
-6
lines changed

src/stack_protector_init.S

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
.global __wrap___stack_chk_init
1111
.thumb_func
1212
__wrap___stack_chk_init:
13+
// if r0 != 0, skip initialization and jump directly to main
14+
// (don't overwrite parent canary during a libcall)
15+
cmp r0, #0
16+
bne 1f
17+
1318
// save arguments passed to main
1419
push {r0-r3}
1520

target/apex_m/script.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ SECTIONS
107107
/**
108108
* Place RAM uninitialized variables
109109
*/
110-
_bss = .;
111110
__stack_chk_guard = .;
112111
PROVIDE(__stack_chk_guard = .);
113112
. += 4;
113+
_bss = .;
114114
*(.bss*)
115115
_ebss = .;
116116

target/apex_p/script.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ SECTIONS
107107
/**
108108
* Place RAM uninitialized variables
109109
*/
110-
_bss = .;
111110
__stack_chk_guard = .;
112111
PROVIDE(__stack_chk_guard = .);
113112
. += 4;
113+
_bss = .;
114114
*(.bss*)
115115
_ebss = .;
116116

target/flex/script.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ SECTIONS
110110
/**
111111
* Place RAM uninitialized variables
112112
*/
113-
_bss = .;
114113
__stack_chk_guard = .;
115114
PROVIDE(__stack_chk_guard = .);
116115
. += 4;
116+
_bss = .;
117117
*(.bss*)
118118
_ebss = .;
119119

target/nanos2/script.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ SECTIONS
109109
/**
110110
* Place RAM uninitialized variables
111111
*/
112-
_bss = .;
113112
__stack_chk_guard = .;
114113
PROVIDE(__stack_chk_guard = .);
115114
. += 4;
115+
_bss = .;
116116
*(.bss*)
117117
_ebss = .;
118118

target/nanox/script.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ SECTIONS
109109
/**
110110
* Place RAM uninitialized variables
111111
*/
112-
_bss = .;
113112
__stack_chk_guard = .;
114113
PROVIDE(__stack_chk_guard = .);
115114
. += 4;
115+
_bss = .;
116116
*(.bss*)
117117
_ebss = .;
118118

target/stax/script.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ SECTIONS
110110
/**
111111
* Place RAM uninitialized variables
112112
*/
113-
_bss = .;
114113
__stack_chk_guard = .;
115114
PROVIDE(__stack_chk_guard = .);
116115
. += 4;
116+
_bss = .;
117117
*(.bss*)
118118
_ebss = .;
119119

0 commit comments

Comments
 (0)