- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 656
Add DragonFlyBSD support for dmd #7463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | 
| 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 | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -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; | ||
|  | @@ -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; | ||
|  | @@ -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; | ||
|  | @@ -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 | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe 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  There was a problem hiding this comment. Choose a reason for hiding this commentThe 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  There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|  | @@ -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; | ||
|  | ||
There was a problem hiding this comment.
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
-fPICby default.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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.