ast,build: allow setting data attributes
Previously GLOBL/DATA attributes are set to RODATA. This diff removes that default and allows them to be set through the DataAttributes context method. Updates #2
This commit is contained in:
@@ -5,12 +5,13 @@ package main
|
||||
import (
|
||||
"math"
|
||||
|
||||
"github.com/mmcloughlin/avo"
|
||||
. "github.com/mmcloughlin/avo/build"
|
||||
. "github.com/mmcloughlin/avo/operand"
|
||||
)
|
||||
|
||||
func main() {
|
||||
bytes := GLOBL("bytes")
|
||||
bytes := GLOBL("bytes", avo.RODATA|avo.NOPTR)
|
||||
DATA(0, U64(0x0011223344556677))
|
||||
DATA(8, String("strconst"))
|
||||
DATA(16, F32(math.Pi))
|
||||
|
||||
@@ -10,7 +10,7 @@ DATA bytes<>+32(SB)/4, $0x00112233
|
||||
DATA bytes<>+36(SB)/2, $0x4455
|
||||
DATA bytes<>+38(SB)/1, $0x66
|
||||
DATA bytes<>+39(SB)/1, $0x77
|
||||
GLOBL bytes<>(SB), RODATA, $40
|
||||
GLOBL bytes<>(SB), RODATA|NOPTR, $40
|
||||
|
||||
// func DataAt(i int) byte
|
||||
TEXT ·DataAt(SB), $0-9
|
||||
|
||||
@@ -22,13 +22,13 @@ TEXT ·EncodeInt(SB), $0-24
|
||||
RET
|
||||
|
||||
DATA reciprocal180<>(SB)/8, $(0.005555555555555556)
|
||||
GLOBL reciprocal180<>(SB), RODATA, $8
|
||||
GLOBL reciprocal180<>(SB), RODATA|NOPTR, $8
|
||||
|
||||
DATA onepointfive<>(SB)/8, $(1.5)
|
||||
GLOBL onepointfive<>(SB), RODATA, $8
|
||||
GLOBL onepointfive<>(SB), RODATA|NOPTR, $8
|
||||
|
||||
DATA reciprocal360<>(SB)/8, $(0.002777777777777778)
|
||||
GLOBL reciprocal360<>(SB), RODATA, $8
|
||||
GLOBL reciprocal360<>(SB), RODATA|NOPTR, $8
|
||||
|
||||
DATA mask<>(SB)/8, $0x5555555555555555
|
||||
GLOBL mask<>(SB), RODATA, $8
|
||||
GLOBL mask<>(SB), RODATA|NOPTR, $8
|
||||
|
||||
@@ -44,7 +44,7 @@ TEXT ·CriticalLine(SB), $0-24
|
||||
RET
|
||||
|
||||
DATA half<>(SB)/8, $(0.5)
|
||||
GLOBL half<>(SB), RODATA, $8
|
||||
GLOBL half<>(SB), RODATA|NOPTR, $8
|
||||
|
||||
// func NewStruct(w uint16, p [2]float64, q uint64) Struct
|
||||
TEXT ·NewStruct(SB), $0-64
|
||||
|
||||
Reference in New Issue
Block a user