aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-09-06 18:12:46 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-09-06 18:12:46 +0000
commitaa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13 (patch)
tree7e63b06d1eec92beec6997c9d3ab47a5d6a835be /libgo/runtime
parent920ea3b8ba3164b61ac9490dfdfceb6936eda6dd (diff)
downloadgcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.zip
gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.tar.gz
gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.tar.bz2
libgo: update to Go 1.13beta1 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/193497 From-SVN: r275473
Diffstat (limited to 'libgo/runtime')
-rw-r--r--libgo/runtime/go-fieldtrack.c15
-rw-r--r--libgo/runtime/panic.c41
-rw-r--r--libgo/runtime/runtime.h16
-rw-r--r--libgo/runtime/runtime_c.c32
4 files changed, 74 insertions, 30 deletions
diff --git a/libgo/runtime/go-fieldtrack.c b/libgo/runtime/go-fieldtrack.c
index 1d85050..22f091b 100644
--- a/libgo/runtime/go-fieldtrack.c
+++ b/libgo/runtime/go-fieldtrack.c
@@ -25,21 +25,6 @@ __go_fieldtrack (byte *p __attribute__ ((unused)))
/* A runtime function to add all the tracked fields to a
map[string]bool. */
-extern const char _etext[] __attribute__ ((weak));
-extern const char _edata[] __attribute__ ((weak));
-#ifdef _AIX
-// Following symbols do not exist on AIX
-const char *__etext = NULL;
-const char *__data_start = NULL;
-const char *__edata = NULL;
-const char *__bss_start = NULL;
-#else
-extern const char __etext[] __attribute__ ((weak));
-extern const char __data_start[] __attribute__ ((weak));
-extern const char __edata[] __attribute__ ((weak));
-extern const char __bss_start[] __attribute__ ((weak));
-#endif
-
extern void *mapassign (const struct maptype *, void *hmap, const void *key)
__asm__ (GOSYM_PREFIX "runtime.mapassign");
diff --git a/libgo/runtime/panic.c b/libgo/runtime/panic.c
index 9025505..4838219 100644
--- a/libgo/runtime/panic.c
+++ b/libgo/runtime/panic.c
@@ -16,23 +16,34 @@ runtime_throw(const char *s)
void
runtime_panicstring(const char *s)
{
- M* mp;
+ G *gp;
Eface err;
- mp = runtime_m();
- if (mp != nil) {
- if(mp->mallocing) {
- runtime_printf("panic: %s\n", s);
- runtime_throw("panic during malloc");
- }
- if(mp->gcing) {
- runtime_printf("panic: %s\n", s);
- runtime_throw("panic during gc");
- }
- if(mp->locks) {
- runtime_printf("panic: %s\n", s);
- runtime_throw("panic holding locks");
- }
+ gp = runtime_g();
+ if (gp == nil) {
+ runtime_printf("panic: %s\n", s);
+ runtime_throw("panic with no g");
+ }
+ if (gp->m == nil) {
+ runtime_printf("panic: %s\n", s);
+ runtime_throw("panic with no m");
+ }
+ if (gp->m->curg != gp) {
+ runtime_printf("panic: %s\n", s);
+ runtime_throw("panic on system stack");
+ }
+ if (gp->m->mallocing != 0) {
+ runtime_printf("panic: %s\n", s);
+ runtime_throw("panic during malloc");
+ }
+ if (gp->m->preemptoff.len != 0) {
+ runtime_printf("panic: %s\n", s);
+ runtime_printf("preempt off reason: %S\n", gp->m->preemptoff);
+ runtime_throw("panic during preemptoff");
+ }
+ if (gp->m->locks != 0) {
+ runtime_printf("panic: %s\n", s);
+ runtime_throw("panic holding locks");
}
runtime_newErrorCString((uintptr) s, &err);
runtime_panic(err);
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index 8ff578e..399df51 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -502,3 +502,19 @@ void __go_makecontext(__go_context_t*, void (*)(), void*, size_t);
#define __go_makecontext(c, fn, sp, size) \
((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, makecontext(c, fn, 0))
#endif
+
+// Symbols defined by the linker.
+extern const char _etext[] __attribute__ ((weak));
+extern const char _edata[] __attribute__ ((weak));
+#ifdef _AIX
+// Following symbols do not exist on AIX
+#define __etext nil
+#define __data_start nil
+#define __edata nil
+#define __bss_start nil
+#else
+extern const char __etext[] __attribute__ ((weak));
+extern const char __data_start[] __attribute__ ((weak));
+extern const char __edata[] __attribute__ ((weak));
+extern const char __bss_start[] __attribute__ ((weak));
+#endif
diff --git a/libgo/runtime/runtime_c.c b/libgo/runtime/runtime_c.c
index 6d77af4..7531431 100644
--- a/libgo/runtime/runtime_c.c
+++ b/libgo/runtime/runtime_c.c
@@ -186,6 +186,38 @@ getEnd()
return end;
}
+// Return an address that is before the read-only data section.
+// Unfortunately there is no standard symbol for this so we use a text
+// address.
+
+uintptr getText(void)
+ __asm__ (GOSYM_PREFIX "runtime.getText");
+
+uintptr
+getText(void)
+{
+ return (uintptr)(const void *)(getText);
+}
+
+// Return the end of the text segment, assumed to come after the
+// read-only data section.
+
+uintptr getEtext(void)
+ __asm__ (GOSYM_PREFIX "runtime.getEtext");
+
+uintptr
+getEtext(void)
+{
+ const void *p;
+
+ p = __data_start;
+ if (p == nil)
+ p = __etext;
+ if (p == nil)
+ p = _etext;
+ return (uintptr)(p);
+}
+
// CPU-specific initialization.
// Fetch CPUID info on x86.