compiler: add nounwind attribute

This attribute is also set by Clang when it compiles C source files
(unless -fexceptions is set). The advantage is that no unwind tables are
emitted on Linux (and perhaps other systems). It also avoids
__aeabi_unwind_cpp_pr0 on ARM when using the musl libc.
This commit is contained in:
Ayke van Laethem
2021-09-13 18:19:26 +02:00
committed by Ron Evans
parent 112b369636
commit 478dd3a28d
18 changed files with 357 additions and 199 deletions
+2 -1
View File
@@ -23,7 +23,7 @@ import (
// Version of the compiler pacakge. Must be incremented each time the compiler
// package changes in a way that affects the generated LLVM module.
// This version is independent of the TinyGo version number.
const Version = 20 // last change: fix export math functions issue
const Version = 21 // last change: add nounwind attribute
func init() {
llvm.InitializeAllTargets()
@@ -814,6 +814,7 @@ func (b *builder) createFunction() {
b.addError(b.fn.Pos(), errValue)
return
}
b.addStandardAttributes(b.llvmFn)
if !b.info.exported {
b.llvmFn.SetVisibility(llvm.HiddenVisibility)
b.llvmFn.SetUnnamedAddr(true)