[llvm-dev] Why llvm emits the fixup referring to nop or nop-like instruction?

Hyungjoon Koo via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 11 13:20:05 PDT 2017


Compiled Xalan (one of SPEC2006 programs) with llvm 3.9.0,
I have discovered the fixup of the jmp instruction at 0x4143FF is pointing
to nop instruction (at 0x414175)
instead of the next instruction at 0x414180.

.text:0000000000414175 66 66 2E 0F 1F 84 00 00 00 00 00     nop     word
ptr [rax+rax+00000000h]
.text:0000000000414180 49 8B 06                             mov     rax,
[r14]
.text:0000000000414183 48 8B 98 F8 00 00 00                 mov     rbx,
[rax+0F8h]
...
.text:00000000004143F7 48 89 DF             mov     rdi, rbx
.text:00000000004143FA E8 91 E2 FE FF       call    ___cxa_throw
.text:00000000004143FF E9 71 FD FF FF       jmp     loc_414175
...

The following is another example that the unconditional branch (0x460025)
points to *nop-like* instruction
(xchg ax, ax @0x46003e) instead of the next instruction (0x460040).
...
.text:0000000000460025 EB 17                jmp     short loc_46003E
.text:0000000000460027 31 ED                xor     ebp, ebp
.text:0000000000460029 E9 CB 02 00 00       jmp     loc_4602F9
.text:000000000046002E 66 90                align 10h
.text:0000000000460030 8D 50 01             lea     edx, [rax+1]
.text:0000000000460033 41 89 54 24 04       mov     [r12+4], edx
.text:0000000000460038 89 C0                mov     eax, eax
.text:000000000046003A 66 89 2C 41          mov     [rcx+rax*2], bp
.text:000000000046003E 66 90                xchg    ax, ax
.text:0000000000460040 48 8B 7B 50          mov     rdi, [rbx+50h]  ; this
...

Xalan is the only case that has this particular issue of all SPEC - 13
fixups in total point to 3 locations that contain
either nop or nop-like instructions. I understand there is no problem to
execute the binary but
why LLVM emits the binary that has fixups referring to NOP (I think it's a
MC alignment fragment),
not a legitimate code fragment (or logical basic block)? Is this expected?

Thanks!


Best Regards,
Hyungjoon Koo (Kevin)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170711/715343b9/attachment-0001.html>


More information about the llvm-dev mailing list