Skip to content

Conversation

@kinke
Copy link
Member

@kinke kinke commented Apr 11, 2018

Previous discussion in #2647.

@kinke
Copy link
Member Author

kinke commented Apr 13, 2018

I propose the following: we keep the old mangling scheme for LDC 1.9 and introduce the change when it's done properly upstream, presumably in the next version.

The migration from magic structs to special enums (enum __c_long : long { dummy }; still no __c_longlong support), solving the implicit conversion problem, is already in dmd master, incl. tests. The druntime changes (c(pp)_size_t etc.) are still pending (& will be lacking c(pp)_(u)longlong).

kinke added 9 commits April 13, 2018 21:13
This is a breaking ABI change and affects LDC itself as mixed D/C++ code
base. So we now need to check the front-end version of the D host
compiler and adapt the corresponding C++ types accordingly.
Primarily not to break size_t interop. A size_t is probably much more
frequently used than `(unsigned) long long` (which Apple sadly chose for
their C++ `(u)int64_t`).
To be mangled as C++ (unsigned) long long.

For MSVC targets, D (u)long is C++-mangled as (unsigned) long long, so
there's no need for these magic structs.

For 32-bit POSIX targets, D (u)long is also a natural fit already.

For 64-bit POSIX targets however, D (u)long is C++-mangled as (unsigned)
long, so there's no corresponding D type, and these magic structs are
needed. Especially since macOS defines `int64_t` as `long long`, unlike
Linux (`long`).
This fixes 64bit-macOS-exclusive runnable/test18335.sh.
@kinke
Copy link
Member Author

kinke commented Apr 15, 2018

Merging in order to upgrade to 2.079.1; we can always revert to something else as this PR covers both options.

@kinke kinke merged commit 1d775af into ldc-developers:merge-2.079 Apr 15, 2018
@kinke kinke deleted the osx64_mangling branch April 15, 2018 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant