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

Jean-Daniel Dupas devlists at shadowlab.org
Mon Aug 31 09:45:29 PDT 2009


Le 31 août 2009 à 18:32, Fariborz Jahanian a écrit :

>
> 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.

Isn't the -fno-constant-cfstrings flag required to build unloadable  
bundle ? Is there some change that made it legacy ?

http://developer.apple.com/mac/library/documentation/CoreFoundation/Conceptual/CFBundles/AccessingaBundlesContents/AccessingaBundlesContents.html

 From the Unloading Bundle section:

"When you compile a bundle with a minimum deployment target of Mac OS  
X 10.2 (or later), the compiler automatically switches to generating  
strings that are truly constant in response toCFSTR("..."). The  
compiler also generates these constant strings if you compile with the  
flag -fconstant-cfstrings. Constant strings have many benefits and  
should be used when possible, however if you reference constant  
strings after the executable containing them is unloaded, the  
references will be invalid and will cause a crash. This might happen  
even if the strings have been retained, for example, as a result of  
being put in data structures, retained directly, and, in some cases,  
even copied. Rather than trying to make sure all such references are  
cleaned up at unload time (and some references might be created within  
the libraries, making them hard to track), it is best to compile  
unloadable bundles with the flag -fno-constant-cfstrings."







More information about the cfe-dev mailing list