[LLVMdev] RFC: -fwritable-strings Change

Eli Friedman eli.friedman at gmail.com
Tue Jan 27 16:03:04 PST 2009


On Tue, Jan 27, 2009 at 1:35 PM, Bill Wendling <isanbard at gmail.com> wrote:
> On Tue, Jan 27, 2009 at 1:15 PM, Eli Friedman <eli.friedman 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.

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

-Eli



More information about the llvm-dev mailing list