libphobos: Fix multilib builds for s390x-linux-gnu

Merges upstream druntime aab44549, phobos 3dc363783.

Reviewed-on: https://github.com/dlang/druntime/pull/2590
	     https://github.com/dlang/phobos/pull/6983

libphobos/ChangeLog:

2019-04-28  Iain Buclaw  <ibuclaw@gdcproject.org>

	* libdruntime/gcc/sections/elf_shared.d (IBMZ_Any): Define when
	version S390 or SystemZ.  Use condition instead of SystemZ.
	(getTLSRange): Return null on GNU_EMUTLS targets.

From-SVN: r270639
This commit is contained in:
Iain Buclaw 2019-04-29 05:42:48 +00:00
parent be79ec008e
commit ca0ddb398f
8 changed files with 124 additions and 23 deletions

View File

@ -1,4 +1,4 @@
1ca80e4e0cf460575752a0c157ca52c184f4b982 aab44549221cb29434fe2feccaf1174af54dd79d
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the dlang/druntime repository. merge done from the dlang/druntime repository.

View File

@ -18,8 +18,10 @@ version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any; version (PPC64) version = PPC_Any;
version (RISCV32) version = RISCV_Any; version (RISCV32) version = RISCV_Any;
version (RISCV64) version = RISCV_Any; version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any; version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any; version (SPARC64) version = SPARC_Any;
version (SystemZ) version = IBMZ_Any;
version (X86) version = X86_Any; version (X86) version = X86_Any;
version (X86_64) version = X86_Any; version (X86_64) version = X86_Any;
@ -71,11 +73,14 @@ else version (SPARC_Any)
alias __WORDSIZE __ELF_NATIVE_CLASS; alias __WORDSIZE __ELF_NATIVE_CLASS;
alias uint32_t Elf_Symndx; alias uint32_t Elf_Symndx;
} }
else version (SystemZ) else version (IBMZ_Any)
{ {
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/elfclass.h // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/elfclass.h
alias __WORDSIZE __ELF_NATIVE_CLASS; alias __WORDSIZE __ELF_NATIVE_CLASS;
static if (__WORDSIZE == 64)
alias uint64_t Elf_Symndx; alias uint64_t Elf_Symndx;
else
alias uint32_t Elf_Symndx;
} }
else else
static assert(0, "unimplemented"); static assert(0, "unimplemented");

View File

@ -153,6 +153,15 @@ version (CRuntime_Glibc)
} }
alias __jmp_buf = __riscv_jmp_buf[1]; alias __jmp_buf = __riscv_jmp_buf[1];
} }
else version (S390)
{
struct __s390_jmp_buf
{
c_long[10] __gregs;
c_long[4] __fpregs;
}
alias __jmp_buf = __s390_jmp_buf[1];
}
else version (SystemZ) else version (SystemZ)
{ {
struct __s390_jmp_buf struct __s390_jmp_buf

View File

@ -791,6 +791,82 @@ version (CRuntime_Glibc)
} }
static assert(stat_t.sizeof == 144); static assert(stat_t.sizeof == 144);
} }
else version (S390)
{
private
{
alias __dev_t = ulong;
alias __ino_t = c_ulong;
alias __ino64_t = ulong;
alias __mode_t = uint;
alias __nlink_t = uint;
alias __uid_t = uint;
alias __gid_t = uint;
alias __off_t = c_long;
alias __off64_t = long;
alias __blksize_t = c_long;
alias __blkcnt_t = c_long;
alias __blkcnt64_t = long;
alias __timespec = timespec;
alias __time_t = time_t;
}
struct stat_t
{
__dev_t st_dev;
uint __pad1;
static if (!__USE_FILE_OFFSET64)
__ino_t st_ino;
else
__ino_t __st_ino;
__mode_t st_mode;
__nlink_t st_nlink;
__uid_t st_uid;
__gid_t st_gid;
__dev_t st_rdev;
uint __pad2;
static if (!__USE_FILE_OFFSET64)
__off_t st_size;
else
__off64_t st_size;
__blksize_t st_blksize;
static if (!__USE_FILE_OFFSET64)
__blkcnt_t st_blocks;
else
__blkcnt64_t st_blocks;
static if (__USE_XOPEN2K8)
{
__timespec st_atim;
__timespec st_mtim;
__timespec st_ctim;
extern(D)
{
@property ref time_t st_atime() { return st_atim.tv_sec; }
@property ref time_t st_mtime() { return st_mtim.tv_sec; }
@property ref time_t st_ctime() { return st_ctim.tv_sec; }
}
}
else
{
__time_t st_atime;
c_ulong st_atimensec;
__time_t st_mtime;
c_ulong st_mtimensec;
__time_t st_ctime;
c_ulong st_ctimensec;
}
static if (!__USE_FILE_OFFSET64)
{
c_ulong __glibc_reserved4;
c_ulong __glibc_reserved5;
}
else
__ino64_t st_ino;
}
static if (__USE_FILE_OFFSET64)
static assert(stat_t.sizeof == 104);
else
static assert(stat_t.sizeof == 88);
}
else version (SystemZ) else version (SystemZ)
{ {
private private

View File

@ -25,8 +25,10 @@ nothrow:
version (RISCV32) version = RISCV_Any; version (RISCV32) version = RISCV_Any;
version (RISCV64) version = RISCV_Any; version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any; version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any; version (SPARC64) version = SPARC_Any;
version (SystemZ) version = IBMZ_Any;
version (X86) version = X86_Any; version (X86) version = X86_Any;
version (X86_64) version = X86_Any; version (X86_64) version = X86_Any;
@ -719,7 +721,7 @@ version (CRuntime_Glibc)
alias greg_t = c_ulong; alias greg_t = c_ulong;
alias gregset_t = greg_t[NGREG]; alias gregset_t = greg_t[NGREG];
} }
else version (SystemZ) else version (IBMZ_Any)
{ {
public import core.sys.posix.signal : sigset_t; public import core.sys.posix.signal : sigset_t;

View File

@ -24,6 +24,8 @@ module gcc.sections.elf_shared;
version (RISCV32) version = RISCV_Any; version (RISCV32) version = RISCV_Any;
version (RISCV64) version = RISCV_Any; version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SystemZ) version = IBMZ_Any;
version (CRuntime_Glibc) enum SharedELF = true; version (CRuntime_Glibc) enum SharedELF = true;
else version (CRuntime_Musl) enum SharedELF = true; else version (CRuntime_Musl) enum SharedELF = true;
@ -1060,7 +1062,7 @@ else version (MIPS32)
enum TLS_DTV_OFFSET = 0x8000; enum TLS_DTV_OFFSET = 0x8000;
else version (MIPS64) else version (MIPS64)
enum TLS_DTV_OFFSET = 0x8000; enum TLS_DTV_OFFSET = 0x8000;
else version (SystemZ) else version (IBMZ_Any)
enum TLS_DTV_OFFSET = 0x0; enum TLS_DTV_OFFSET = 0x0;
else else
static assert( false, "Platform not supported." ); static assert( false, "Platform not supported." );
@ -1070,6 +1072,10 @@ void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc
if (mod == 0) if (mod == 0)
return null; return null;
version (GNU_EMUTLS)
return null; // Handled in scanTLSRanges().
else
{
version (Solaris) version (Solaris)
{ {
static if (!OS_Have_Dlpi_Tls_Modid) static if (!OS_Have_Dlpi_Tls_Modid)
@ -1078,7 +1084,7 @@ void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc
// base offset // base offset
auto ti = tls_index(mod, 0); auto ti = tls_index(mod, 0);
version (SystemZ) version (IBMZ_Any)
{ {
auto idx = cast(void *)__tls_get_addr_internal(&ti) auto idx = cast(void *)__tls_get_addr_internal(&ti)
+ cast(ulong)__builtin_thread_pointer(); + cast(ulong)__builtin_thread_pointer();
@ -1086,4 +1092,5 @@ void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc
} }
else else
return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz]; return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz];
}
} }

View File

@ -1,4 +1,4 @@
b5e9661a089b6514e01fa5195c0f2bc9cc06eddd 3dc363783ea7b1e82336983486a14f3f44bbeadd
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the dlang/phobos repository. merge done from the dlang/phobos repository.

View File

@ -160,8 +160,10 @@ version (MIPS32) version = MIPS_Any;
version (MIPS64) version = MIPS_Any; version (MIPS64) version = MIPS_Any;
version (AArch64) version = ARM_Any; version (AArch64) version = ARM_Any;
version (ARM) version = ARM_Any; version (ARM) version = ARM_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any; version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any; version (SPARC64) version = SPARC_Any;
version (SystemZ) version = IBMZ_Any;
version (RISCV32) version = RISCV_Any; version (RISCV32) version = RISCV_Any;
version (RISCV64) version = RISCV_Any; version (RISCV64) version = RISCV_Any;
@ -5241,7 +5243,7 @@ struct FloatingPointControl
| inexactException, | inexactException,
} }
} }
else version (SystemZ) else version (IBMZ_Any)
{ {
enum : ExceptionMask enum : ExceptionMask
{ {
@ -5379,7 +5381,7 @@ private:
{ {
alias ControlState = ulong; alias ControlState = ulong;
} }
else version (SystemZ) else version (IBMZ_Any)
{ {
alias ControlState = uint; alias ControlState = uint;
} }