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.
Этот коммит содержится в:
родитель
77934f364f
коммит
b0aeaed635
1 изменённых файлов: 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)
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче