<div dir="ltr"><div><div><div>Hi,<br><br></div>I was doing some experiments with LLD and noticed that it pads out OutputSections with null bytes in all cases (as far as I could tell). However, for executable sections on some targets, 0x00 forms part of an executable instruction that is not nop. In particular, for x86_64 targets at least, the sequence 0x00 0x00 is an add instruction. This can result in confusing disassembly.<br><br></div>For example, on x86_64, given a simple InputSection that is a single "0xc3 retq" instruction, and given an alignment of 16 bytes, 15 null bytes are inserted between the end of that InputSection and the next. In the disassembly I then see the retq instruction followed by a series of adds, the last of which actually consumes 1 or more bytes of the next section to form a valid instruction, which can in turn throw off the disassembly of the following instructions at the start of the next section.<br><br>What do people think about using a target-specific nop instruction sequence to pad executable sections? Another possible option, on x86_64 at least (I haven't investigated other targets), is to use the 0xcc interrupt instruction.<br><br></div><div>Regards,<br><br></div><div>James<br></div></div>