mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 07:23:39 +00:00
compiler: fix constant globals on AVR
Turn const globals into non-const globals, at least until pointers have the correct address space attribute.
This commit is contained in:
+11
@@ -3129,6 +3129,17 @@ func (c *Compiler) ApplyFunctionSections() {
|
||||
}
|
||||
}
|
||||
|
||||
// Turn all global constants into global variables. This works around a
|
||||
// limitation on Harvard architectures (e.g. AVR), where constant and
|
||||
// non-constant pointers point to a different address space.
|
||||
func (c *Compiler) NonConstGlobals() {
|
||||
global := c.mod.FirstGlobal()
|
||||
for !global.IsNil() {
|
||||
global.SetGlobalConstant(false)
|
||||
global = llvm.NextGlobal(global)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Compiler) Optimize(optLevel, sizeLevel int, inlinerThreshold uint) {
|
||||
builder := llvm.NewPassManagerBuilder()
|
||||
defer builder.Dispose()
|
||||
|
||||
Reference in New Issue
Block a user