build: add attributes argument to TEXT
Brings the TEXT() function signature closer to how the directive works in assembly. Also update almost all examples to use NOSPLIT. Closes #11
This commit is contained in:
17
build/attr.go
Normal file
17
build/attr.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package build
|
||||
|
||||
import "github.com/mmcloughlin/avo/attr"
|
||||
|
||||
// TEXT and DATA attribute values included for convenience.
|
||||
var (
|
||||
NOPROF = attr.NOPROF
|
||||
DUPOK = attr.DUPOK
|
||||
NOSPLIT = attr.NOSPLIT
|
||||
RODATA = attr.RODATA
|
||||
NOPTR = attr.NOPTR
|
||||
WRAPPER = attr.WRAPPER
|
||||
NEEDCTXT = attr.NEEDCTXT
|
||||
TLSBSS = attr.TLSBSS
|
||||
NOFRAME = attr.NOFRAME
|
||||
REFLECTMETHOD = attr.REFLECTMETHOD
|
||||
)
|
||||
@@ -15,9 +15,10 @@ import (
|
||||
// ctx provides a global build context.
|
||||
var ctx = NewContext()
|
||||
|
||||
// TEXT starts building a new function called name and sets its signature (see SignatureExpr).
|
||||
func TEXT(name, signature string) {
|
||||
// TEXT starts building a new function called name, with attributes a, and sets its signature (see SignatureExpr).
|
||||
func TEXT(name string, a attr.Attribute, signature string) {
|
||||
ctx.Function(name)
|
||||
ctx.Attributes(a)
|
||||
ctx.SignatureExpr(signature)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user