[LLVMbugs] [Bug 14410] New: [-cxx-abi microsoft] Wrong mangling of __stdcall functions?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Nov 22 02:36:44 PST 2012


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

             Bug #: 14410
           Summary: [-cxx-abi microsoft] Wrong mangling of __stdcall
                    functions?
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: timurrrr at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


=== stdcall.cpp ===
extern int cnt;
void __stdcall foo();

#ifdef CONFIG_1
void __stdcall foo() {
  cnt = 42;
}

#else
int cnt = 10;

int main() {
  void (__stdcall *ptr)() = foo;
  (*ptr)();
  return (cnt == 42) ? 0 : 1;
}
#endif
===================

$ cl -c -Fostdcall_1_1.obj -DCONFIG_1 stdcall.cpp
$ clang -Xclang -cxx-abi -Xclang microsoft -c -ostdcall_1_2.o stdcall.cpp
$ link stdcall_1_1.obj stdcall_1_2.o
stdcall_1_2.o : error LNK2019: unresolved external symbol "?foo@@YGXXZ at 0"
(?foo@@YGXXZ at 0) referenced in function _main

$ cl -c -Fostdcall_2_1.o stdcall.cpp
$ clang -Xclang -cxx-abi -Xclang microsoft -c -ostdcall_2_2.obj -DCONFIG_1
stdcall.cpp
$ link stdcall_2_1.o stdcall_2_2.obj
stdcall_2_1.o : error LNK2019: unresolved external symbol "void __stdcall
foo(void)" (?foo@@YGXXZ) referenced in function _main

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list