Fix external globals

This broke the allocator on ARM, and with that the blinky example.
This commit is contained in:
Ayke van Laethem
2018-09-02 18:10:01 +02:00
parent 88b6b2e7f5
commit bfff0c33e4
3 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -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