[cfe-dev] GNU runtime non-fragile ABI and cleanup
David Chisnall
csdavec at swansea.ac.uk
Sun Aug 30 17:44:08 PDT 2009
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.
> -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:
>> -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.
Any other comments?
David
More information about the cfe-dev
mailing list