Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22113

Why do I find some never called instructions nopl, nopw after ret or jmp in GCC compiled code? [duplicate]

$
0
0

This question already has an answer here:

When I compile code with gcc - (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 - I find in the compiled code some unused code lines at the end of some/all functions or after some absolute jmp.

It seems the result is to align the code, but: Why don't use simply some 0s or NOPs?

The unused code lines I find are something such as the following code lines where I inserted <==:

1)

134d:       eb b7                   jmp    1306 <msb32+0x16>
134f:       90                      nop    <==
1350:       b8 ff ff ff ff          mov    $0xffffffff,%eax
1355:       c3                      retq
1356:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1) <==
135d:       00 00 00 

0000000000001360 <object_key_compare_serials>:
1360:       48 8b 07                mov    (%rdi),%rax

2)

12fa:       74 44                   je     1340 <msb32+0x50>
[...]
1338:       c3                      retq
1339:       0f 1f 80 00 00 00 00    nopl   0x0(%rax) <==
1340:       c1 e7 10                shl    $0x10,%edi

Viewing all articles
Browse latest Browse all 22113

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>