Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ini/dragonflybsd/bin32/dmd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Environment32]
DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib32 -L--export-dynamic

[Environment64]
DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib64 -L--export-dynamic
5 changes: 5 additions & 0 deletions ini/dragonflybsd/bin64/dmd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Environment32]
DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib32 -L--export-dynamic

[Environment64]
DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib64 -L--export-dynamic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Linux (and other 64-bit OSes, IIRC) we add -fPIC by default.

Copy link
Contributor Author

@dkgroot dkgroot Jan 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZombineDev I would add -fPIC, even though it is only actually required on (most) Linux versions, the PR already got merged though.
FYI: checked the other platforms' ini-files and they also do not have -fPIC added by default.

3 changes: 2 additions & 1 deletion src/dmd/astbase.d
Original file line number Diff line number Diff line change
Expand Up @@ -6307,7 +6307,8 @@ struct ASTBase
{
return Type.tchar.pointerTo();
}
else if (global.params.isLinux || global.params.isFreeBSD || global.params.isOpenBSD || global.params.isSolaris || global.params.isOSX)
else if (global.params.isLinux || global.params.isFreeBSD || global.params.isOpenBSD || global.params.isDragonFlyBSD ||
global.params.isSolaris || global.params.isOSX)
{
if (global.params.is64bit)
{
Expand Down
27 changes: 23 additions & 4 deletions src/dmd/backend/backconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,25 @@ void out_config_init(
config.objfmt = OBJ_ELF;
config.ehmethod = betterC ? EH_NONE : EH_DM;
#endif
#if TARGET_DRAGONFLYBSD
if (model == 64)
{ config.exe = EX_DRAGONFLYBSD64;
config.ehmethod = betterC ? EH_NONE : EH_DWARF;
config.fpxmmregs = TRUE;
config.avx = avx;
}
else
{
assert(0); // Only 64-bit supported on DragonFlyBSD
}
config.flags |= CFGnoebp;
if (!exe)
{
config.flags3 |= CFG3pic;
config.flags |= CFGalwaysframe; // PIC needs a frame for TLS fixups
}
config.objfmt = OBJ_ELF;
#endif
#if TARGET_SOLARIS
if (model == 64)
{ config.exe = EX_SOLARIS64;
Expand Down Expand Up @@ -336,7 +355,7 @@ void util_set32()
_tysize[TYnullptr] = LONGSIZE;
_tysize[TYnptr] = LONGSIZE;
_tysize[TYnref] = LONGSIZE;
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
_tysize[TYldouble] = 12;
_tysize[TYildouble] = 12;
_tysize[TYcldouble] = 24;
Expand All @@ -363,7 +382,7 @@ void util_set32()
_tyalignsize[TYnullptr] = LONGSIZE;
_tyalignsize[TYnref] = LONGSIZE;
_tyalignsize[TYnptr] = LONGSIZE;
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
_tyalignsize[TYldouble] = 4;
_tyalignsize[TYildouble] = 4;
_tyalignsize[TYcldouble] = 4;
Expand Down Expand Up @@ -401,7 +420,7 @@ void util_set64()
_tysize[TYnullptr] = 8;
_tysize[TYnptr] = 8;
_tysize[TYnref] = 8;
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS || TARGET_OSX
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS || TARGET_OSX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is ridiculous that every UNIX has to be added to this list so many places. There needs to be a TARGET_POSIX and maybe other defines, so that this common list can be maintained in one header. Not saying you should do it, just saying it shouldn't be this much work to add a new UNIX like Dragonfly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backend can do as they please, but at some point I hope to remove all traces of TARGET_XXX in the frontend except the target module, where the logic will now live. (global.params.isXXX will be removed and made private vars in target also).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree, especially when it comes to an OS that clearly comes from a particular family (BSD in this case). Initially I wanted to add a TARGET_BSD and have all BSD's inherit from that, which would simplify a lot of these cases.

I did contact a couple of people and checked other related PR's before going down this road, and this issue has been raised multiple/several times before. @WalterBright (amongst others) was strongly against mixing/reusing code and wants a separate definition for each architecture and os.

This does have mean quite a bit of code duplication and added maintenance. But on the other hand, it does have a positive effect, namely changes made for DragonFly have 0 change of messing stuff up for FreeBSD, OpenBSD, Linux, Darwin etc. The latter was the main reason to implement it this way (If i am not mistaken).

Keeping this positive effect in place, there are still possibilities for refactoring. For example these large 'version(xxxx)' trees could be split into a single file per architecture and OS (You would still have code duplication but an easier job to port to a new OS. Namely: one single backend file to edit).

If you do see reason to re-open this discussion, i think it should take place elsewhere, and not this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WalterBright (amongst others) was strongly against mixing/reusing code and wants a separate definition for each architecture and os.

I think you misunderstood. Walter wants each OS to be versioned off separately for most D code, but clearly this compiler code is already not being separated, which is why you're just adding to this list. I believe he'd be fine with merging all this into one define or eventually one D version, as Iain plans to do exactly that.

Anyway, I'm not reopening this discussion, as I noted I'm not asking you to consolidate, just making a comment that this needs to be changed, which Iain has acknowledged as the plan.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean now. Adding a couple of generic TARGET groups (POSIX/BSD/WIN/OSX) would be quite nice, and clear up some of these long repetitive ifdefs. Hopefully this refactorying will happen after this PR has already been merged :-)

_tysize[TYldouble] = 16;
_tysize[TYildouble] = 16;
_tysize[TYcldouble] = 32;
Expand All @@ -424,7 +443,7 @@ void util_set64()
_tyalignsize[TYnullptr] = 8;
_tyalignsize[TYnptr] = 8;
_tyalignsize[TYnref] = 8;
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
_tyalignsize[TYldouble] = 16;
_tyalignsize[TYildouble] = 16;
_tyalignsize[TYcldouble] = 16;
Expand Down
4 changes: 2 additions & 2 deletions src/dmd/backend/cc.d
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ enum WM
WM_ccast = 25,
WM_obsolete = 26,

// if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
// if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
WM_skip_attribute = 27, // skip GNUC attribute specification
WM_warning_message = 28, // preprocessor warning message
WM_bad_vastart = 29, // args for builtin va_start bad
Expand All @@ -84,7 +84,7 @@ enum LANG
//#include "msgs2.h"
//#endif
//#include "ty.h"
//#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
//#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
//#include "../tk/mem.h"
//#else
//#include "mem.h"
Expand Down
4 changes: 2 additions & 2 deletions src/dmd/backend/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ enum WM
WM_badnumber = 24,
WM_ccast = 25,
WM_obsolete = 26,
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
WM_skip_attribute = 27, // skip GNUC attribute specification
WM_warning_message = 28, // preprocessor warning message
WM_bad_vastart = 29, // args for builtin va_start bad
Expand Down Expand Up @@ -106,7 +106,7 @@ enum LANG
#include "msgs2.h"
#endif
#include "ty.h"
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
#include "../tk/mem.h"
#else
#include "mem.h"
Expand Down
12 changes: 7 additions & 5 deletions src/dmd/backend/cdef.d
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ enum bool HEADER_LIST = true;

// Precompiled header variations
//#define MEMORYHX (_WINDLL && _WIN32) // HX and SYM files are cached in memory
//#define MMFIO (_WIN32 || __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun) // if memory mapped files
//#define MMFIO (_WIN32 || __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __sun) // if memory mapped files
//#define LINEARALLOC _WIN32 // if we can reserve address ranges

// H_STYLE takes on one of these precompiled header methods
Expand Down Expand Up @@ -272,7 +272,7 @@ enum
{
CHARSIZE = 1,
SHORTSIZE = 2,
WCHARSIZE = 2, // 2 for WIN32, 4 for linux/OSX/FreeBSD/OpenBSD/Solaris
WCHARSIZE = 2, // 2 for WIN32, 4 for linux/OSX/FreeBSD/OpenBSD/DragonFlyBSD/Solaris
LONGSIZE = 4,
LLONGSIZE = 8,
CENTSIZE = 16,
Expand All @@ -288,7 +288,7 @@ enum
//#define REGMASK 0xFFFF

// targ_llong is also used to store host pointers, so it should have at least their size
//#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS || TARGET_OSX || MARS
//#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS || TARGET_OSX || MARS
alias targ_ptrdiff_t = targ_llong; // ptrdiff_t for target machine
alias targ_size_t = targ_ullong; // size_t for the target machine
//#else
Expand All @@ -311,14 +311,14 @@ alias targ_size_t = targ_ullong; // size_t for the target machine
//#define OMFOBJ TARGET_WINDOS
//#endif
//#ifndef ELFOBJ
//#define ELFOBJ (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS)
//#define ELFOBJ (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS)
//#endif
//#ifndef MACHOBJ
//#define MACHOBJ TARGET_OSX
//#endif

//#define SYMDEB_CODEVIEW TARGET_WINDOS
//#define SYMDEB_DWARF (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS || TARGET_OSX)
//#define SYMDEB_DWARF (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS || TARGET_OSX)

//#define TOOLKIT_H

Expand Down Expand Up @@ -500,13 +500,15 @@ enum
EX_SOLARIS64 = 0x200000,
EX_OPENBSD = 0x400000,
EX_OPENBSD64 = 0x800000,
EX_DRAGONFLYBSD64 = 0x1000000,
}


// All flat memory models (no segment registers)
enum exefmt_t EX_flat = EX_OS2 | EX_WIN32 | EX_LINUX | EX_WIN64 | EX_LINUX64 |
EX_OSX | EX_OSX64 | EX_FREEBSD | EX_FREEBSD64 |
EX_OPENBSD | EX_OPENBSD64 |
EX_DRAGONFLYBSD64 |
EX_SOLARIS | EX_SOLARIS64;

// All DOS executable types
Expand Down
39 changes: 32 additions & 7 deletions src/dmd/backend/cdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
__APPLE__ Mac OSX
__FreeBSD__ FreeBSD
__OpenBSD__ OpenBSD
__DragonFly__ DragonFlyBSD
__sun Solaris, OpenSolaris, SunOS, OpenIndiana, etc
__OS2__ IBM OS/2
DOS386 32 bit DOS extended executable
Expand Down Expand Up @@ -118,14 +119,31 @@ One and only one of these macros must be set by the makefile:
* The "__OpenBSD__" and "__GNUC__" macros control hosting issues
* for operating system and compiler dependencies, respectively.
* To target OpenBSD executables, use ELFOBJ for things specific to the
* ELF object file format, and TARGET_FREEBSD for things specific to
* ELF object file format, and TARGET_OPENBSD for things specific to
* the OpenBSD memory model.
* If this is all done right, one could generate a OpenBSD object file
* even when compiling on win32, and vice versa.
* The compiler source code currently uses these macros very inconsistently
* with these goals, and should be fixed.
*/

/* DragonFlyBSD Version
* -------------
* There are two main issues: hosting the compiler on DragonFlyBSD,
* and generating (targetting) DragonFlyBSD executables.
* The "__DragonFly__" and "__GNUC__" macros control hosting issues
* for operating system and compiler dependencies, respectively.
* To target DragonFlyBSD executables, use ELFOBJ for things specific to the
* ELF object file format, and TARGET_DRAGONFLYBSD for things specific to
* the DragonFlyBSD memory model.
* If this is all done right, one could generate a DragonFlyBSD object file
* even when compiling on linux/windows/osx etc, and vice versa.
* The compiler source code currently uses these macros very inconsistently
* with these goals, and should be fixed.
*
* DMD was Ported to DragonFlyBSD by Diederik de Groot <ddegroot [at] talon.nl>
*/

/* Solaris Version
* -------------
* There are two main issues: hosting the compiler on Solaris,
Expand Down Expand Up @@ -186,14 +204,19 @@ One and only one of these macros must be set by the makefile:
#define TARGET_OPENBSD 0 // target is an OpenBSD executable
#endif

// Set to 1 using the makefile
#ifndef TARGET_DRAGONFLYBSD
#define TARGET_DRAGONFLYBSD 0 // target is a DragonFlyBSD executable
#endif

// Set to 1 using the makefile
#ifndef TARGET_SOLARIS
#define TARGET_SOLARIS 0 // target is a Solaris executable
#endif

// This is the default
#ifndef TARGET_WINDOS
#define TARGET_WINDOS (!(TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS))
#define TARGET_WINDOS (!(TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS))
#endif

#if __GNUC__
Expand Down Expand Up @@ -296,7 +319,7 @@ typedef long double longdouble;

// Precompiled header variations
#define MEMORYHX (_WINDLL && _WIN32) // HX and SYM files are cached in memory
#define MMFIO (_WIN32 || __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun) // if memory mapped files
#define MMFIO (_WIN32 || __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __sun) // if memory mapped files
#define LINEARALLOC _WIN32 // if we can reserve address ranges

// H_STYLE takes on one of these precompiled header methods
Expand Down Expand Up @@ -503,7 +526,7 @@ enum
{
CHARSIZE = 1,
SHORTSIZE = 2,
WCHARSIZE = 2, // 2 for WIN32, 4 for linux/OSX/FreeBSD/OpenBSD/Solaris
WCHARSIZE = 2, // 2 for WIN32, 4 for linux/OSX/FreeBSD/OpenBSD/DragonFlyBSD/Solaris
LONGSIZE = 4,
LLONGSIZE = 8,
CENTSIZE = 16,
Expand All @@ -519,7 +542,7 @@ enum
#define REGMASK 0xFFFF

// targ_llong is also used to store host pointers, so it should have at least their size
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS || TARGET_OSX || MARS
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS || TARGET_OSX || MARS
typedef targ_llong targ_ptrdiff_t; /* ptrdiff_t for target machine */
typedef targ_ullong targ_size_t; /* size_t for the target machine */
#else
Expand All @@ -542,14 +565,14 @@ typedef targ_uns targ_size_t; /* size_t for the target machine */
#define OMFOBJ TARGET_WINDOS
#endif
#ifndef ELFOBJ
#define ELFOBJ (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS)
#define ELFOBJ (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS)
#endif
#ifndef MACHOBJ
#define MACHOBJ TARGET_OSX
#endif

#define SYMDEB_CODEVIEW TARGET_WINDOS
#define SYMDEB_DWARF (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS || TARGET_OSX)
#define SYMDEB_DWARF (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS || TARGET_OSX)

#define TOOLKIT_H

Expand Down Expand Up @@ -737,13 +760,15 @@ enum
EX_SOLARIS64 = 0x200000,
EX_OPENBSD = 0x400000,
EX_OPENBSD64 = 0x800000,
EX_DRAGONFLYBSD64 = 0x1000000,
};


// All flat memory models (no segment registers)
const exefmt_t EX_flat = EX_OS2 | EX_WIN32 | EX_LINUX | EX_WIN64 | EX_LINUX64 |
EX_OSX | EX_OSX64 | EX_FREEBSD | EX_FREEBSD64 |
EX_OPENBSD | EX_OPENBSD64 |
EX_DRAGONFLYBSD64 |
EX_SOLARIS | EX_SOLARIS64;

// All DOS executable types
Expand Down
2 changes: 1 addition & 1 deletion src/dmd/backend/cgcod.c
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,7 @@ if (regcon.cse.mval & 1) elem_print(regcon.cse.value[0]);
case OPrelconst:
cdrelconst(cdb,e,pretregs);
break;
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
case OPgot:
cdgot(cdb,e,pretregs);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/dmd/backend/cgelem.c
Original file line number Diff line number Diff line change
Expand Up @@ -4968,7 +4968,7 @@ STATIC elem * elvalist(elem *e, goal_t goal)

#endif

#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS

assert(I64); // va_start is not an intrinsic on 32-bit
// (OPva_start &va)
Expand Down
11 changes: 6 additions & 5 deletions src/dmd/backend/cod1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ void getlvalue(CodeBuilder& cdb,code *pcs,elem *e,regm_t keepmsk)
case FLextern:
if (s->Sident[0] == '_' && memcmp(s->Sident + 1,"tls_array",10) == 0)
{
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
// Rewrite as GS:[0000], or FS:[0000] for 64 bit
if (I64)
{
Expand Down Expand Up @@ -1329,7 +1329,7 @@ void getlvalue(CodeBuilder& cdb,code *pcs,elem *e,regm_t keepmsk)
case FLcsdata:
case FLgot:
case FLgotoff:
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
case FLtlsdata:
#endif
L3:
Expand Down Expand Up @@ -1893,6 +1893,7 @@ void getClibInfo(unsigned clib, symbol **ps, ClibInfo **pinfo)
EX_OSX | EX_OSX64 |
EX_FREEBSD | EX_FREEBSD64 |
EX_OPENBSD | EX_OPENBSD64 |
EX_DRAGONFLYBSD64 |
EX_SOLARIS | EX_SOLARIS64);

ClibInfo *cinfo = &clibinfo[clib];
Expand Down Expand Up @@ -2572,7 +2573,7 @@ void callclib(CodeBuilder& cdb,elem *e,unsigned clib,regm_t *pretregs,regm_t kee
}
if (pushebx)
{
if (config.exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64))
if (config.exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_DRAGONFLYBSD64))
{
cdb.gen1(0x50 + CX); // PUSH ECX
cdb.gen1(0x50 + BX); // PUSH EBX
Expand Down Expand Up @@ -3409,7 +3410,7 @@ static void funccall(CodeBuilder& cdb,elem *e,unsigned numpara,unsigned numalign
fl = el_fl(e1);
if (tym1 == TYifunc)
cdbe.gen1(0x9C); // PUSHF
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
assert(!farfunc);
if (s != tls_get_addr_sym)
{
Expand Down Expand Up @@ -3448,7 +3449,7 @@ static void funccall(CodeBuilder& cdb,elem *e,unsigned numpara,unsigned numalign
tym_t e11ty = tybasic(e11->Ety);
assert(!I16 || (e11ty == (farfunc ? TYfptr : TYnptr)));
load_localgot(cdb);
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
if (config.flags3 & CFG3pic && I32)
keepmsk |= mBX;
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/dmd/backend/cod2.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ void cdmul(CodeBuilder& cdb,elem *e,regm_t *pretregs)
orthxmm(cdb,e,pretregs);
return;
}
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
orth87(cdb,e,pretregs);
#else
opdouble(cdb,e,pretregs,(oper == OPmul) ? CLIBdmul : CLIBddiv);
Expand Down Expand Up @@ -4145,7 +4145,7 @@ void getoffset(CodeBuilder& cdb,elem *e,unsigned reg)
goto L4;

case FLtlsdata:
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
{
L5:
if (config.flags3 & CFG3pic)
Expand Down Expand Up @@ -4271,7 +4271,7 @@ void getoffset(CodeBuilder& cdb,elem *e,unsigned reg)
goto L4;

case FLextern:
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS
if (e->EV.sp.Vsym->ty() & mTYthread)
goto L5;
#endif
Expand Down
Loading