Commit d8299715 by Dave Korn Committed by Dave Korn

re PR target/41595 (object-c++ mangled local labels are not correctly recognized.)

  2009-10-06 Iain Sandoe <iain.sandoe@sandoe-acoustics.co.uk>

	PR objective-c++/41595
	* config/darwin.c (darwin_label_is_anonymous_local_objc_name):
	New function to recognize objective c/c++ internal symbols,
	including mangled ones.
	* config/darwin.h (ASM_OUTPUT_LABELREF): Use
	darwin_label_is_anonymous_local_objc_name to detect both
	mangled and clear ObjC internal symbols.

From-SVN: r155500
parent 4db98b6e
2009-12-29 Dave Korn <dave.korn.cygwin@gmail.com>
2009-10-06 Iain Sandoe <iain.sandoe@sandoe-acoustics.co.uk>
PR objective-c++/41595
* config/darwin.c (darwin_label_is_anonymous_local_objc_name):
New function to recognize objective c/c++ internal symbols,
including mangled ones.
* config/darwin.h (ASM_OUTPUT_LABELREF): Use
darwin_label_is_anonymous_local_objc_name to detect both
mangled and clear ObjC internal symbols.
2009-12-28 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/41344
......@@ -1373,6 +1373,25 @@ darwin_globalize_label (FILE *stream, const char *name)
default_globalize_label (stream, name);
}
/* This routine returns non-zero if 'name' starts with the special objective-c
anonymous file-scope static name. It accommodates c++'s mangling of such
symbols (in this case the symbols will have form _ZL{d}*_OBJC_* d=digit). */
int
darwin_label_is_anonymous_local_objc_name (const char *name)
{
const unsigned char *p = (const unsigned char *) name;
if (*p != '_')
return 0;
if (p[1] == 'Z' && p[2] == 'L')
{
p += 3;
while (*p >= '0' && *p <= '9')
p++;
}
return (!strncmp ((const char *)p, "_OBJC_", 6));
}
void
darwin_asm_named_section (const char *name,
unsigned int flags ATTRIBUTE_UNUSED,
......
......@@ -647,7 +647,11 @@ extern GTY(()) int darwin_ms_struct;
} while (0)
/* Wrap new method names in quotes so the assembler doesn't gag.
Make Objective-C internal symbols local. */
Make Objective-C internal symbols local and in doing this, we need
to accommodate the name mangling done by c++ on file scope locals. */
int darwin_label_is_anonymous_local_objc_name (const char *name);
#undef ASM_OUTPUT_LABELREF
#define ASM_OUTPUT_LABELREF(FILE,NAME) \
......@@ -673,7 +677,7 @@ extern GTY(()) int darwin_ms_struct;
} \
else if (xname[0] == '+' || xname[0] == '-') \
fprintf (FILE, "\"%s\"", xname); \
else if (!strncmp (xname, "_OBJC_", 6)) \
else if (darwin_label_is_anonymous_local_objc_name (xname)) \
fprintf (FILE, "L%s", xname); \
else if (!strncmp (xname, ".objc_class_name_", 17)) \
fprintf (FILE, "%s", xname); \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment