diff options
author | Dave Korn <dave.korn.cygwin@gmail.com> | 2009-12-29 04:13:09 +0000 |
---|---|---|
committer | Dave Korn <davek@gcc.gnu.org> | 2009-12-29 04:13:09 +0000 |
commit | d8299715e09276861adee2c6aed29eead6f17491 (patch) | |
tree | dfbc33bd55fc29f20157f9f8dba2e5605c502c40 | |
parent | 4db98b6eb5a8a9994b8d24ce68521f4930212fdf (diff) | |
download | gcc-d8299715e09276861adee2c6aed29eead6f17491.zip gcc-d8299715e09276861adee2c6aed29eead6f17491.tar.gz gcc-d8299715e09276861adee2c6aed29eead6f17491.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/config/darwin.c | 19 | ||||
-rw-r--r-- | gcc/config/darwin.h | 8 |
3 files changed, 37 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 022296f..ffe2782 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +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 diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index b5c4fb8..1880063 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -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, diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 4152f24..2bcc71a 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -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); \ |