[lld] r194860 - [PECOFF] Use INT3 instead of NOP.

Rui Ueyama ruiu at google.com
Sun Nov 17 13:57:37 PST 2013


Currently I'm focusing on correctness rather than performance, and this
change should help debugging, so I'd think we want to keep it as is
regardless of performance implications. I'd rather not run microbenchmarks
and optimize at this moment. Maybe we should add a TODO to revisit it later?


On Sat, Nov 16, 2013 at 11:31 PM, Sean Silva <silvas at purdue.edu> wrote:

> The CPU is probably still decoding these and it might hiccup. Could you
> try running some microbenchmarks to verify that this isn't a performance
> issue? (2 otherwise identical tight asm loops under `perf stat` is probably
> enough)
> It may not be a problem, but in case it is, you're going to have a
> *really* hard time tracking down this performance bug later; all you would
> basically have to go on from a bug report is "when I link my program with
> lld, it runs slower".
>
> -- Sean Silva
>
>
> On Fri, Nov 15, 2013 at 5:11 PM, Rui Ueyama <ruiu at google.com> wrote:
>
>> Author: ruiu
>> Date: Fri Nov 15 16:11:43 2013
>> New Revision: 194860
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=194860&view=rev
>> Log:
>> [PECOFF] Use INT3 instead of NOP.
>>
>> This patch does not change the meaning of the program, but if something's
>> wrong
>> in the linker or the compiler and the control reaches to the gap of
>> imported
>> function table, it will stop immediately because of the presence of INT3.
>> If
>> NOP, it'd fall through to the next call instruction, which is usually a
>> completely foreign function call.
>>
>> Modified:
>>     lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
>>
>> Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp?rev=194860&r1=194859&r2=194860&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp (original)
>> +++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp Fri Nov 15
>> 16:11:43 2013
>> @@ -152,7 +152,7 @@ namespace {
>>
>>  uint8_t FuncAtomContent[] = {
>>    0xff, 0x25, 0x00, 0x00, 0x00, 0x00,  // jmp *0x0
>> -  0x90, 0x90                           // nop; nop
>> +  0xcc, 0xcc                           // int 3; int 3
>>  };
>>
>>  /// The defined atom for jump table.
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131117/c3919873/attachment.html>


More information about the llvm-commits mailing list