mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
compiler: allow a global to be defined multiple times
This is only possible when using compiler directives like the magic _extern_ prefix on global variables.
This commit is contained in:
+4
-1
@@ -270,7 +270,10 @@ func (c *Compiler) Parse(mainPath string, buildTags []string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
global := llvm.AddGlobal(c.mod, llvmType, g.LinkName())
|
||||
global := c.mod.NamedGlobal(g.LinkName())
|
||||
if global.IsNil() {
|
||||
global = llvm.AddGlobal(c.mod, llvmType, g.LinkName())
|
||||
}
|
||||
g.llvmGlobal = global
|
||||
if !g.IsExtern() {
|
||||
global.SetLinkage(llvm.InternalLinkage)
|
||||
|
||||
Reference in New Issue
Block a user