2626        __APPLE__       Mac OSX 
2727        __FreeBSD__     FreeBSD 
2828        __OpenBSD__     OpenBSD 
29+         __DragonFly__   DragonFlyBSD 
2930        __sun           Solaris, OpenSolaris, SunOS, OpenIndiana, etc 
3031        __OS2__         IBM OS/2 
3132        DOS386          32 bit DOS extended executable 
@@ -126,6 +127,23 @@ One and only one of these macros must be set by the makefile:
126127 * with these goals, and should be fixed. 
127128 */ 
128129
130+ /* DragonFlyBSD Version 
131+  * ------------- 
132+  * There are two main issues: hosting the compiler on OpenBSD, 
133+  * and generating (targetting) OpenBSD executables. 
134+  * The "__DragonFly__" and "__GNUC__" macros control hosting issues 
135+  * for operating system and compiler dependencies, respectively. 
136+  * To target DragonFlyBSD executables, use ELFOBJ for things specific to the 
137+  * ELF object file format, and TARGET_DRAGONFLYBSD for things specific to 
138+  * the DragonFlyBSD memory model. 
139+  * If this is all done right, one could generate a DragonFlyBSD object file 
140+  * even when compiling on linux/windows/osx etc, and vice versa. 
141+  * The compiler source code currently uses these macros very inconsistently 
142+  * with these goals, and should be fixed. 
143+  * 
144+  * DMD was Ported to DragonFlyBSD by Diederik de Groot <ddegroot [at] talon.nl> 
145+  */ 
146+ 
129147/* Solaris Version 
130148 * ------------- 
131149 * There are two main issues: hosting the compiler on Solaris, 
@@ -186,14 +204,19 @@ One and only one of these macros must be set by the makefile:
186204#define  TARGET_OPENBSD   0               // target is an OpenBSD executable
187205#endif 
188206
207+ // Set to 1 using the makefile 
208+ #ifndef  TARGET_DRAGONFLYBSD 
209+ #define  TARGET_DRAGONFLYBSD   0          // target is a DragonFlyBSD executable
210+ #endif 
211+ 
189212// Set to 1 using the makefile 
190213#ifndef  TARGET_SOLARIS 
191214#define  TARGET_SOLARIS   0               // target is a Solaris executable
192215#endif 
193216
194217// This is the default 
195218#ifndef  TARGET_WINDOS 
196- #define  TARGET_WINDOS    (!(TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS))
219+ #define  TARGET_WINDOS    (!(TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD ||  TARGET_SOLARIS))
197220#endif 
198221
199222#if  __GNUC__ 
@@ -296,7 +319,7 @@ typedef long double longdouble;
296319
297320// Precompiled header variations 
298321#define  MEMORYHX         (_WINDLL && _WIN32)     // HX and SYM files are cached in memory
299- #define  MMFIO            (_WIN32 || __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun)  // if memory mapped files
322+ #define  MMFIO            (_WIN32 || __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ ||  __sun)  // if memory mapped files
300323#define  LINEARALLOC      _WIN32  // if we can reserve address ranges
301324
302325// H_STYLE takes on one of these precompiled header methods 
503526{
504527    CHARSIZE        =  1 ,
505528    SHORTSIZE       =  2 ,
506-     WCHARSIZE       =  2 ,       // 2 for WIN32, 4 for linux/OSX/FreeBSD/OpenBSD/Solaris 
529+     WCHARSIZE       =  2 ,       // 2 for WIN32, 4 for linux/OSX/FreeBSD/OpenBSD/DragonFlyBSD/ Solaris 
507530    LONGSIZE        =  4 ,
508531    LLONGSIZE       =  8 ,
509532    CENTSIZE        =  16 ,
519542#define  REGMASK          0xFFFF
520543
521544// targ_llong is also used to store host pointers, so it should have at least their size 
522- #if  TARGET_LINUX  ||  TARGET_FREEBSD  ||  TARGET_OPENBSD  ||  TARGET_SOLARIS  ||  TARGET_OSX  ||  MARS 
545+ #if  TARGET_LINUX  ||  TARGET_FREEBSD  ||  TARGET_OPENBSD  ||  TARGET_DRAGONFLYBSD   ||   TARGET_SOLARIS  ||  TARGET_OSX  ||  MARS 
523546typedef  targ_llong       targ_ptrdiff_t ; /* ptrdiff_t for target machine  */ 
524547typedef  targ_ullong      targ_size_t ;    /* size_t for the target machine */ 
525548#else 
@@ -542,14 +565,14 @@ typedef targ_uns        targ_size_t;    /* size_t for the target machine */
542565#define  OMFOBJ           TARGET_WINDOS
543566#endif 
544567#ifndef  ELFOBJ 
545- #define  ELFOBJ           (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS)
568+ #define  ELFOBJ           (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD ||  TARGET_SOLARIS)
546569#endif 
547570#ifndef  MACHOBJ 
548571#define  MACHOBJ          TARGET_OSX
549572#endif 
550573
551574#define  SYMDEB_CODEVIEW  TARGET_WINDOS
552- #define  SYMDEB_DWARF     (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS || TARGET_OSX)
575+ #define  SYMDEB_DWARF     (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD ||  TARGET_SOLARIS || TARGET_OSX)
553576
554577#define  TOOLKIT_H 
555578
@@ -737,13 +760,15 @@ enum
737760    EX_SOLARIS64     =  0x200000 ,
738761    EX_OPENBSD       =  0x400000 ,
739762    EX_OPENBSD64     =  0x800000 ,
763+     EX_DRAGONFLYBSD64  =  0x1000000 ,
740764};
741765
742766
743767// All flat memory models (no segment registers) 
744768const  exefmt_t  EX_flat  =  EX_OS2  | EX_WIN32  | EX_LINUX  | EX_WIN64  | EX_LINUX64  |
745769                         EX_OSX  | EX_OSX64  | EX_FREEBSD  | EX_FREEBSD64  |
746770                         EX_OPENBSD  | EX_OPENBSD64  |
771+                          EX_DRAGONFLYBSD64  |
747772                         EX_SOLARIS  | EX_SOLARIS64 ;
748773
749774// All DOS executable types 
0 commit comments