Commit 3aacfce6 authored by Clément Chigot's avatar Clément Chigot Committed by Ian Lance Taylor

runtime, cmd/dist, misc/cgo: enable c-archive for aix/ppc64

Change-Id: Ib9a40d5596f5735a00483e2d2db965402f05671b
Reviewed-on: https://go-review.googlesource.com/c/go/+/169120
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 56517216
......@@ -110,6 +110,11 @@ func testMain(m *testing.M) int {
// TODO(crawshaw): can we do better?
cc = append(cc, []string{"-framework", "CoreFoundation", "-framework", "Foundation"}...)
}
if GOOS == "aix" {
// -Wl,-bnoobjreorder is mandatory to keep the same layout
// in .text section.
cc = append(cc, "-Wl,-bnoobjreorder")
}
libbase := GOOS + "_" + GOARCH
if runtime.Compiler == "gccgo" {
libbase = "gccgo_" + libgodir + "_fPIC"
......@@ -318,7 +323,7 @@ func TestSignalForwarding(t *testing.T) {
}
func TestSignalForwardingExternal(t *testing.T) {
if GOOS == "freebsd" {
if GOOS == "freebsd" || GOOS == "aix" {
t.Skipf("skipping on %s/%s; signal always goes to the Go runtime", GOOS, GOARCH)
}
checkSignalForwardingTest(t)
......@@ -594,6 +599,7 @@ func TestPIE(t *testing.T) {
t.Fatal(err)
}
if GOOS != "aix" {
f, err := elf.Open("testp" + exeSuffix)
if err != nil {
t.Fatal("elf.Open failed: ", err)
......@@ -602,6 +608,7 @@ func TestPIE(t *testing.T) {
if hasDynTag(t, f, elf.DT_TEXTREL) {
t.Errorf("%s has DT_TEXTREL flag", "testp"+exeSuffix)
}
}
}
func hasDynTag(t *testing.T, f *elf.File, tag elf.DynTag) bool {
......
......@@ -14,6 +14,13 @@
#include "libgo4.h"
#ifdef _AIX
// On AIX, CSIGSTKSZ is too small to handle Go sighandler.
#define CSIGSTKSZ 0x4000
#else
#define CSIGSTKSZ SIGSTKSZ
#endif
static void die(const char* msg) {
perror(msg);
exit(EXIT_FAILURE);
......@@ -53,12 +60,12 @@ static void* thread1(void* arg __attribute__ ((unused))) {
// Set up an alternate signal stack for this thread.
memset(&ss, 0, sizeof ss);
ss.ss_sp = malloc(SIGSTKSZ);
ss.ss_sp = malloc(CSIGSTKSZ);
if (ss.ss_sp == NULL) {
die("malloc");
}
ss.ss_flags = 0;
ss.ss_size = SIGSTKSZ;
ss.ss_size = CSIGSTKSZ;
if (sigaltstack(&ss, NULL) < 0) {
die("sigaltstack");
}
......@@ -112,12 +119,12 @@ static void* thread2(void* arg __attribute__ ((unused))) {
// Set up an alternate signal stack for this thread.
memset(&ss, 0, sizeof ss);
ss.ss_sp = malloc(SIGSTKSZ);
ss.ss_sp = malloc(CSIGSTKSZ);
if (ss.ss_sp == NULL) {
die("malloc");
}
ss.ss_flags = 0;
ss.ss_size = SIGSTKSZ;
ss.ss_size = CSIGSTKSZ;
if (sigaltstack(&ss, NULL) < 0) {
die("sigaltstack");
}
......
......@@ -14,6 +14,8 @@
#include "libgo2.h"
int *nilp;
int main(int argc, char** argv) {
int verbose;
int test;
......@@ -39,7 +41,7 @@ int main(int argc, char** argv) {
printf("attempting segfault\n");
}
volatile int crash = *(int *) 0;
*nilp = 0;
break;
}
......
......@@ -928,7 +928,8 @@ func (t *tester) supportedBuildmode(mode string) bool {
return false
}
switch pair {
case "darwin-386", "darwin-amd64", "darwin-arm", "darwin-arm64",
case "aix-ppc64",
"darwin-386", "darwin-amd64", "darwin-arm", "darwin-arm64",
"linux-amd64", "linux-386", "linux-ppc64le", "linux-s390x",
"freebsd-amd64",
"windows-amd64", "windows-386":
......
......@@ -273,6 +273,7 @@ func sigdelset(mask *sigset, i int) {
mask.__sigbits[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
}
//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
}
......
......@@ -296,7 +296,15 @@ func setSignalstackSP(s *stackt, sp uintptr) {
*(*uintptr)(unsafe.Pointer(&s.ss_sp)) = sp
}
//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
switch sig {
case _SIGPIPE:
// For SIGPIPE, c.sigcode() isn't set to _SI_USER as on Linux.
// Therefore, raisebadsignal won't raise SIGPIPE again if
// it was deliver in a non-Go thread.
c.set_sigcode(_SI_USER)
}
}
//go:nosplit
......
......@@ -252,6 +252,7 @@ func sigdelset(mask *sigset, i int) {
mask.__bits[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
}
//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
}
......
......@@ -365,6 +365,7 @@ func sigdelset(mask *sigset, i int) {
mask.__bits[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
}
//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
}
......
......@@ -395,6 +395,7 @@ func setSignalstackSP(s *stackt, sp uintptr) {
*(*uintptr)(unsafe.Pointer(&s.ss_sp)) = sp
}
//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
}
......
......@@ -328,6 +328,7 @@ func sigdelset(mask *sigset, i int) {
mask.__bits[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
}
//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
}
......
......@@ -302,6 +302,7 @@ func sigdelset(mask *sigset, i int) {
*mask &^= 1 << (uint32(i) - 1)
}
//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
}
......
......@@ -40,6 +40,7 @@ func (c *sigctxt) set_esp(x uint32) { c.regs().esp = x }
func (c *sigctxt) set_sigcode(x uint32) { c.info.si_code = int32(x) }
func (c *sigctxt) set_sigaddr(x uint32) { c.info.si_addr = x }
//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
switch sig {
case _SIGTRAP:
......
......@@ -48,6 +48,7 @@ func (c *sigctxt) set_rsp(x uint64) { c.regs().rsp = x }
func (c *sigctxt) set_sigcode(x uint64) { c.info.si_code = int32(x) }
func (c *sigctxt) set_sigaddr(x uint64) { c.info.si_addr = x }
//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
switch sig {
case _SIGTRAP:
......
......@@ -50,6 +50,7 @@ func (c *sigctxt) set_r10(x uint32) { c.regs().r[10] = x }
func (c *sigctxt) set_sigcode(x uint32) { c.info.si_code = int32(x) }
func (c *sigctxt) set_sigaddr(x uint32) { c.info.si_addr = x }
//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
switch sig {
case _SIGTRAP:
......
......@@ -67,6 +67,7 @@ func (c *sigctxt) set_sigaddr(x uint64) {
c.info.si_addr = (*byte)(unsafe.Pointer(uintptr(x)))
}
//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
switch sig {
case _SIGTRAP:
......
......@@ -296,6 +296,7 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
sigprofNonGoPC(c.sigpc())
return
}
c.fixsigcode(sig)
badsignal(uintptr(sig), c)
return
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment