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:
Michael McLoughlin
2018-12-31 19:04:14 -08:00
parent f2315d539c
commit 816fa4c0e6
8 changed files with 19 additions and 11 deletions

View File

@@ -24,8 +24,10 @@ func TEXT(name, signature string) {
func LABEL(name string) { ctx.Label(avo.Label(name)) }
func GLOBL(name string) operand.Mem {
return ctx.StaticGlobal(name)
func GLOBL(name string, a avo.Attribute) operand.Mem {
g := ctx.StaticGlobal(name)
ctx.DataAttributes(a)
return g
}
func DATA(offset int, v operand.Constant) {