From 2cd9846cc9cad10f907ac6e0c6434ede068dcab3 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 5 Nov 2018 12:44:23 +0100 Subject: [PATCH] interp: fix compile-time alloc linkage This makes sure compile-time allocations (globals with the $alloc suffix) can be eliminated when unused. --- interp/frame.go | 1 + 1 file changed, 1 insertion(+) diff --git a/interp/frame.go b/interp/frame.go index 860ec02d7..9e75f8f6d 100644 --- a/interp/frame.go +++ b/interp/frame.go @@ -215,6 +215,7 @@ func (fr *frame) evalBasicBlock(bb, incoming llvm.BasicBlock, indent string) (re } alloc := llvm.AddGlobal(fr.Mod, allocType, fr.pkgName+"$alloc") alloc.SetInitializer(getZeroValue(allocType)) + alloc.SetLinkage(llvm.InternalLinkage) result := &GlobalValue{ Underlying: alloc, Eval: fr.Eval,