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
|
||||
|
||||
Reference in New Issue
Block a user