Skip disassembling .plt section, then .plt section code will be treated as external code.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
76 | are these test changes expected? |
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
11–12 | This will be fixed by https://reviews.llvm.org/D115550 | |
76 | Oh, sorry, it's the same to https://reviews.llvm.org/D115538, previously I removed by mistake. Let me removed this here. |
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
76 | If you put them in a stack, these earlier/unrelated changes won't show up. But still.. why are the remaining test changes, are they all due to PLT? |
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
76 | This patch is in the bottom of the patch stack. It appeared that those counter changes are all fixed by the following two patches. I guess it's due to the wrong leading external addr processing. let me confirm what's wrong. |
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
76 | OK, it turned out that the PLT address is just the leading LBR's target, remembering before the two external fix, the whole samples will be ignored. 0x400540 is plt 400870 0x400870/0x400540/P/-/-/1 0x4008bf/0x400870/P/-/-/7 0x7f7448e88cc1/0x400875/P/-/-/1 | |
llvm/tools/llvm-profgen/ProfiledBinary.cpp | ||
557 | objdump also print out ".plt" section, I was thinking to print a section name as a hint we have the ".plt" section there(the size is not empty, we just doesn't disassembly it's body). Otherwise people might misunderstand there is no ".plt" section |
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
76 | I see. So the counters 5.1, 5.3 ... correspond to a call to the PLT entries right? | |
llvm/tools/llvm-profgen/ProfiledBinary.cpp | ||
557 | Makes sense, though I was thinking we'll probably use objdump to look at real disasm, and use llvm-profgen to dump only functions of interest. |
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
76 | Nearby the call to PLT, the code after return from PLT. range [0x400875, 0x4008bf] 400870: e8 cb fc ff ff callq 400540 <rand@plt> 400875: 48 98 cltq 400877: 48 69 c8 1f 85 eb 51 imul $0x51eb851f,%rax,%rcx 40087e: 48 89 ca mov %rcx,%rdx 400881: 48 c1 ea 3f shr $0x3f,%rdx 400885: 48 c1 f9 26 sar $0x26,%rcx 400889: 01 d1 add %edx,%ecx 40088b: 69 c9 c8 00 00 00 imul $0xc8,%ecx,%ecx 400891: 29 c8 sub %ecx,%eax 400893: 89 04 ab mov %eax,(%rbx,%rbp,4) 400896: 48 83 c5 01 add $0x1,%rbp 40089a: 48 81 fd c8 00 00 00 cmp $0xc8,%rbp 4008a1: 0f 84 69 ff ff ff je 400810 <main+0x30> 4008a7: 40 0f b6 c5 movzbl %bpl,%eax 4008ab: 69 c0 cd 00 00 00 imul $0xcd,%eax,%eax 4008b1: c1 e8 0a shr $0xa,%eax 4008b4: 83 e0 fe and $0xfffffffe,%eax 4008b7: 8d 04 80 lea (%rax,%rax,4),%eax 4008ba: f7 d8 neg %eax 4008bc: 40 00 e8 add %bpl,%al 4008bf: 75 af jne 400870 <main+0x90> |
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
76 | This is probably unimportant but I'm wondering why the counters don't come with a call target like ;CHECK: 5.1: rand@plt : 10 |
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
76 | Oh, because we rand@plt is not a function, remembering we set isFunctionEntry when dwarf name match symbol name, here it doesn't match. |
LGTM.
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
76 | Gotcha, thanks for explanation. |
This will be fixed by https://reviews.llvm.org/D115550