|
在linuxforum上找到的這本gas手冊的翻譯項目。
關于這部分的翻譯:
-----------------------------------------------
7.28 .fill repeat , size , value
repeat, size and value are absolute expressions. This emits repeat copies of size bytes. Repeat may be zero or more. Size may be zero or more, but if it is more than 8, then it is deemed to have the value 8, compatible with other people’s assemblers. The contents of each repeat bytes are taken from an 8-byte number. The highest order 4 bytes are zero. The lowest order 4 bytes are value rendered in the byte-order of an integer on the computer as is assembling for. Each size bytes in a repetition is taken from the lowest order size bytes of this number. Again, this bizarre behavior is compatible with other people’s assemblers.
size and value are optional. If the second comma and value are absent, value is assumed zero. If the first comma and following tokens are absent, size is assumed to be 1.
7.28 .fill repeat , size , value
repeat, size 和value都必須是純粹的表達式。本命令生成size個字節的repeat個副本。Repeat可以是0或更大的值。Size 可以是0或更大的值, 但即使size大于8,也被視作8,以兼容其它的匯編器。各個副本中的內容取自一個8字節長的數。最高4個字節為零,最低的4個字節是value,它以 as正在匯編的目標計算機的整數字節順序排列。每個副本中的size個字節都取值于這個數最低的size個字節。再次說明,這個古怪的動作只是為了兼容其他的匯編器。
size參數和value參數是可選的。如果不存在第2個逗號和value參數,則假定value為零。如果不存在第1個逗號和其后的參數,則假定size為1。
------------------------------------------------------------------------------------------------------
再貼一個關于 alignment 和 padding(對齊和填充 )偽指令 的翻譯:
7.3 .align abs-expr, abs-expr, abs-expr
Pad the location counter (in the current subsection) to a particular storage boundary. The first expression (which must be absolute) is the alignment required, as described below.
The second expression (also absolute) gives the fill value to be stored in the padding bytes. It (and the comma) may be omitted. If it is omitted, the padding bytes are normally zero. However, on some systems, if the section is marked as containing code and the fill value is omitted, the space is filled with no-op instructions.
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 way the required alignment is specified varies from system to system. For the a29k, hppa, m68k, m88k, w65, sparc, and Hitachi SH, and i386 using ELF format, the first expression is the alignment request in bytes. For example ‘.align 8’ advances the location counter until it is a multiple of 8. If the location counter is already a multiple of 8, no change is needed.
For other systems, including the i386 using a.out format, and the arm and strongarm, it is the number of low-order zero bits the location counter must have after advancement. For example ‘.align 3’ advances the location counter until it a multiple of 8. If the location counter is already a multiple of 8, no change is needed.
This inconsistency is due to the different behaviors of the various native assemblers for these systems which GAS must emulate. GAS also provides .balign and .p2align directives, described later, which have a consistent behavior across all architectures (but are specific to GAS).
7.3 .align abs-expr, abs-expr, abs-expr
增加位置計數器(在當前的子段)使它指向規定的存儲邊界。第一個表達式參數(結果必須是純粹的數字)是必需參數:邊界基準,見后面的描述。
第二個表達式參數(結果必須是純粹的數字)給出填充字節的值,用這個值填充位置計數器越過的地方。這個參數(和逗點)可以省略,如果省略它,填充字節的值通常是0。但在某些系統上,如果本段標識為包含代碼,而填充值被省略,則使用no-op指令填充這個空間。
第3個參數表達式的結果也必須是純粹的數字,這個參數是可選的。如果存在第3個參數,它代表本對齊命令允許越過字節數的最大值。如果完成這個對齊需要跳過的字節比指定的最大值還多,則根本無法完成對齊。您可以在邊界基準后簡單地使用兩個逗號,以省略填充值參數(第二參數);如果您想在適當的時候,對齊操作自動使用no-op指令填充,這個方法將非常奏效。
邊界基準的定義因系統而有差異。a29k,hppa,m68k,m88k,w65,sparc,Hitachi SH, 和使用ELF格式的i386,第一個表達式是邊界基準,單位是字節。例如‘.align 8’向后移動位置計數器至8的倍數。如果地址已經是8的倍數,則無需移動。
有些其它系統,包括使用a.out格式的i386,ARM和strongarm,這代表位置計數器移動后,計數器中連續為0的低序位數量。例如‘.align 3’向后移動位置計數器直至8的倍數(計數器的最低的3位為0)。如果地址已經是8倍數,則無需移動。
之所以存在這樣的區別,是因為GAS需要模仿各種匯編器的不同動作。GAS還提供.balign和.p2align命令,在以后詳細講述,這兩條命令在所有的機型上使用相同的動作 (但需要向GAS明確說明機型)。 |
|