Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 537826

Summary: sys-devel/gcc-apple-4.2.1_p5666-r2: proper fix for __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro on OS X 10.10
Product: Gentoo/Alt Reporter: Michael Weiser <michael>
Component: Prefix SupportAssignee: Gentoo Prefix <prefix>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=218873
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: extend encoding of __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ for 10.10

Description Michael Weiser 2015-01-26 00:04:13 UTC
The current workaround for encoding __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ in gcc-apple for OS X 10.10 lets everyone think, they're on 10.9. There's a proper fix in FSF GCC trunk that handles 10.10 but does not encode the patch level. (https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=218873, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61407). A much more sophisticated patch that also handles the patch level is in FSF GCC bugzilla (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810) but not yet on trunk because of pending legal paperwork.

I have backported the first patch to gcc-apple-4.2.1_p5666-r2 and extended to also include the patch level.

Example:
michael@osx1010:~ # /usr/bin/clang -E  -mmacosx-version-min=10.10.10 -dM -c t.c | grep OS_X
#define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 101010
michael@osx1010:~ # ~/nobak/gentoo/usr/bin/gcc -E  -mmacosx-version-min=10.10.10 -dM -c t.c | grep OS_X
#define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 101010

Unpatched gcc-apple would have croaked:

michael@osx1010:~ # gcc -E  -mmacosx-version-min=10.10.10 -dM -c t.c | grep OS_X
<built-in>:0: error: Unknown value '10.10.10' of -mmacosx-version-min
#define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 1000

Also, unpatched gcc-apple draws a line at patch level 9:

michael@osx1010 ~ $ gcc -E  -mmacosx-version-min=10.4.10 -dM -c t.c | grep OS_X
<built-in>:0: error: Unknown value '10.4.10' of -mmacosx-version-min
#define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 1000

I have opted for the clang way to cap at level 9:

michael@osx1010~ # ~/nobak/gentoo/usr/bin/gcc -E  -mmacosx-version-min=10.4.10 -dM -c t.c | grep OS_X
#define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 1049
michael@osx1010~ # /usr/bin/clang -E  -mmacosx-version-min=10.4.10 -dM -c t.c | grep OS_X
#define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 1049

Reproducible: Always
Comment 1 Michael Weiser 2015-01-26 00:04:48 UTC
Created attachment 394896 [details, diff]
extend encoding of __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ for 10.10
Comment 2 Fabian Groffen gentoo-dev 2015-01-31 16:16:04 UTC
applied to gcc-apple-4.2.1_p5666-r2, I don't think we need a revbump, since bootstrapping should be broken anyway.