This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: Uncovered NOP runs
- From: Arnaldo Carvalho de Melo <acme at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Wed, 04 Feb 2009 19:58:09 -0200
- Subject: Re: Uncovered NOP runs
Em Wed, Feb 04, 2009 at 05:16:18PM +0100, Petr Machata escreveu:
> Hi,
>
> .debug_arange analysis shows that there's a lot of holes in .text. Turns
> out these are NOP runs (for alignment purposes, I guess). First, is it
> OK for the producer to leave NOP runs alone? If yes, dwarflint
> shouldn't warn about it, but then there is a problem of how to detect
> this.
>
> I think we can assume that the compiler actually emits literal "NOP"
> instructions for padding purposes (i.e. not one of these contraptions
> that look like they do something). But most of the time, we won't even
> see contents of .text, will we? We are dealing with stripped
> debuginfo-only files. Or are we going to do our debuginfo
> transformation business on full files?
ftrace in the Linux kernel uses NOPs for leaving space for dynamic code
patching, to insert calls to mcount, etc.
I guess the alternatives code in the Linux kernel also uses NOPs to
provide a dynamicly optimizable kernel depending on the processor the
kernel is booted on.
If curious, take a look at:
arch/x86/include/asm/nops.h
arch/x86/include/asm/alternative.h
arch/um/sys-x86_64/shared/sysdep/system.h Look at rdtsc.
in the Linux sources :-)
- Arnaldo