all: fix -gc=none

This option was broken for a long time, in part because we didn't test
for it. This commit fixes that and adds a test to make sure it won't
break again unnoticed.
This commit is contained in:
Ayke van Laethem
2020-07-12 19:25:36 +02:00
committed by Ron Evans
parent d606315515
commit 05495c4282
3 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -158,7 +158,7 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
// After TinyGo-specific transforms have finished, undo exporting these functions.
for _, name := range getFunctionsUsedInTransforms(config) {
fn := mod.NamedFunction(name)
if fn.IsNil() {
if fn.IsNil() || fn.IsDeclaration() {
continue
}
fn.SetLinkage(llvm.InternalLinkage)