aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2024-06-22 17:56:29 +0200
committerRon Evans <[email protected]>2024-08-17 11:49:14 +0200
commitdb2a06a9bb4a16850511294b7418fca6422e668b (patch)
tree354f125a7c86048c23c41bb1357a1df39def2034 /compiler
parent560fd0a558772d73ca9b7f26459447e709b515a6 (diff)
downloadtinygo-db2a06a9bb4a16850511294b7418fca6422e668b.tar.gz
tinygo-db2a06a9bb4a16850511294b7418fca6422e668b.zip
internal/abi: implement initial version of this package
This package can never be a full version as seen in upstream Go, because TinyGo is very different. But it is necessary to define so that no code can accidentally use this package (now or in the future). It currently defines: - NoEscape which is needed by strings.Builder since Go 1.23. - FuncPCABI* which is needed by internal/syscall/unix on MacOS.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/symbol.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/symbol.go b/compiler/symbol.go
index 83bb4ccb2..37c987859 100644
--- a/compiler/symbol.go
+++ b/compiler/symbol.go
@@ -139,6 +139,8 @@ func (c *compilerContext) getFunction(fn *ssa.Function) (llvm.Type, llvm.Value)
// On *nix systems, the "abort" functuion in libc is used to handle fatal panics.
// Mark it as noreturn so LLVM can optimize away code.
llvmFn.AddFunctionAttr(c.ctx.CreateEnumAttribute(llvm.AttributeKindID("noreturn"), 0))
+ case "internal/abi.NoEscape":
+ llvmFn.AddAttributeAtIndex(1, c.ctx.CreateEnumAttribute(llvm.AttributeKindID("nocapture"), 0))
case "runtime.alloc":
// Tell the optimizer that runtime.alloc is an allocator, meaning that it
// returns values that are never null and never alias to an existing value.