User Tools

Site Tools


go:internals:textflag

Table of Contents

textflag

A flag for the “ld” linker, with special link-time information about a function.

textflag 7

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.

Usage

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?)

go/internals/textflag.txt · Last modified: 2020/11/23 17:23 by 127.0.0.1