[llvm-bugs] [Bug 37394] New: clang produces duplicate symbols when enabling Control Flow Integrity (icall)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 9 11:43:05 PDT 2018


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

            Bug ID: 37394
           Summary: clang produces duplicate symbols when enabling Control
                    Flow Integrity (icall)
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tom at ritter.vg
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

When I compile the following minimized repoducer, I have duplicate symbols when
enabling CFI. Without CFI, there is only one symbol

> 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, at 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; }

My command is

> 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


I am using a clang/lld/llvm toolchain with llvm revision 317840


See Also: https://bugzilla.mozilla.org/show_bug.cgi?id=1459624

-- 
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/20180509/6d8d2bcd/attachment-0001.html>


More information about the llvm-bugs mailing list