darwin: Add __xxx_OS_VERSION_MIN constants for Darwin platforms#3299
darwin: Add __xxx_OS_VERSION_MIN constants for Darwin platforms#3299ibuclaw wants to merge 1 commit intodlang:masterfrom ibuclaw:osxavailability
Conversation
|
Thanks for your pull request, @ibuclaw! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + druntime#3299" |
|
Do you have a concrete use case? The |
GCC still has emulated TLS. I am conversing with someone who is testing on various versions current and old, i386, x86_64, and PPC (he might be getting ARM hardware soon). I've only got a late 2009 mac-mini myself (10.6), pretty much everything passes except for missing symbols added in later releases. |
|
Some parts of the bindings have comments like this Would perhaps be more useful to put that in code. |
My understanding is that the env variable ( |
|
I think this approach is a bad idea, just as I thought I'm not sure what
According to the headers, if nothing is specified:
For the other platforms I cannot find the same values but these are the lowest available versions:
No, you're missing a couple of newer versions. The latest versions are:
An alternative is to more closely match the [1] https://clang.llvm.org/docs/AttributeReference.html#availability |
Just a gate for whether or not to declare a symbol. Don't want to declare if using it results in missing symbol error at runtime.
And 10.4 for PPC64, though I went with 10.5 as it is the last version that supports all hardware apple has released on.
OK, the sources on apple/xnu are probably out of date. |
No, The only differences I've noticed between Have a look at: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html |
That's not how the SDK works. If a function is specified to be available on macOS 10.13 and later. If the minimum version specified is 10.12, you can still use the 10.13 symbol if you guard it with a runtime check. The symbol will have weak linkage. This means the same executable can run on both 10.12 and 10.13 and on 10.13 it can take advantage of some feature only available in that version. If the minimum version specified is 10.13, then you don't have to do a runtime check of the symbol and the symbol will have normal linkage.
That's why this approach is not a good idea. |
__traits is a bad approach on the surface as it's potentially asking the front-end implementation to be aware of things it has no right to know about. A good approach of dealing with them agnostically should be sorted out. |
Version identifiers are already set by the frontend (at least in DMD). What about the already existing |
|
BTW, this is slightly related: dlang/dmd#10476. |
|
@kinke, on an unrelated note: ModuleInfo, should it go in |
|
I have no idea (I guess it doesn't matter) - the Mac stuff was done by other people, most likely @dnadlinger. Our druntime sections stuff for Mac vastly differs from upstream, see #2322, incl. support for shared druntime/Phobos. |
The current targetInfo identifiers are vague enough to not be tied to any platform. Whereas asking for a specific version of a given OS isn't. I'd have to sit down and sketch out if getTargetInfo can be done in a way that just involves one hook that may call any provider in the back-end. Possibly having a shared array may be enough.
I have successfully implemented shared support using |
As kinke mentioned, it doesn't matter. All I know is that segments and sections in Mach-O images should start with If there's an interest in trying to unify all compilers and use the same druntime we should pick one name and stick to it. I think that name should start with |
I would prefer we try focus on the language side first instead of just picking the easiest way to implement something in the compiler. D has already been affected by this philosophy quite a bit. |
It only takes one person to implement that in DMD for Linux (possibly in response to a bugzilla issue), another to start depending on it in druntime, and then I'm having to raise revert PRs for refusing to support such bile. |
|
Druntime have been merged into DMD. Please re-submit your PR to |
The idea here is similar to FreeBSD's
__FreeBSD_versionconstant. What differs however, is that rather than it being a fixed to a release version of OS X, the versions correspond to a configurable minimum required version number (set by the user passing-mmacosx-version-min=) to control what OS functionality is available at compile-time. So, the compiler predefiningOSX_10_9means that we are targeting all releases starting from macOS 10.9 (Mavericks). In C, this is equivalent to the__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__macros.Example usage:
A CTFE-only function could be added to
core.sys.darwin.configinstead to cover all different platforms in one.Ping @jacob-carlborg, @kinke: