[llvm-bugs] [Bug 38281] New: Fundamental typeinfo should have weak linkage by default

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 23 17:54:50 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38281

            Bug ID: 38281
           Summary: Fundamental typeinfo should have weak linkage by
                    default
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: thomasanderson at google.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Compiling the below test.cpp with g++ and clang++ gives different results:
clang generates the fundamental typeinfo with strong linkage, but g++ uses weak
linkage.  Clang should switch to using weak linkage to match the gcc behavior.

thomasanderson at thomasanderson:~/test$ cat test.cpp
#include <typeinfo>

namespace __cxxabiv1 {

class __fundamental_type_info : public std::type_info {
 public:
  virtual ~__fundamental_type_info();
};

__fundamental_type_info::~__fundamental_type_info() {}

}
thomasanderson at thomasanderson:~/test$ g++ test.cpp -c -o main.o
thomasanderson at thomasanderson:~/test$ nm main.o
...
0000000000000000 V _ZTIa
0000000000000000 V _ZTIb
0000000000000000 V _ZTIc
...
thomasanderson at thomasanderson:~/test$ clang++ test.cpp -c -o main.o
thomasanderson at thomasanderson:~/test$ nm main.o
...
0000000000000338 R _ZTIa
0000000000000178 R _ZTIb
0000000000000258 R _ZTIc
...

-- 
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/20180724/f055269b/attachment.html>


More information about the llvm-bugs mailing list