[LLVMbugs] [Bug 15744] New: extern "C" linkage ignored for a static function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 13 18:47:51 PDT 2013


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

            Bug ID: 15744
           Summary: extern "C" linkage ignored for a static function
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jbeich at tormail.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

A static function may be called unmangled by asm() within another function
or from a function defined entirely within asm(). The latter is what
firefox does on i386 linux and bsd e.g.,
https://mxr.mozilla.org/mozilla-central/source/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp#85
https://mxr.mozilla.org/mozilla-central/source/xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp#121

  // a simple testcase
  extern "C"
  {
    __attribute__((__used__))
    static void
    foo(void)
    {
    }
  }

  asm("call foo");

$ clang++33 -c test.cc
$ objdump -t test.o | fgrep foo
0000000000000010 l     F .text  0000000000000006 _Z3foov
0000000000000000         *UND*  0000000000000000 foo

$ clang++32 -c test.cc
$ objdump -t test.o | fgrep foo
0000000000000010 l     F .text  0000000000000001 foo

$ g++48 -c test.cc
$ objdump -t test.o | fgrep foo
0000000000000000 l     F .text  0000000000000006 foo

-- 
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/20130414/0bf36813/attachment.html>


More information about the llvm-bugs mailing list