Blame 0003-arm-Explicitly-disable-unwind-tables.patch

03e3a66
From 599bfa2b29c7d50d0871010e282414d94acaf68f Mon Sep 17 00:00:00 2001
6cc5380
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
6cc5380
Date: Mon, 3 Jan 2022 18:40:21 -0500
03e3a66
Subject: [PATCH 3/9] arm: Explicitly disable unwind tables
6cc5380
6cc5380
Some clang builds (e.g., Fedora's) enable unwind tables by default. As
6cc5380
tinygo does not need nor support them, that leads to undefined symbols
6cc5380
when linking.
6cc5380
6cc5380
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
6cc5380
---
6cc5380
 builder/library.go    | 2 +-
6cc5380
 compileopts/target.go | 1 +
6cc5380
 2 files changed, 2 insertions(+), 1 deletion(-)
6cc5380
6cc5380
diff --git a/builder/library.go b/builder/library.go
6cc5380
index 73079785..012e4053 100644
6cc5380
--- a/builder/library.go
6cc5380
+++ b/builder/library.go
6cc5380
@@ -120,7 +120,7 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
6cc5380
 		}
6cc5380
 	}
6cc5380
 	if strings.HasPrefix(target, "arm") || strings.HasPrefix(target, "thumb") {
6cc5380
-		args = append(args, "-fshort-enums", "-fomit-frame-pointer", "-mfloat-abi=soft")
6cc5380
+		args = append(args, "-fshort-enums", "-fomit-frame-pointer", "-mfloat-abi=soft", "-fno-unwind-tables")
6cc5380
 	}
6cc5380
 	if strings.HasPrefix(target, "riscv32-") {
6cc5380
 		args = append(args, "-march=rv32imac", "-mabi=ilp32", "-fforce-enable-int128")
6cc5380
diff --git a/compileopts/target.go b/compileopts/target.go
6cc5380
index 2e5f5487..829b481e 100644
6cc5380
--- a/compileopts/target.go
6cc5380
+++ b/compileopts/target.go
6cc5380
@@ -256,6 +256,7 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) {
6cc5380
 		spec.Features = "+cx8,+fxsr,+mmx,+sse,+sse2,+x87"
6cc5380
 	case "arm":
6cc5380
 		spec.CPU = "generic"
6cc5380
+		spec.CFlags = append(spec.CFlags, "-fno-unwind-tables")
6cc5380
 		switch strings.Split(triple, "-")[0] {
6cc5380
 		case "armv5":
6cc5380
 			spec.Features = "+armv5t,+strict-align,-thumb-mode"
6cc5380
-- 
6cc5380
2.31.1
6cc5380