Browse Source
Fix external globals
This broke the allocator on ARM, and with that the blinky example.
pull/6/head
Ayke van Laethem
6 years ago
No known key found for this signature in database
GPG Key ID: E97FF5335DFDFDED
3 changed files with
8 additions and
2 deletions
-
arm.ld
-
compiler.go
-
ir.go
|
|
@ -80,4 +80,3 @@ __bss_end__ = _ebss; |
|
|
|
/* For the memory allocator. */ |
|
|
|
_heap_start = _ebss; |
|
|
|
_heap_end = ORIGIN(RAM) + LENGTH(RAM); |
|
|
|
runtime.heapptr = _heap_start; /* necessary? */ |
|
|
|
|
|
@ -252,7 +252,7 @@ func (c *Compiler) Parse(mainPath string, buildTags []string) error { |
|
|
|
} |
|
|
|
global := llvm.AddGlobal(c.mod, llvmType, g.LinkName()) |
|
|
|
g.llvmGlobal = global |
|
|
|
if !strings.HasPrefix(g.LinkName(), "_extern_") { |
|
|
|
if !g.IsExtern() { |
|
|
|
global.SetLinkage(llvm.InternalLinkage) |
|
|
|
initializer, err := getZeroValue(llvmType) |
|
|
|
if err != nil { |
|
|
@ -745,6 +745,9 @@ func (c *Compiler) initMapNewBucket(mapType *types.Map) (llvm.Value, uint64, uin |
|
|
|
} |
|
|
|
|
|
|
|
func (c *Compiler) parseGlobalInitializer(g *Global) error { |
|
|
|
if g.IsExtern() { |
|
|
|
return nil |
|
|
|
} |
|
|
|
llvmValue, err := c.getInterpretedValue(g.initializer) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
|
|
@ -220,3 +220,7 @@ func (g *Global) LinkName() string { |
|
|
|
return g.g.RelString(nil) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (g *Global) IsExtern() bool { |
|
|
|
return strings.HasPrefix(g.g.Name(), "_extern_") |
|
|
|
} |
|
|
|