<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); ">
<div>
<div>
<div style="font-family: Arial, sans-serif; font-size: 13px; ">Thanks, John. I'll experiment with both the warning and the nm-weak external tool, and let you know the results.</div>
<div style="font-family: Arial, sans-serif; font-size: 13px; "><br>
</div>
<div style="font-family: Arial, sans-serif; font-size: 13px; ">Best, Akos</div>
<div>
<div>
<p><font class="Apple-style-span" face="Arial,sans-serif" size="4"><b><br>
</b></font></p>
</div>
</div>
</div>
</div>
<span id="OLK_SRC_BODY_SECTION" style="font-size: 13px; font-family: Arial, sans-serif; ">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>John McCall <<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>><br>
<span style="font-weight:bold">Date: </span>Fri, 30 Sep 2011 15:24:33 -0700<br>
<span style="font-weight:bold">To: </span>Ákos Somorjai <<a href="mailto:asomorjai@graphisoft.com">asomorjai@graphisoft.com</a>><br>
<span style="font-weight:bold">Cc: </span>"<a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a>" <<a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [LLVMdev] RTTI handling<br>
</div>
<div><br>
</div>
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div>
<div>On Sep 30, 2011, at 3:04 PM, Somorjai, Akos wrote:</div>
<blockquote type="cite">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); ">
<div>
<div>
<div style="font-family: Arial, sans-serif; font-size: 13px; ">Thanks! Yes, we are trying to avoid that situation as much as possible.</div>
<div style="font-family: Arial, sans-serif; font-size: 13px; "><br>
</div>
<div style="font-family: Arial, sans-serif; font-size: 13px; ">Is there any compiler/linker/static analyzer option that would point out those problems (in 13 million lines, large part of that being legacy code)?</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>There's a -Wweak-vtables which will point out a lot of these cases.  I have to warn you that in previous releases, it's still pretty experimental;  Doug Gregor has done a lot of work on it on ToT.</div>
<div><br>
</div>
<div>Another option is to run 'nm' on the objects/executables you're interested in.  For example, this file:</div>
<div><br>
</div>
<div>daysthatwere clang$ cat red.cpp</div>
<div>
<div>  #include <typeinfo></div>
<div><br>
</div>
<div>  struct A {};</div>
<div>  struct B { virtual ~B(); };</div>
<div>  struct C { virtual ~C(); };</div>
<div>  C::~C() {}</div>
<div><br>
</div>
<div>  const std::type_info &test0() { return typeid(const char*); }</div>
<div>  const std::type_info &test1() { return typeid(const char**); }</div>
<div>  const std::type_info &test2() { return typeid(A); }</div>
<div>  const std::type_info &test3() { return typeid(B); }</div>
<div>  const std::type_info &test4() { return typeid(C); }</div>
<div><br>
</div>
<div>daysthatwere clang$ clang /tmp/red.cpp -c -o red.o</div>
<div>daysthatwere clang$ nm -m red.o | grep __ZTI | c++filt</div>
<div>0000000000000120 (__DATA,__datacoal_nt) weak external typeinfo for A</div>
</div>
<div>
<div>
<div>
<div>                 (undefined) external typeinfo for B</div>
<div>0000000000000150 (__DATA,__const) external typeinfo for C</div>
<div>                 (undefined) external typeinfo for char const*</div>
<div>0000000000000100 (__DATA,__datacoal_nt) weak external typeinfo for char const**</div>
</div>
</div>
<div><br>
</div>
<div>The "external" symbols are strong symbols provided by this object; these aren't a problem.</div>
<div>The "undefined external" symbols are expected to appear in a different object; these also aren't a problem.</div>
<div>The "weak external" symbols are the ones with vague linkage that you care about.</div>
<div><br>
</div>
<div>Otherwise, I don't have any magic bullets for you, sorry.</div>
<div><br>
</div>
<div>John.</div>
</div>
</div>
</div>
</div>
</span>
</body>
</html>