[LLVMdev] How to represent zero-sized string?
Eli Friedman
eli.friedman at gmail.com
Sat Jan 10 01:21:06 PST 2009
On Fri, Jan 9, 2009 at 5:40 PM, Evan Cheng <evan.cheng at apple.com> wrote:
> The difference seems innocent enough. However, in objc if the zero-
> sized string is part of a cfstring, it causes a problem. The linker
> expects it in the readonly __cstring section, but llvm puts it in the
> read / write bss section.
That seems extremely weird... what sort of magic is objc using that
could possibly care where a string is stored? Can you give a more
complete testcase? It sounds like LLVM isn't modelling something
which it really should be...
> The problem is llvm represents this as
>
> @"\01LC" = internal constant [1 x i8] zeroinitializer
>
> CodeGen can tell it should go into a read only section, but it cannot
> know it's a cstring. Any ideas how I can fix this? If I write the zero-
> sized string as c"A\00", bitcode reader still turns it back to
> zeroinitializer.
LangRef claims that you can specify a section for globals, although I
can't actually manage to get it to work...
-Eli
More information about the llvm-dev
mailing list