[LLVMdev] RFC: Mangling Unnamed Global Values

Bill Wendling isanbard at gmail.com
Mon Nov 24 13:28:06 PST 2008

On Mon, Nov 24, 2008 at 11:14 AM, Devang Patel <dpatel at apple.com> wrote:
> On Nov 24, 2008, at 11:07 AM, Chris Lattner wrote:
>> On Nov 24, 2008, at 11:01 AM, Bill Wendling wrote:
>>> The symbols I'm interested in already have internal linkage (as you
>>> would expect). But because the mangler is in charge of assigning them
>>> names, they never seem to be decorated with the 'L' in front. . . .
>> If you use SET_DECL_ASSEMBLER_NAME (something like that) you can
>> specify the full name for this stuff, including the L.  This is how
>> other Objc metadata works.
> Yup.  see start_var_decl() in objc-act.c and its uses of
> set_user_assembler_name().
It's a bit more complicated than this. The metadata for this CFString
is created in darwin_build_constant_cfstring() in darwin.c. It
intentionally constructs an anonymous global variable for the
constructor. If I try to call "set_user_assembler_name" on that
variable, it crashes with this:

t.m: In function '-[A bork:]':
t.m:11: internal compiler error: tree check: expected tree that
contains 'decl with visibility' structure, have 'const_decl'  in
change_decl_assembler_name, at cgraph.c:897
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.


More information about the llvm-dev mailing list