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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to