diff mbox

libgo patch committed: Pass -funwind-tables when compiling C code

Message ID CAOyqgcXM6x_KiYByDG9CT3Yt+6=sAoYk8=gr831+CJYOS2iUhQ@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor Aug. 18, 2017, 4:40 a.m. UTC
This patch to the go tool in libgo changes it to use -funwind-tables
when compiling C code to support the cgo tool.  Using -funwind-tables
is necessary to permit Go code to correctly throw a panic through C
code.  This hasn't been necessary in the past as -funwind-tables is
the default on x86.  However, it is not the default for PPC AIX, among
other systems.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 251133)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-152164a7249ecc5c2bfd4a091450dc7c2855f609
+9ff49c64ea6dbb5e08d1fa859b99b06049413279
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/go/cmd/go/build.go
===================================================================
--- libgo/go/cmd/go/build.go	(revision 250873)
+++ libgo/go/cmd/go/build.go	(working copy)
@@ -3268,6 +3268,12 @@  func (b *builder) ccompilerCmd(envvar, d
 		a = append(a, "-fno-common")
 	}
 
+	// gccgo uses the language-independent exception mechanism to
+	// handle panics, so it always needs unwind tables.
+	if _, ok := buildToolchain.(gccgoToolchain); ok {
+		a = append(a, "-funwind-tables")
+	}
+
 	return a
 }