User Tools

Site Tools


go:internals:textflag

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

go:internals:textflag [2019/03/04 10:48]
fgm created
go:internals:textflag [2020/11/23 17:23]
Line 1: Line 1:
-====== 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 [[http://doc.cat-v.org/plan_9/4th_edition/papers/compiler|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 (external edit)