// 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"
}
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)
t.Fatal(err)
}
- f, err := elf.Open("testp" + exeSuffix)
- if err != nil {
- t.Fatal("elf.Open failed: ", err)
- }
- defer f.Close()
- if hasDynTag(t, f, elf.DT_TEXTREL) {
- t.Errorf("%s has DT_TEXTREL flag", "testp"+exeSuffix)
+ if GOOS != "aix" {
+ f, err := elf.Open("testp" + exeSuffix)
+ if err != nil {
+ t.Fatal("elf.Open failed: ", err)
+ }
+ defer f.Close()
+ if hasDynTag(t, f, elf.DT_TEXTREL) {
+ t.Errorf("%s has DT_TEXTREL flag", "testp"+exeSuffix)
+ }
}
}
#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);
// 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");
}
// 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");
}
#include "libgo2.h"
+int *nilp;
+
int main(int argc, char** argv) {
int verbose;
int test;
printf("attempting segfault\n");
}
- volatile int crash = *(int *) 0;
+ *nilp = 0;
break;
}
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":
mask.__sigbits[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
}
+//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
}
*(*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
mask.__bits[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
}
+//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
}
mask.__bits[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
}
+//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
}
*(*uintptr)(unsafe.Pointer(&s.ss_sp)) = sp
}
+//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
}
mask.__bits[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
}
+//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
}
*mask &^= 1 << (uint32(i) - 1)
}
+//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
}
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:
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:
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:
c.info.si_addr = (*byte)(unsafe.Pointer(uintptr(x)))
}
+//go:nosplit
func (c *sigctxt) fixsigcode(sig uint32) {
switch sig {
case _SIGTRAP:
sigprofNonGoPC(c.sigpc())
return
}
+ c.fixsigcode(sig)
badsignal(uintptr(sig), c)
return
}