Skip to content

Commit 48a8204

Browse files
committed
Merge pull request #535 from redstar/ppc64
Add types and constants for Linux/PPC64.
2 parents 3e51a55 + 0529212 commit 48a8204

File tree

6 files changed

+107
-0
lines changed

6 files changed

+107
-0
lines changed

src/core/sys/linux/dlfcn.d

+24
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,30 @@ else version (MIPS32)
8585
void _dl_mcount_wrapper_check(void* __selfpc);
8686
}
8787
}
88+
else version (PPC64)
89+
{
90+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/mips/bits/dlfcn.h
91+
// enum RTLD_LAZY = 0x0001; // POSIX
92+
// enum RTLD_NOW = 0x0002; // POSIX
93+
enum RTLD_BINDING_MASK = 0x3;
94+
enum RTLD_NOLOAD = 0x00004;
95+
enum RTLD_DEEPBIND = 0x00008;
96+
97+
// enum RTLD_GLOBAL = 0x00100; // POSIX
98+
// enum RTLD_LOCAL = 0; // POSIX
99+
enum RTLD_NODELETE = 0x01000;
100+
101+
static if (__USE_GNU)
102+
{
103+
RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
104+
{
105+
_dl_mcount_wrapper_check(cast(void*)fctp);
106+
return fctp(args);
107+
}
108+
109+
void _dl_mcount_wrapper_check(void* __selfpc);
110+
}
111+
}
88112
else
89113
static assert(0, "unimplemented");
90114

src/core/sys/linux/link.d

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ else version (MIPS32)
3333
alias __WORDSIZE __ELF_NATIVE_CLASS;
3434
alias uint32_t Elf_Symndx;
3535
}
36+
else version (PPC64)
37+
{
38+
// http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
39+
alias __WORDSIZE __ELF_NATIVE_CLASS;
40+
alias uint32_t Elf_Symndx;
41+
}
3642
else
3743
static assert(0, "unimplemented");
3844
// <bits/elfclass.h>

src/core/sys/posix/dlfcn.d

+7
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ version( linux )
5757
enum RTLD_GLOBAL = 0x0004;
5858
enum RTLD_LOCAL = 0;
5959
}
60+
else version (PPC64)
61+
{
62+
enum RTLD_LAZY = 0x00001;
63+
enum RTLD_NOW = 0x00002;
64+
enum RTLD_GLOBAL = 0x00100;
65+
enum RTLD_LOCAL = 0;
66+
}
6067
else
6168
static assert(0, "unimplemented");
6269

src/core/sys/posix/signal.d

+34
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,30 @@ version( linux )
185185
enum SIGUSR2 = 17;
186186
enum SIGURG = 21;
187187
}
188+
else version (PPC64)
189+
{
190+
//SIGABRT (defined in core.stdc.signal)
191+
enum SIGALRM = 14;
192+
enum SIGBUS = 7;
193+
enum SIGCHLD = 17;
194+
enum SIGCONT = 18;
195+
//SIGFPE (defined in core.stdc.signal)
196+
enum SIGHUP = 1;
197+
//SIGILL (defined in core.stdc.signal)
198+
//SIGINT (defined in core.stdc.signal)
199+
enum SIGKILL = 9;
200+
enum SIGPIPE = 13;
201+
enum SIGQUIT = 3;
202+
//SIGSEGV (defined in core.stdc.signal)
203+
enum SIGSTOP = 19;
204+
//SIGTERM (defined in core.stdc.signal)
205+
enum SIGTSTP = 20;
206+
enum SIGTTIN = 21;
207+
enum SIGTTOU = 22;
208+
enum SIGUSR1 = 10;
209+
enum SIGUSR2 = 12;
210+
enum SIGURG = 23;
211+
}
188212
else
189213
static assert(0, "unimplemented");
190214
}
@@ -860,6 +884,16 @@ version( linux )
860884
enum SIGXCPU = 30;
861885
enum SIGXFSZ = 31;
862886
}
887+
else version (PPC64)
888+
{
889+
enum SIGPOLL = 29;
890+
enum SIGPROF = 27;
891+
enum SIGSYS = 31;
892+
enum SIGTRAP = 5;
893+
enum SIGVTALRM = 26;
894+
enum SIGXCPU = 24;
895+
enum SIGXFSZ = 25;
896+
}
863897
else
864898
static assert(0, "unimplemented");
865899

src/core/sys/posix/sys/mman.d

+2
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ version( linux )
190190
enum MAP_ANON = 0x20; // non-standard
191191
else version (MIPS32)
192192
enum MAP_ANON = 0x0800; // non-standard
193+
else version (PPC64)
194+
enum MAP_ANON = 0x20; // non-standard
193195
else
194196
static assert(0, "unimplemented");
195197

src/core/sys/posix/sys/socket.d

+34
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,40 @@ version( linux )
310310
SO_TYPE = 0x1008,
311311
}
312312
}
313+
else version (PPC64)
314+
{
315+
enum
316+
{
317+
SOCK_DGRAM = 2,
318+
SOCK_SEQPACKET = 5,
319+
SOCK_STREAM = 1
320+
}
321+
322+
enum
323+
{
324+
SOL_SOCKET = 1
325+
}
326+
327+
enum
328+
{
329+
SO_ACCEPTCONN = 30,
330+
SO_BROADCAST = 6,
331+
SO_DEBUG = 1,
332+
SO_DONTROUTE = 5,
333+
SO_ERROR = 4,
334+
SO_KEEPALIVE = 9,
335+
SO_LINGER = 13,
336+
SO_OOBINLINE = 10,
337+
SO_RCVBUF = 8,
338+
SO_RCVLOWAT = 16,
339+
SO_RCVTIMEO = 18,
340+
SO_REUSEADDR = 2,
341+
SO_SNDBUF = 7,
342+
SO_SNDLOWAT = 17,
343+
SO_SNDTIMEO = 19,
344+
SO_TYPE = 3
345+
}
346+
}
313347
else
314348
static assert(0, "unimplemented");
315349

0 commit comments

Comments
 (0)