[LLVMdev] RFC: -fwritable-strings Change
Bill Wendling
isanbard at gmail.com
Tue Jan 27 16:52:21 PST 2009
On Tue, Jan 27, 2009 at 4:03 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Tue, Jan 27, 2009 at 1:35 PM, Bill Wendling <isanbard at gmail.com> wrote:
>> But if we place a null string in a
>> writable section and we don't have "writable strings" enabled, then,
>> well, it's in a writable section when it shouldn't be.
>
> If writable strings are disabled, writing to a string is undefined;
> it's not a bug if it doesn't crash.
>
That's not what I meant. Symbols and data should go in their correct
sections no matter what the program eventual does.
>> I think that one of the problems with Objective-C (and why this became
>> a problem in the first place) is that it does require the string to be
>> in a specific place. The __builtin_CFString structure has, among other
>> things, a field that points to the actual string. When this string
>> isn't in the correct section, the linker complains.
>
> Mmm... if the __builtin_CFString structure has special properties to
> the linker, its strings really ought to be marked.
Yup! That's what my hack was attempting to do.
> There are all
> sorts of transformations which could make it impossible to distinguish
> otherwise; for example, a [4 x i8] constant could be turned into an
> i32 constant, or the empty string could be merged into an integer
> constant with the value 256.
>
Anton applied a much better patch in the back-end.
-bw
More information about the llvm-dev
mailing list