[cfe-dev] GNU runtime non-fragile ABI and cleanup

Fariborz Jahanian fjahanian at apple.com
Mon Aug 31 09:32:57 PDT 2009


On Aug 30, 2009, at 5:44 PM, David Chisnall wrote:

> On 30 Aug 2009, at 18:46, Fariborz Jahanian wrote:
>
>> Did you want this in your patch?
>
> No, this happened when I ran the test suite; there appears to be a  
> bug in a pipe somewhere, because the test ran fine the first time  
> then failed the second time because the file was full of nonsense.   
> I thought I'd reverted it (I had, but apparently after I created the  
> diff).
>
>> Few comments:
>>
>> +
>> +    ObjCConstantStringClass = "NXConstantString";
>>
>> This is specific to Gnu runtime and initialization should happen  
>> for when in Gnu-specific runtime mode.
>
> I've made this change for now, but it breaks layering because the  
> default to NXConstantString is for GCC compatibility (should be  
> NSConstantString on the NeXT runtime, NSCFString for the NeXT  
> runtime when -fconstant-cfstrings is provided or the target is  
> Darwin) and so should be set in the driver, not in CodeGen.

Currently, there is no plan to support legacy variations of objc's  
constant strings for NeXT runtime in clang (no  -fno-constant- 
cfstrings  or -fconstant-string-class=class-name). Please add the  
FIXME with above comment if you don't have plan to change the above.

>
>
>> -OPTION("-pthread", pthread, Flag, INVALID, INVALID, "", 0, 0, 0)
>> +OPTION("-pthread", pthread, Flag, INVALID, INVALID, "q", 0, 0, 0)
>>
>> Unrelated to this patch. Please provide a separate patch for this  
>> (and a test case) if you want it.
>
> Reverted; this was a quick hack from an earlier diff, I think  
> someone else fixed this in the correct way.
>
>> @@ -818,6 +824,9 @@
>>  else if (GNURuntime)
>>    Options.NeXTRuntime = 0;
>>
>> +  if (!ObjCConstantStringClass.empty())
>> +    Options.ObjCConstantStringClass =  
>> ObjCConstantStringClass.c_str();
>> +
>>
>> This should happen when in GNURuntime. For other runtimes please  
>> issue a warning that option is not supported.
>
> This should also be supported for the NeXT runtime - this option was  
> created by NeXT for NeXTSTEP compatibility in OPENSTEP, when the  
> constant string class was renamed from NXConstantString (NeXT  
> namespace, used on NeXTSTEP) to NSConstantString (NeXT-Sun namespace  
> used on OpenStep implementations including OPENSTEP).  From the  
> Apple GCC docs:

As long as there is no support for legacy stuff in Non-Gnu runtime,  
please issue a warning for those runtimes.

>
>
>>> -fconstant-string-class=class-name
>>> Use class-name as the name of the class to instantiate for each  
>>> literal string specified with the syntax @"...". The default class  
>>> name is NXConstantString if the GNU runtime is being used, and  
>>> NSConstantString if the NeXT runtime is being used (see below).  
>>> The -fconstant-cfstrings option, if also present, will override  
>>> the -fconstant-string-class setting and cause @"..." literals to  
>>> be laid out as constant CoreFoundation strings.
>
> There are other subtle details in the semantics of the NeXT- 
> compatible implementation of this, which I will leave to you.
>
>> Please provide a test case for this patch.
>
> I've modified CodeGenObjC/constant-strings.m to test that this works.

Thanks.

- Fariborz

>
>
> Any other comments?
>
> David




More information about the cfe-dev mailing list