summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-09 00:34:55 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-09 00:34:55 +0000
commit0545fbe29f5a2abc9532dfbb5826973b5c52ec77 (patch)
tree7816f6072883911ab6d91b664bb121e5cbfff3e8
parent7824b734cc3fec02dca2c7f822d6e3cb117e9030 (diff)
downloadgcc-0545fbe29f5a2abc9532dfbb5826973b5c52ec77.tar.gz
PR go/69537
runtime: Don't refer to _end symbol in shared library. Fixes GCC PR 69357. Reviewed-on: https://go-review.googlesource.com/19362 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233235 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--libgo/runtime/go-main.c6
-rw-r--r--libgo/runtime/malloc.goc10
-rw-r--r--libgo/runtime/runtime.h1
4 files changed, 16 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index ab43670dbf1..1f47b1e269b 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-91833164072078a3fde7e9b05641ec3ed4a2f5d0
+2ef5f1ca449b5cf07dbbd7b13a50910fb5567372
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/libgo/runtime/go-main.c b/libgo/runtime/go-main.c
index 026469b2377..ff2958c239a 100644
--- a/libgo/runtime/go-main.c
+++ b/libgo/runtime/go-main.c
@@ -30,6 +30,11 @@
extern char **environ;
+/* A copy of _end that a shared library can reasonably refer to. */
+uintptr __go_end;
+
+extern byte _end[];
+
/* The main function. */
int
@@ -41,6 +46,7 @@ main (int argc, char **argv)
return 0;
runtime_isstarted = true;
+ __go_end = (uintptr)_end;
runtime_check ();
runtime_args (argc, (byte **) argv);
runtime_osinit ();
diff --git a/libgo/runtime/malloc.goc b/libgo/runtime/malloc.goc
index 473879c3da4..0d8629277f8 100644
--- a/libgo/runtime/malloc.goc
+++ b/libgo/runtime/malloc.goc
@@ -505,7 +505,8 @@ runtime_mallocinit(void)
{
byte *p, *p1;
uintptr arena_size, bitmap_size, spans_size, p_size;
- extern byte _end[];
+ uintptr *pend;
+ uintptr end;
uintptr limit;
uint64 i;
bool reserved;
@@ -613,7 +614,12 @@ runtime_mallocinit(void)
// So adjust it upward a little bit ourselves: 1/4 MB to get
// away from the running binary image and then round up
// to a MB boundary.
- p = (byte*)ROUND((uintptr)_end + (1<<18), 1<<20);
+
+ end = 0;
+ pend = &__go_end;
+ if(pend != nil)
+ end = *pend;
+ p = (byte*)ROUND(end + (1<<18), 1<<20);
p_size = bitmap_size + spans_size + arena_size + PageSize;
p = runtime_SysReserve(p, p_size, &reserved);
if(p == nil)
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index f4b170d2d0e..67242291db7 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -863,3 +863,4 @@ extern void _cgo_notify_runtime_init_done (void);
extern _Bool runtime_iscgo;
extern _Bool runtime_cgoHasExtraM;
extern Hchan *runtime_main_init_done;
+extern uintptr __go_end __attribute__ ((weak));