gas .p2align directive?

Ian Lance Taylor ian@airs.com
Fri Oct 1 00:00:00 GMT 1999


plantz@sonoma.edu (Robert G. Plantz) writes:

>When I look at the assembly language, gcc generates several instances
>of
>               .p2align    4,,7
>for me. (Yes, there are two commas.)
>I can delete these directives, assemble and link the result, and it
>seems to run just fine.

>What is the purpose of this directive?

gnu.misc.discuss isn't really the right place for such a question.  I
see that you also posted to gnu.gcc.help, which is the right place.
You can ask questions about the assembler on the mailing list
bug-gnu-utils@gnu.org (aka the newsgroup gnu.utils.bug), or on the
mailing list binutils@sourceware.cygnus.com.

To answer your question, I quote the assembler manual, in the
documentation of the .p2align pseudo-op:

       The third expression is also absolute, and is also optional.  If it
    is present, it is the maximum number of bytes that should be skipped by
    this alignment directive.  If doing the alignment would require
    skipping more bytes than the specified maximum, then the alignment is
    not done at all.  You can omit the fill value (the second argument)
    entirely by simply using two commas after the required alignment; this
    can be useful if you want the alignment to be filled with no-op
    instructions when appropriate.

The purpose of the .p2align directive in the compiler output is to
align the code for more efficient execution based on the alignment
requirements of the processor.
-- 
Ian Taylor | ian@airs.com | First to identify quote wins free e-mail message:
``According to [this theory], when [light] reaches the retina, it beats on it,
and, for example, 483B beats a second give red, 727B beats violet, and so on.
So those who are color-blind are those who cannot count the beats, I suppose!''


More information about the Gcc-help mailing list