<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 produces duplicate symbols when enabling Control Flow Integrity (icall)"
href="https://bugs.llvm.org/show_bug.cgi?id=37394">37394</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang produces duplicate symbols when enabling Control Flow Integrity (icall)
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tom@ritter.vg
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>When I compile the following minimized repoducer, I have duplicate symbols when
enabling CFI. Without CFI, there is only one symbol
<span class="quote">> extern int printf (__const char *__restrict __format, ...);
>
> class nsIXPTCStubBase
> {
> public:
> virtual int Stub20() = 0;
> virtual int Sentinel0() = 0;
> };
> class nsXPTCStubBase final : public nsIXPTCStubBase
> {
> public:
> virtual int Stub20() override;
> virtual int Sentinel0() override;
> };
>
>
> asm(".section \".text\"\n\t" \
> ".align 2\n\t" \
> ".globl _ZN14nsXPTCStubBase6Stub20Ev\n\t" \
> ".hidden _ZN14nsXPTCStubBase6Stub20Ev\n\t" \
> ".type _ZN14nsXPTCStubBase6Stub20Ev,@function\n" \
> "_ZN14nsXPTCStubBase6Stub20Ev:\n\t" \
>
> "movl $20, %eax\n\t" \
> "jmp SharedStub\n\t" \
>
> ".size _ZN14nsXPTCStubBase6Stub20Ev,.-_ZN14nsXPTCStubBase6Stub20Ev\n\t" \
> );
>
> int nsXPTCStubBase::Sentinel0() { printf("hi"); return 0; }</span >
My command is
<span class="quote">> clang++ -std=gnu++14 -c -o xptcstubs_x86_64_linux.o -fuse-ld=lld -flto=thin -fsanitize=cfi-icall xptcstubs_x86_64_linux.i && llvm-nm xptcstubs_x86_64_linux.o | grep Stub20 && rm xptcstubs_x86_64_linux.o
> clang-6.0: warning: treating 'cpp-output' input as 'c++-cpp-output' when in C++ mode, this behavior is deprecated [-Wdeprecated]
> clang-6.0: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
> ---------------- T _ZN14nsXPTCStubBase6Stub20Ev
> ---------------- T _ZN14nsXPTCStubBase6Stub20Ev</span >
I am using a clang/lld/llvm toolchain with llvm revision 317840
See Also: <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1459624">https://bugzilla.mozilla.org/show_bug.cgi?id=1459624</a></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>