aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2019-04-23 22:53:25 +0000
committerIain Buclaw <ibuclaw@gcc.gnu.org>2019-04-23 22:53:25 +0000
commit130cc10e2178fd7dcd9b6cabd64008f7c24821c7 (patch)
treeb07fa89734c6f2b88d692e3c6de1be7495b87174
parentd9392bfa032b448839abadb523aff65b8ccb3dba (diff)
libphobos: Add D support for S/390 Linux
gcc/d/ChangeLog: 2019-04-23 Iain Buclaw <ibuclaw@gdcproject.org> Robin Dapp <rdapp@linux.ibm.com> * typeinfo.cc (create_typeinfo): Write typeinfo flags as uint. gcc/testsuite/ChangeLog: 2019-04-23 Iain Buclaw <ibuclaw@gdcproject.org> Robin Dapp <rdapp@linux.ibm.com> * gdc.dg/link.d: Test if target d_runtime. * gdc.dg/runnable.d: Fix tests to work on BigEndian. * gdc.dg/simd.d: Likewise. libphobos/ChangeLog: 2019-04-23 Iain Buclaw <ibuclaw@gdcproject.org> Robin Dapp <rdapp@linux.ibm.com> * configure.tgt: Add s390*-linux* as a supported target. * libdruntime/gcc/sections/elf_shared.d: import gcc.builtins. (__tls_get_addr_internal): Declare. (TLS_DTV_OFFSET): Define as zero on SystemZ. (getTLSRange): Support getting TLS on SystemZ. * testsuite/libphobos.typeinfo/struct-align.d: New test. Co-Authored-By: Robin Dapp <rdapp@linux.ibm.com> From-SVN: r270523
-rw-r--r--gcc/d/ChangeLog5
-rw-r--r--gcc/d/typeinfo.cc12
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gdc.dg/link.d2
-rw-r--r--gcc/testsuite/gdc.dg/runnable.d13
-rw-r--r--gcc/testsuite/gdc.dg/simd.d5
-rw-r--r--libphobos/ChangeLog10
-rw-r--r--libphobos/configure.tgt3
-rw-r--r--libphobos/libdruntime/gcc/sections/elf_shared.d13
-rw-r--r--libphobos/testsuite/libphobos.typeinfo/struct-align.d13
10 files changed, 70 insertions, 13 deletions
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index de191cb7a02..a0a3266f1a2 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,4 +1,9 @@
2019-04-23 Iain Buclaw <ibuclaw@gdcproject.org>
+ Robin Dapp <rdapp@linux.ibm.com>
+
+ * typeinfo.cc (create_typeinfo): Write typeinfo flags as uint.
+
+2019-04-23 Iain Buclaw <ibuclaw@gdcproject.org>
* d-builtins.cc (d_init_versions): Add D_BetterC, D_ModuleInfo,
D_Exceptions, D_TypeInfo as predefined version conditions.
diff --git a/gcc/d/typeinfo.cc b/gcc/d/typeinfo.cc
index ffa7e237865..bbd3961181d 100644
--- a/gcc/d/typeinfo.cc
+++ b/gcc/d/typeinfo.cc
@@ -860,7 +860,7 @@ public:
flags |= ClassFlags::noPointers;
Lhaspointers:
- this->layout_field (size_int (flags));
+ this->layout_field (build_integer_cst (flags, d_uint_type));
/* void *deallocator; */
tree ddtor = (cd->aggDelete)
@@ -916,7 +916,7 @@ public:
if (cd->isCOMinterface ())
flags |= ClassFlags::isCOMclass;
- this->layout_field (size_int (flags));
+ this->layout_field (build_integer_cst (flags, d_uint_type));
/* void *deallocator;
OffsetTypeInfo[] m_offTi; (not implemented)
@@ -1049,7 +1049,7 @@ public:
StructFlags::Type m_flags = 0;
if (ti->hasPointers ())
m_flags |= StructFlags::hasPointers;
- this->layout_field (size_int (m_flags));
+ this->layout_field (build_integer_cst (m_flags, d_uint_type));
/* void function(void*) xdtor; */
tree dtor = (sd->dtor) ? build_address (get_symbol_decl (sd->dtor))
@@ -1063,7 +1063,7 @@ public:
this->layout_field (null_pointer_node);
/* uint m_align; */
- this->layout_field (size_int (ti->alignsize ()));
+ this->layout_field (build_integer_cst (ti->alignsize (), d_uint_type));
if (global.params.is64bit)
{
@@ -1531,8 +1531,8 @@ create_typeinfo (Type *type, Module *mod)
array_type_node, array_type_node,
ptr_type_node, ptr_type_node,
ptr_type_node, ptr_type_node,
- size_type_node, ptr_type_node,
- ptr_type_node, size_type_node,
+ d_uint_type, ptr_type_node,
+ ptr_type_node, d_uint_type,
ptr_type_node, argtype, argtype, NULL);
}
t->vtinfo = TypeInfoStructDeclaration::create (t);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 22145fb0cb3..66d0b6f7562 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,4 +1,11 @@
2019-04-23 Iain Buclaw <ibuclaw@gdcproject.org>
+ Robin Dapp <rdapp@linux.ibm.com>
+
+ * gdc.dg/link.d: Test if target d_runtime.
+ * gdc.dg/runnable.d: Fix tests to work on BigEndian.
+ * gdc.dg/simd.d: Likewise.
+
+2019-04-23 Iain Buclaw <ibuclaw@gdcproject.org>
* gdc.test/fail_compilation/fail2456.d: New test.
* gdc.test/fail_compilation/test18312.d: New test.
diff --git a/gcc/testsuite/gdc.dg/link.d b/gcc/testsuite/gdc.dg/link.d
index a8e1da15511..a8ca4ed5cb6 100644
--- a/gcc/testsuite/gdc.dg/link.d
+++ b/gcc/testsuite/gdc.dg/link.d
@@ -1,4 +1,4 @@
-// { dg-do link { target arm*-*-* i?86-*-* x86_64-*-* } }
+// { dg-do link { target d_runtime } }
/******************************************/
diff --git a/gcc/testsuite/gdc.dg/runnable.d b/gcc/testsuite/gdc.dg/runnable.d
index e36a2585027..484a9709bf3 100644
--- a/gcc/testsuite/gdc.dg/runnable.d
+++ b/gcc/testsuite/gdc.dg/runnable.d
@@ -890,12 +890,17 @@ struct S186
}
}
+static if (size_t.sizeof == 8)
+ enum checkval = 0x0200000000000002;
+else
+ enum checkval = 0x02000002;
+
void check186(in S186 obj, byte fieldB)
{
assert(obj.fieldA == 2);
assert(obj.fieldB == 0);
assert(obj.fieldC == 0);
- assert(obj._complete == 2);
+ assert(obj._complete == checkval);
assert(fieldB == 0);
}
@@ -907,7 +912,7 @@ void test186a(size_t val)
assert(obj.fieldA == 2);
assert(obj.fieldB == 0);
assert(obj.fieldC == 0);
- assert(obj._complete == 2);
+ assert(obj._complete == checkval);
obj = S186(val);
check186(obj, obj.fieldB);
@@ -915,12 +920,12 @@ void test186a(size_t val)
assert(obj.fieldA == 2);
assert(obj.fieldB == 0);
assert(obj.fieldC == 0);
- assert(obj._complete == 2);
+ assert(obj._complete == checkval);
}
void test186()
{
- test186a(2);
+ test186a(checkval);
}
/******************************************/
diff --git a/gcc/testsuite/gdc.dg/simd.d b/gcc/testsuite/gdc.dg/simd.d
index 812b36649aa..439c446837a 100644
--- a/gcc/testsuite/gdc.dg/simd.d
+++ b/gcc/testsuite/gdc.dg/simd.d
@@ -1576,7 +1576,10 @@ ubyte[16] foounsto()
void testOPvecunsto()
{
auto a = foounsto();
- assert(a == [0, 0, 64, 65, 0, 0, 64, 65, 0, 0, 64, 65, 0, 0, 64, 65]);
+ version (LittleEndian)
+ assert(a == [0, 0, 64, 65, 0, 0, 64, 65, 0, 0, 64, 65, 0, 0, 64, 65]);
+ version (BigEndian)
+ assert(a == [65, 64, 0, 0, 65, 64, 0, 0, 65, 64, 0, 0, 65, 64, 0, 0]);
}
/*****************************************/
diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog
index 1f5ea28ddf7..e7d3319b21d 100644
--- a/libphobos/ChangeLog
+++ b/libphobos/ChangeLog
@@ -1,4 +1,14 @@
2019-04-23 Iain Buclaw <ibuclaw@gdcproject.org>
+ Robin Dapp <rdapp@linux.ibm.com>
+
+ * configure.tgt: Add s390*-linux* as a supported target.
+ * libdruntime/gcc/sections/elf_shared.d: import gcc.builtins.
+ (__tls_get_addr_internal): Declare.
+ (TLS_DTV_OFFSET): Define as zero on SystemZ.
+ (getTLSRange): Support getting TLS on SystemZ.
+ * testsuite/libphobos.typeinfo/struct-align.d: New test.
+
+2019-04-23 Iain Buclaw <ibuclaw@gdcproject.org>
* configure.tgt: Add linux/riscv as supported target.
* libdruntime/gcc/sections/elf_shared.d (getDependencies): Adjust
diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt
index 5deba2a9961..a53a3c3c3be 100644
--- a/libphobos/configure.tgt
+++ b/libphobos/configure.tgt
@@ -32,6 +32,9 @@ case "${target}" in
riscv*-*-linux*)
LIBPHOBOS_SUPPORTED=yes
;;
+ s390*-linux*)
+ LIBPHOBOS_SUPPORTED=yes
+ ;;
x86_64-*-kfreebsd*-gnu | i?86-*-kfreebsd*-gnu)
LIBPHOBOS_SUPPORTED=yes
;;
diff --git a/libphobos/libdruntime/gcc/sections/elf_shared.d b/libphobos/libdruntime/gcc/sections/elf_shared.d
index 89adcea889e..d92e4cd9c4e 100644
--- a/libphobos/libdruntime/gcc/sections/elf_shared.d
+++ b/libphobos/libdruntime/gcc/sections/elf_shared.d
@@ -77,6 +77,7 @@ else
static assert(0, "unimplemented");
}
import core.sys.posix.pthread;
+import gcc.builtins;
import gcc.config;
import rt.deh;
import rt.dmain2;
@@ -992,6 +993,7 @@ struct tls_index
}
extern(C) void* __tls_get_addr(tls_index* ti) nothrow @nogc;
+extern(C) void* __tls_get_addr_internal(tls_index* ti) nothrow @nogc;
/* The dynamic thread vector (DTV) pointers may point 0x8000 past the start of
* each TLS block. This is at least true for PowerPC and Mips platforms.
@@ -1025,6 +1027,8 @@ else version (MIPS32)
enum TLS_DTV_OFFSET = 0x8000;
else version (MIPS64)
enum TLS_DTV_OFFSET = 0x8000;
+else version (SystemZ)
+ enum TLS_DTV_OFFSET = 0x0;
else
static assert( false, "Platform not supported." );
@@ -1041,5 +1045,12 @@ void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc
// base offset
auto ti = tls_index(mod, 0);
- return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz];
+ version (SystemZ)
+ {
+ auto idx = cast(void *)__tls_get_addr_internal(&ti)
+ + cast(ulong)__builtin_thread_pointer();
+ return idx[0 .. sz];
+ }
+ else
+ return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz];
}
diff --git a/libphobos/testsuite/libphobos.typeinfo/struct-align.d b/libphobos/testsuite/libphobos.typeinfo/struct-align.d
new file mode 100644
index 00000000000..72866517481
--- /dev/null
+++ b/libphobos/testsuite/libphobos.typeinfo/struct-align.d
@@ -0,0 +1,13 @@
+module structalign;
+
+void main ()
+{
+ struct K { int *a; };
+ K k;
+ auto ti = typeid (k);
+
+ assert (ti.flags () == 1);
+
+ auto ti2 = typeid (k.a);
+ assert (ti.talign () == ti2.talign ());
+}