Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Commit 9645e7d

Browse files
authored
Merge pull request #558 from ibuclaw/updatephobos
Merge bug fixes from upstream Phobos
2 parents e50fa4c + 2216db3 commit 9645e7d

File tree

19 files changed

+530
-222
lines changed

19 files changed

+530
-222
lines changed

libphobos/libdruntime/core/stdc/fenv.d

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ version( GNUFP )
125125
alias fenv_t = double;
126126
alias fexcept_t = uint;
127127
}
128+
// https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/sparc/fpu/bits/fenv.h
129+
else version (SPARC64)
130+
{
131+
alias fenv_t = ulong;
132+
alias fexcept_t = ulong;
133+
}
128134
// https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/s390/fpu/bits/fenv.h
129135
else version (SystemZ)
130136
{

libphobos/libdruntime/core/sys/linux/dlfcn.d

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,30 @@ else version (AArch64)
206206
void _dl_mcount_wrapper_check(void* __selfpc);
207207
}
208208
}
209+
else version (SPARC64)
210+
{
211+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
212+
// enum RTLD_LAZY = 0x0001; // POSIX
213+
// enum RTLD_NOW = 0x0002; // POSIX
214+
enum RTLD_BINDING_MASK = 0x3;
215+
enum RTLD_NOLOAD = 0x00004;
216+
enum RTLD_DEEPBIND = 0x00008;
217+
218+
// enum RTLD_GLOBAL = 0x00100; // POSIX
219+
// enum RTLD_LOCAL = 0; // POSIX
220+
enum RTLD_NODELETE = 0x01000;
221+
222+
static if (__USE_GNU)
223+
{
224+
RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
225+
{
226+
_dl_mcount_wrapper_check(cast(void*)fctp);
227+
return fctp(args);
228+
}
229+
230+
void _dl_mcount_wrapper_check(void* __selfpc);
231+
}
232+
}
209233
else version (SystemZ)
210234
{
211235
// http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h

libphobos/libdruntime/core/sys/linux/epoll.d

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ else version (PPC64)
9595
epoll_data_t data;
9696
}
9797
}
98+
else version (MIPS32)
99+
{
100+
struct epoll_event
101+
{
102+
uint events;
103+
epoll_data_t data;
104+
}
105+
}
98106
else version (MIPS64)
99107
{
100108
struct epoll_event
@@ -103,6 +111,14 @@ else version (MIPS64)
103111
epoll_data_t data;
104112
}
105113
}
114+
else version (SPARC64)
115+
{
116+
struct epoll_event
117+
{
118+
uint events;
119+
epoll_data_t data;
120+
}
121+
}
106122
else version (SystemZ)
107123
{
108124
struct epoll_event

libphobos/libdruntime/core/sys/linux/link.d

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,16 @@ else version (AArch64)
6363
alias __WORDSIZE __ELF_NATIVE_CLASS;
6464
alias uint32_t Elf_Symndx;
6565
}
66-
else version (SystemZ)
66+
else version (SPARC64)
6767
{
6868
// http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
6969
alias __WORDSIZE __ELF_NATIVE_CLASS;
70+
alias uint32_t Elf_Symndx;
71+
}
72+
else version (SystemZ)
73+
{
74+
// https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/elfclass.h
75+
alias __WORDSIZE __ELF_NATIVE_CLASS;
7076
alias uint64_t Elf_Symndx;
7177
}
7278
else

libphobos/libdruntime/core/sys/linux/sys/eventfd.d

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ else version (AArch64)
7575
enum EFD_CLOEXEC = 0x80000; // octal!2000000
7676
enum EFD_NONBLOCK = 0x800; // octal!4000
7777
}
78+
else version (SPARC64)
79+
{
80+
enum EFD_SEMAPHORE = 1;
81+
enum EFD_CLOEXEC = 0x80000; // octal!2000000
82+
enum EFD_NONBLOCK = 0x800; // octal!4000
83+
}
7884
else version (SystemZ)
7985
{
8086
enum EFD_SEMAPHORE = 1;

libphobos/libdruntime/core/sys/linux/sys/inotify.d

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ else version (AArch64)
9393
enum IN_CLOEXEC = 0x80000; // octal!2000000
9494
enum IN_NONBLOCK = 0x800; // octal!4000
9595
}
96+
else version (SPARC64)
97+
{
98+
enum IN_CLOEXEC = 0x80000; // octal!2000000
99+
enum IN_NONBLOCK = 0x800; // octal!4000
100+
}
96101
else version (SystemZ)
97102
{
98103
enum IN_CLOEXEC = 0x80000; // octal!2000000

libphobos/libdruntime/core/sys/linux/sys/mman.d

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public import core.sys.posix.sys.mman;
1313
import core.sys.linux.config;
1414

1515
// <bits/mman.h>
16-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/powerpc/bits/mman.h
16+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/powerpc/bits/mman.h
1717
version (PPC)
1818
{
1919
enum PROT_SAO = 0x10;
@@ -38,7 +38,7 @@ version (PPC)
3838
// MCL_FUTURE = 0x4000,
3939
// }
4040
}
41-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/powerpc/bits/mman.h
41+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/powerpc/bits/mman.h
4242
else version (PPC64)
4343
{
4444
enum PROT_SAO = 0x10;
@@ -63,7 +63,7 @@ else version (PPC64)
6363
// MCL_FUTURE = 0x4000,
6464
// }
6565
}
66-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/s390/bits/mman.h
66+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/mman.h
6767
else version (S390)
6868
{
6969
static if (__USE_MISC) enum
@@ -79,7 +79,7 @@ else version (S390)
7979
MAP_HUGETLB = 0x40000,
8080
}
8181
}
82-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/s390/bits/mman.h
82+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/mman.h
8383
else version (SystemZ)
8484
{
8585
static if (__USE_MISC) enum
@@ -95,7 +95,7 @@ else version (SystemZ)
9595
MAP_HUGETLB = 0x40000,
9696
}
9797
}
98-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/sh/bits/mman.h
98+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sh/bits/mman.h
9999
else version (SH)
100100
{
101101
static if (__USE_MISC) enum
@@ -111,7 +111,7 @@ else version (SH)
111111
MAP_HUGETLB = 0x40000,
112112
}
113113
}
114-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
114+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
115115
else version (SPARC)
116116
{
117117
static if (__USE_MISC) enum
@@ -134,10 +134,8 @@ else version (SPARC)
134134
// MCL_CURRENT = 0x2000,
135135
// MCL_FUTURE = 0x4000,
136136
// }
137-
138-
static if (__USE_MISC) enum MAP_RENAME MAP_ANONYMOUS;
139137
}
140-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
138+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
141139
else version (SPARC64)
142140
{
143141
static if (__USE_MISC) enum
@@ -160,10 +158,8 @@ else version (SPARC64)
160158
// MCL_CURRENT = 0x2000,
161159
// MCL_FUTURE = 0x4000,
162160
// }
163-
164-
static if (__USE_MISC) enum MAP_RENAME MAP_ANONYMOUS;
165161
}
166-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/x86/bits/mman.h
162+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86/bits/mman.h
167163
else version (X86)
168164
{
169165
static if (__USE_MISC) enum MAP_32BIT = 0x40;
@@ -181,7 +177,7 @@ else version (X86)
181177
MAP_HUGETLB = 0x40000,
182178
}
183179
}
184-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/x86/bits/mman.h
180+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86/bits/mman.h
185181
else version (X86_64)
186182
{
187183
static if (__USE_MISC) enum MAP_32BIT = 0x40;
@@ -199,7 +195,7 @@ else version (X86_64)
199195
MAP_HUGETLB = 0x40000,
200196
}
201197
}
202-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/aarch64/bits/mman.h
198+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/aarch64/bits/mman.h
203199
else version (AArch64)
204200
{
205201
static if (__USE_MISC) enum
@@ -215,7 +211,7 @@ else version (AArch64)
215211
MAP_HUGETLB = 0x40000,
216212
}
217213
}
218-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/alpha/bits/mman.h
214+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/alpha/bits/mman.h
219215
else version (Alpha)
220216
{
221217
enum
@@ -307,7 +303,7 @@ else version (Alpha)
307303
// POSIX_MADV_DONTNEED = 6,
308304
// }
309305
}
310-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/arm/bits/mman.h
306+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/arm/bits/mman.h
311307
else version (ARM)
312308
{
313309
static if (__USE_MISC) enum
@@ -323,7 +319,7 @@ else version (ARM)
323319
MAP_HUGETLB = 0x40000,
324320
}
325321
}
326-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/hppa/bits/mman.h
322+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/hppa/bits/mman.h
327323
else version (HPPA)
328324
{
329325
enum
@@ -427,7 +423,7 @@ else version (HPPA)
427423
// POSIX_MADV_DONTNEED = 4,
428424
// }
429425
}
430-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/hppa/bits/mman.h
426+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/hppa/bits/mman.h
431427
else version (HPPA64)
432428
{
433429
enum
@@ -532,7 +528,7 @@ else version (HPPA64)
532528
// POSIX_MADV_DONTNEED = 4,
533529
// }
534530
}
535-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/ia64/bits/mman.h
531+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/ia64/bits/mman.h
536532
else version (IA64)
537533
{
538534
static if (__USE_MISC) enum
@@ -549,7 +545,7 @@ else version (IA64)
549545
MAP_HUGETLB = 0x40000,
550546
}
551547
}
552-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/m68k/bits/mman.h
548+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/m68k/bits/mman.h
553549
else version (M68K)
554550
{
555551
static if (__USE_MISC) enum
@@ -565,7 +561,7 @@ else version (M68K)
565561
MAP_HUGETLB = 0x40000,
566562
}
567563
}
568-
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
564+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
569565
else version (MIPS32)
570566
{
571567
static if (__USE_MISC) enum
@@ -580,10 +576,8 @@ else version (MIPS32)
580576
MAP_STACK = 0x40000,
581577
MAP_HUGETLB = 0x80000,
582578
}
583-
584-
static if (__USE_MISC) enum MAP_RENAME = MAP_ANONYMOUS;
585579
}
586-
// https://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
580+
// https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
587581
else version (MIPS64)
588582
{
589583
static if (__USE_MISC) enum
@@ -598,16 +592,14 @@ else version (MIPS64)
598592
MAP_STACK = 0x40000,
599593
MAP_HUGETLB = 0x80000,
600594
}
601-
602-
static if (__USE_MISC) enum MAP_RENAME = MAP_ANONYMOUS;
603595
}
604596
else
605597
{
606598
static assert(0, "unimplemented");
607599
}
608600

609601

610-
// https://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=bits/mman-linux.h
602+
// https://sourceware.org/git/?p=glibc.git;a=blob;f=bits/mman-linux.h
611603
version (Alpha)
612604
{
613605
}
@@ -696,6 +688,28 @@ else
696688
// }
697689
}
698690

691+
// Workaround https://issues.dlang.org/show_bug.cgi?id=17883
692+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
693+
version (SPARC)
694+
{
695+
static if (__USE_MISC) enum MAP_RENAME = MAP_ANONYMOUS;
696+
}
697+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
698+
else version (SPARC64)
699+
{
700+
static if (__USE_MISC) enum MAP_RENAME = MAP_ANONYMOUS;
701+
}
702+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
703+
else version (MIPS32)
704+
{
705+
static if (__USE_MISC) enum MAP_RENAME = MAP_ANONYMOUS;
706+
}
707+
// https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
708+
else version (MIPS64)
709+
{
710+
static if (__USE_MISC) enum MAP_RENAME = MAP_ANONYMOUS;
711+
}
712+
699713
// http://sourceware.org/git/?p=glibc.git;a=blob;f=misc/sys/mman.h
700714
// in core.sys.posix.sys.mman
701715
// static if (__USE_LARGEFILE64) void* mmap64(void*, size_t, int, int, int, off_t);

libphobos/libdruntime/core/sys/posix/dlfcn.d

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ version( CRuntime_Glibc )
103103
enum RTLD_GLOBAL = 0x00100;
104104
enum RTLD_LOCAL = 0;
105105
}
106+
else version (SPARC64)
107+
{
108+
enum RTLD_LAZY = 0x00001;
109+
enum RTLD_NOW = 0x00002;
110+
enum RTLD_GLOBAL = 0x00100;
111+
enum RTLD_LOCAL = 0;
112+
}
106113
else version (SystemZ)
107114
{
108115
enum RTLD_LAZY = 0x00001;

libphobos/libdruntime/core/sys/posix/setjmp.d

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ version( CRuntime_Glibc )
5858

5959
alias int[6] __jmp_buf;
6060
}
61-
else version ( SPARC )
61+
else version (SPARC)
6262
{
6363
alias int[3] __jmp_buf;
6464
}
65+
else version (SPARC64)
66+
{
67+
alias __jmp_buf = ulong[22];
68+
}
6569
else version (AArch64)
6670
{
6771
alias long[22] __jmp_buf;
@@ -78,7 +82,7 @@ version( CRuntime_Glibc )
7882
{
7983
alias long[64] __jmp_buf;
8084
}
81-
else version (MIPS)
85+
else version (MIPS32)
8286
{
8387
struct __jmp_buf
8488
{

0 commit comments

Comments
 (0)