[LLVMbugs] [Bug 10591] New: Unable to override calling convention for individual functions when using -mrtd

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 4 15:33:50 PDT 2011


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

           Summary: Unable to override calling convention for individual
                    functions when using -mrtd
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu


When you compile a program with -mrtd, the default calling convention
will be switched to stdcall.  However, you should be able to override
this for individual functions, as stated here:

http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Function-Attributes.html#index-mrtd-2410

"cdecl -- On the Intel 386, the cdecl attribute causes the compiler to
assume that the calling function will pop off the stack space used to
pass arguments. This is useful to override the effects of the -mrtd
switch."

However, it looks like clang forces every function to have the stdcall
convention, and then errors out whenever you attempt to override it for
a particular function:

  void __attribute__((cdecl)) foo(int i) {}
  void bar(int i) {}

This compiles fine using 'gcc -mrtd -c', but 'clang -mrtd -c' complains:

  convtest.c:1:21: error: cdecl and stdcall attributes are not compatible
  void __attribute__((cdecl)) foo(int i) {}
              ^
  1 error generated.

It would be nice if we could get similar behaviour from clang.

-- 
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