[llvm-bugs] [Bug 33145] New: --wrap doesn't work with lto

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 23 12:17:26 PDT 2017


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

            Bug ID: 33145
           Summary: --wrap doesn't work with lto
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: rafael.espindola at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18498
  --> https://bugs.llvm.org/attachment.cgi?id=18498&action=edit
testcase

In the included testcase we have

void foo() {
  bar();
  __real_bar();
}

When linking without lto, we get

0000000000001000 <foo>:
    1000:       50                      push   %rax
    1001:       31 c0                   xor    %eax,%eax
    1003:       e8 28 00 00 00          callq  1030 <__wrap_bar at plt>
    1008:       31 c0                   xor    %eax,%eax
    100a:       59                      pop    %rcx
    100b:       e9 30 00 00 00          jmpq   1040 <bar at plt>

Which is what is expected.

With lto we get

0000000000001000 <foo>:
    1000:       50                      push   %rax
    1001:       31 c0                   xor    %eax,%eax
    1003:       e8 28 00 00 00          callq  1030 <this_is_bar at plt>
    1008:       31 c0                   xor    %eax,%eax
    100a:       59                      pop    %rcx
    100b:       e9 30 00 00 00          jmpq   1040 <this_is_real_bar at plt>

Showing that bar and __real_bar were inlined before the wrapping.

-- 
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/20170523/a35984c2/attachment.html>


More information about the llvm-bugs mailing list