aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/go-unsafe-pointer.c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2014-06-04 23:15:33 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2014-06-04 23:15:33 +0000
commitbae90c989cb020d17a24919ec84c0b8dd2fae2da (patch)
tree89766166feb4ceca2d983169c5360e3f6f521b12 /libgo/runtime/go-unsafe-pointer.c
parent82b3da6a714493644a4333bfd8205e3341ed3b8e (diff)
downloadgcc-bae90c989cb020d17a24919ec84c0b8dd2fae2da.zip
gcc-bae90c989cb020d17a24919ec84c0b8dd2fae2da.tar.gz
gcc-bae90c989cb020d17a24919ec84c0b8dd2fae2da.tar.bz2
libgo: Merge from revision 18783:00cce3a34d7e of master library.
This revision was committed January 7, 2014. The next revision deleted runtime/mfinal.c. That will be done in a subsequent merge. This merge changes type descriptors to add a zero field, pointing to a zero value for that type. This is implemented as a common variable. * go-gcc.cc (Gcc_backend::implicit_variable): Add is_common and alignment parameters. Permit init parameter to be NULL. From-SVN: r211249
Diffstat (limited to 'libgo/runtime/go-unsafe-pointer.c')
-rw-r--r--libgo/runtime/go-unsafe-pointer.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libgo/runtime/go-unsafe-pointer.c b/libgo/runtime/go-unsafe-pointer.c
index ca1d253..b71804a 100644
--- a/libgo/runtime/go-unsafe-pointer.c
+++ b/libgo/runtime/go-unsafe-pointer.c
@@ -9,6 +9,9 @@
#include "runtime.h"
#include "go-type.h"
+/* A pointer with a zero value. */
+static void *zero_pointer;
+
/* This file provides the type descriptor for the unsafe.Pointer type.
The unsafe package is defined by the compiler itself, which means
that there is no package to compile to define the type
@@ -53,7 +56,9 @@ const struct __go_type_descriptor unsafe_Pointer =
/* __uncommon */
NULL,
/* __pointer_to_this */
- NULL
+ NULL,
+ /* __zero */
+ &zero_pointer
};
/* We also need the type descriptor for the pointer to unsafe.Pointer,
@@ -94,7 +99,9 @@ const struct __go_ptr_type pointer_unsafe_Pointer =
/* __uncommon */
NULL,
/* __pointer_to_this */
- NULL
+ NULL,
+ /* __zero */
+ &zero_pointer
},
/* __element_type */
&unsafe_Pointer