<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang -O2 doesn't export the same symbols as gcc with virtual destructor"
   href="https://bugs.llvm.org/show_bug.cgi?id=45322">45322</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang -O2 doesn't export the same symbols as gcc with virtual destructor
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sylvestre@debian.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Happening on a bunch of cases here:
<a href="https://clang.debian.net/status.php?version=9.0.1&key=CHANGE_SYM_LIB">https://clang.debian.net/status.php?version=9.0.1&key=CHANGE_SYM_LIB</a>

Probably not a recent issue

=== a.cpp ===
#include <stddef.h>
namespace pugi {
class xml_writer {
public:
  virtual ~xml_writer() {}
};
class a : xml_writer {
  virtual void b(const void *, size_t);
};
void a::b(const void *, size_t) {}
} // namespace pugi


=== script

ARG="  -O2 -o pugixml.cpp.o -c a.cpp"

CXX=/usr/bin/clang++
$CXX $ARG
mv pugixml.cpp.o clang.o


CXX=/usr/bin/g++-9
$CXX $ARG
mv pugixml.cpp.o gcc.o

nm clang.o |grep -q N4pugi10xml_writerD2Ev
nm gcc.o |grep -q  N4pugi10xml_writerD2Ev

===
Will show:

nm clang.o |grep N4pugi10xml_writerD2Ev
0000000000000000 W _ZN4pugi10xml_writerD2Ev
nm gcc.o |grep  N4pugi10xml_writerD2Ev

=== 
without -O2, gcc will generate the symbol too.

maybe clang should remove too when -O2 is used?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>