diff options
author | Rong Xu <xur@google.com> | 2014-09-02 15:29:57 -0700 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2014-09-02 15:29:57 -0700 |
commit | e97c99f15937e5762a973b25192aab824126a6d3 (patch) | |
tree | 7f0be3ff7c7d976af06887dc50accd68f7630a7f /gcc-4.9/libgo | |
parent | f1c18afafc2b321465ae6b07ede127095942d7dc (diff) | |
download | toolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.tar.gz toolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.tar.bz2 toolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.zip |
[gcc-4.9] Merge svn r214745 from google/gcc-4_9 branch.
Merge gcc-4_9 source r214745 from google/gcc-4_9 branch.
Change-Id: Ie6fa0fd72f4b4eec3adc4db4bb922e652d1c2605
Diffstat (limited to 'gcc-4.9/libgo')
-rw-r--r-- | gcc-4.9/libgo/runtime/go-caller.c | 12 | ||||
-rw-r--r-- | gcc-4.9/libgo/runtime/malloc.goc | 7 | ||||
-rw-r--r-- | gcc-4.9/libgo/runtime/mgc0.c | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/gcc-4.9/libgo/runtime/go-caller.c b/gcc-4.9/libgo/runtime/go-caller.c index e97b85097..a3e04240d 100644 --- a/gcc-4.9/libgo/runtime/go-caller.c +++ b/gcc-4.9/libgo/runtime/go-caller.c @@ -7,6 +7,9 @@ /* Implement runtime.Caller. */ #include <stdint.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> #include "backtrace.h" @@ -99,6 +102,7 @@ __go_get_backtrace_state () if (back_state == NULL) { const char *filename; + struct stat s; filename = (const char *) runtime_progname (); @@ -108,6 +112,14 @@ __go_get_backtrace_state () if (__builtin_strchr (filename, '/') == NULL) filename = NULL; + /* If the file is small, then it's not the real executable. + This is specifically to deal with Docker, which uses a bogus + argv[0] (http://gcc.gnu.org/PR61895). It would be nice to + have a better check for whether this file is the real + executable. */ + if (stat (filename, &s) < 0 || s.st_size < 1024) + filename = NULL; + back_state = backtrace_create_state (filename, 1, error_callback, NULL); } runtime_unlock (&back_state_lock); diff --git a/gcc-4.9/libgo/runtime/malloc.goc b/gcc-4.9/libgo/runtime/malloc.goc index 7120457a5..37bbf5ef6 100644 --- a/gcc-4.9/libgo/runtime/malloc.goc +++ b/gcc-4.9/libgo/runtime/malloc.goc @@ -79,6 +79,7 @@ runtime_mallocgc(uintptr size, uintptr typ, uint32 flag) MSpan *s; MLink *v; bool incallback; + void *closure; if(size == 0) { // All 0-length allocations use this pointer. @@ -90,6 +91,10 @@ runtime_mallocgc(uintptr size, uintptr typ, uint32 flag) m = runtime_m(); g = runtime_g(); + // We should not be called in between __go_set_closure and the + // actual function call, but cope with it if we are. + closure = g->closure; + incallback = false; if(m->mcache == nil && g->ncgo > 0) { // For gccgo this case can occur when a cgo or SWIG function @@ -206,6 +211,8 @@ runtime_mallocgc(uintptr size, uintptr typ, uint32 flag) if(incallback) runtime_entersyscall(); + g->closure = closure; + return v; } diff --git a/gcc-4.9/libgo/runtime/mgc0.c b/gcc-4.9/libgo/runtime/mgc0.c index f963686e3..b5a39d962 100644 --- a/gcc-4.9/libgo/runtime/mgc0.c +++ b/gcc-4.9/libgo/runtime/mgc0.c @@ -2000,6 +2000,7 @@ runtime_gc(int32 force) runtime_mcall(mgc); // record a new start time in case we're going around again a.start_time = runtime_nanotime(); + m = runtime_m(); } // all done |