It's difficult to catch all the places where -fno-stack-protector
is required, so at least ensure that the stack protector doesn't
dereference random garbage.
#include <bmk-core/types.h>
+#define BMK_TLS_EXTRA (6 * sizeof(unsigned long))
struct bmk_tcb {
unsigned long btcb_sp; /* stack pointer */
unsigned long btcb_ip; /* program counter */
unsigned long *tcbptr;
char *tlsmem;
- tlsmem = bmk_memalloc(tdatasize + tbsssize + sizeof(unsigned long), 0);
+ tlsmem = bmk_memalloc(tdatasize + tbsssize + BMK_TLS_EXTRA, 0);
bmk_memcpy(tlsmem, _tdata_start, tdatasize);
bmk_memset(tlsmem + tdatasize, 0, tbsssize);