A flag for the “ld” linker, with special link-time information about a function.
Extracted from a comment in pkg/runtime/proc.c
:
* Newproc and deferproc need to be textflag 7
* (no possible stack split when nearing overflow)
See split stacks.
In “cc” C, add a pragma
directive before the function definition – example:
#pragma textflag 7 void somefunction(int x, int y) { //... }
In “asm” assembly, put the number 7
in function's entry point definition line – example:
TEXT runtime·tstart(SB),7,$0
Note: These C and assembly syntaxes are supported only by the C compilers and assemblers shipped with Go (i.e. the modified Plan 9 ones). Stock Gcc
does not have the ability to set these flags (but maybe a Gcc
with gccgo
integrated in it can?)