Skip to content

Comments

MSCOFF32: remove dependency on druntime for long divisions#7261

Merged
dlang-bot merged 1 commit intodlang:masterfrom
rainers:ldivrem
Nov 7, 2017
Merged

MSCOFF32: remove dependency on druntime for long divisions#7261
dlang-bot merged 1 commit intodlang:masterfrom
rainers:ldivrem

Conversation

@rainers
Copy link
Member

@rainers rainers commented Oct 30, 2017

by calling div/mod functions from the VC runtime directly.

The ms* functions in rt.llmath can be removed if this is merged.

As we don't have an autotester for -m32mscoff: tests pass locally, but the dmd testsuite doesn't seem to exercise it that much. A bad version failed the druntime unittests, though.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @rainers!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

s = symboly("_ms_aullrem", ALLREGS);
cinfo->retregs32 = mDX|mAX;
// use implementation in rt.llmath
s = symboly("__ULDIV__", mAX|mBX|mCX|mDX);
Copy link
Member Author

@rainers rainers Oct 30, 2017

Choose a reason for hiding this comment

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

@WalterBright : the OpenBSD/Solaris version calls the signed version instead, seems like a typo. see https://github.com/dlang/dmd/blob/master/src/ddmd/backend/cod1.c#L1995

Copy link
Member

Choose a reason for hiding this comment

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

I think you're right.

@WalterBright
Copy link
Member

Unfortunately, this will fail with -betterC, which doesn't link with druntime. Perhaps add a check for -betterC to determine which to call?

@WalterBright
Copy link
Member

Having the same object file format is only part of the battle. Each C compiler is different in how they connect to their respective runtime libraries. The only viable solution is to add switches.

@rainers
Copy link
Member Author

rainers commented Nov 2, 2017

Unfortunately, this will fail with -betterC, which doesn't link with druntime.

It will fail right now, too, as the _ms_... function are in the same module and call functions from the MS runtime. It's also just the same for other platforms calling __ULDIV__ et al.

Having the same object file format is only part of the battle. Each C compiler is different in how they connect to their respective runtime libraries. The only viable solution is to add switches.

This is about symbols in the VC runtime that are not available via dynamic linkage. An alternative would be to use lldiv instead, but that is only available since VS2013 according to MSDN (though MinGW declares it exists since VS2010).

@rainers rainers changed the title MSCOFF32: remove dependency on the MS runtime ... MSCOFF32: remove dependency on druntime for long divisions Nov 5, 2017
@rainers
Copy link
Member Author

rainers commented Nov 5, 2017

Changed the calls to directly invoke the VC runtime functions. This now actually removed the dependency on druntime for long divisions for better-C.

It doesn't help replacing the C runtime, though. I've added the division functions from rt.llmath to my stub instead.

@dlang-bot dlang-bot merged commit bbca650 into dlang:master Nov 7, 2017
@MartinNowak MartinNowak added this to the 2.078.0 milestone Dec 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants