[PATCH] Use fragile ObjC runtime by default for 32-bit Mac OS X

Iain Sandoe iain at codesourcery.com
Sat Jul 26 08:54:36 PDT 2014


Hi Steve,

On 17 Jul 2014, at 07:20, Stephen Drake wrote:

> I'm attaching a patch to select the fragile Objective-C runtime by default for 32-bit Mac OS X, in accordance with Apple's documentation:
> https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html
> 
> In particular, this changes the default runtime for 32-bit ppc, since x86 was already checked for specifically.
> 
> Having written this up I now see that a very similar change was proposed some months ago:
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140120/097716.html
> 
> There was some discussion about the test case there - presumably that wasn't resolved?

We have the fix in our local trees, I think progressing the patch upstream just fell off the radar in favour of higher priority issues (some of which are show-stoppers).

> Index: lib/Driver/ToolChains.h
> ===================================================================
> --- lib/Driver/ToolChains.h	(revision 213217)
> +++ lib/Driver/ToolChains.h	(working copy)
> @@ -272,8 +272,8 @@
>   }
> 
>   bool IsObjCNonFragileABIDefault() const override {
> -    // Non-fragile ABI is default for everything but i386.
> -    return getTriple().getArch() != llvm::Triple::x86;
> +    // Non-fragile ABI is default for everything except 32-bit OS X.
> +    return !(getTriple().isMacOSX() && getTriple().isArch32Bit());
>   }

Although this is neater than my original patch (and would be preferable if it's correct), as you have in your test-case changes below, it changes to the fragile ABI for 32bit ARM && OSX (which is, arguably, an odd combination).

We had some discussion on IRC, and none of us could find or recall any reference to a permutation of arm and OSX/iOS for which the fragile ABI applied.

Do you have some reference to the contrary?

----

As Rafael originally asked, this also still needs expanding to include tests for PPC.

I'm using the attached patch locally.

>   bool UseObjCMixedDispatch() const override {
> Index: test/Driver/darwin-objc-defaults.m
> ===================================================================
> --- test/Driver/darwin-objc-defaults.m	(revision 213217)
> +++ test/Driver/darwin-objc-defaults.m	(working copy)
> @@ -71,7 +71,7 @@
> // RUN: FileCheck --check-prefix CHECK-CHECK-ARMV7_OSX10_5 < %t %s
> 
> // CHECK-CHECK-ARMV7_OSX10_5: "-cc1"
> -// CHECK-CHECK-ARMV7_OSX10_5: -fobjc-runtime=macosx-10.5
> +// CHECK-CHECK-ARMV7_OSX10_5: -fobjc-runtime=macosx-fragile-10.5
> // CHECK-CHECK-ARMV7_OSX10_5-NOT: -fobjc-dispatch-method
> // CHECK-CHECK-ARMV7_OSX10_5: darwin-objc-defaults
> 
> @@ -80,7 +80,7 @@
> // RUN: FileCheck --check-prefix CHECK-CHECK-ARMV7_OSX10_6 < %t %s
> 
> // CHECK-CHECK-ARMV7_OSX10_6: "-cc1"
> -// CHECK-CHECK-ARMV7_OSX10_6: -fobjc-runtime=macosx-10.6
> +// CHECK-CHECK-ARMV7_OSX10_6: -fobjc-runtime=macosx-fragile-10.6
> // CHECK-CHECK-ARMV7_OSX10_6-NOT: -fobjc-dispatch-method
> // CHECK-CHECK-ARMV7_OSX10_6: darwin-objc-defaults

These ^ need verification (and/or the required cases need bounding) assuming that there is some reference indicating a fragile ABI would be valid on arm.

thanks,
Iain

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: wip-ppc-fragile-abi-patch.txt
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140726/cf314b26/attachment.txt>


More information about the cfe-commits mailing list