[LLVMbugs] [Bug 21688] New: clang objective-c++ incorrect mangling for function with multiple id parameters

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 28 02:30:29 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21688

            Bug ID: 21688
           Summary: clang objective-c++ incorrect mangling for function
                    with multiple id parameters
           Product: clang
           Version: 3.5
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: joao at abecasis.name
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Consider:

  // mangling.cpp

  struct objc_selector;
  struct objc_object;

  typedef struct objc_selector *SEL;
  typedef struct objc_object *id;

  struct NSObject;

  void good1(id, id) { }
  void good2(struct NSObject *, id, id) { }
  void good3(struct NSObject *, SEL, id) { }

  void bad1(struct NSObject *, SEL, id,  id) { }
  void bad2(struct NSObject *, SEL, id,  id, id) { }

Compiling this code as Objective C++ generates what seems to be incorrect name
mangling for the "bad" functions:

  $ clang++ -x objective-c++ -c mangling.cc && nm mangling.o | c++filt
  0000000000000138 short EH_frame0
  0000000000000050 T bad1(NSObject*, objc_selector*, objc_object*, objc_object)
  00000000000001c8 S bad1(NSObject*, objc_selector*, objc_object*, objc_object)
(.eh)
  0000000000000070 T bad2(NSObject*, objc_selector*, objc_object*, objc_object,
objc_object)
  00000000000001f0 S bad2(NSObject*, objc_selector*, objc_object*, objc_object,
objc_object) (.eh)
  0000000000000000 T good1(objc_object*, objc_object*)
  0000000000000150 S good1(objc_object*, objc_object*) (.eh)
  0000000000000010 T good2(NSObject*, objc_object*, objc_object*)
  0000000000000178 S good2(NSObject*, objc_object*, objc_object*) (.eh)
  0000000000000030 T good3(NSObject*, objc_selector*, objc_object*)
  00000000000001a0 S good3(NSObject*, objc_selector*, objc_object*) (.eh)

Compiling as C++ generates what seems to be the correct mangling:

  $ clang++ -x c++ -c mangling.cc && nm mangling.o | c++filt
  0000000000000130 short EH_frame0
  0000000000000050 T bad1(NSObject*, objc_selector*, objc_object*,
objc_object*)
  00000000000001c0 S bad1(NSObject*, objc_selector*, objc_object*,
objc_object*) (.eh)
  0000000000000070 T bad2(NSObject*, objc_selector*, objc_object*,
objc_object*, objc_object*)
  00000000000001e8 S bad2(NSObject*, objc_selector*, objc_object*,
objc_object*, objc_object*) (.eh)
  0000000000000000 T good1(objc_object*, objc_object*)
  0000000000000148 S good1(objc_object*, objc_object*) (.eh)
  0000000000000010 T good2(NSObject*, objc_object*, objc_object*)
  0000000000000170 S good2(NSObject*, objc_object*, objc_object*) (.eh)
  0000000000000030 T good3(NSObject*, objc_selector*, objc_object*)
  0000000000000198 S good3(NSObject*, objc_selector*, objc_object*) (.eh)

My main issue here is that the mangling is inconsistent if code is compiled as
Objective-C++ or C++, which prevents using a function compiled as Objective C++
to be used in plain C++.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141128/00b2e8f8/attachment.html>


More information about the llvm-bugs mailing list