<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > 有關(guān)arm匯編中的align

有關(guān)arm匯編中的align

作者: 時(shí)間:2016-11-20 來(lái)源:網(wǎng)絡(luò ) 收藏
經(jīng)常會(huì )看到arm-linux匯編中有如下的指令:

.align n
它的含義就是使得下面的代碼按一定規則對齊,.align n 指令的對齊值有兩種方案,n 或 2^n ,
各種平臺最初的匯編器一般都不是gas,采取方案1或2的都很多,gas的目標是取代原來(lái)的匯編器,
必然要保持和原來(lái)匯編器的兼容,因此在gas中如何解釋 .align指令會(huì )顯得有些混亂,原因在于保持兼容。
arm-linu是按照2^n的方案對齊的,需要說(shuō)明的是這個(gè)對齊和ld-script里的對齊不同,不是一會(huì )事。
下面的英文就不同平臺的對齊進(jìn)行了說(shuō)明:
版本2.11.92.0.12的gas的info(Mandrake 8.2上的)這樣說(shuō):

本文引用地址:http://dyxdggzs.com/article/201611/318973.htm

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.

從這段文字來(lái)看,ARM的.align 5就是2的5次方對齊,也就是4字節對齊,通過(guò)反匯編也可以看出對齊方式:
.align 5
stmfd sp!, {r0 - r3, lr}
mov r0, ip
ldmfd sp!, {r0 - r3, pc}^

.align 5
stmfd sp!, {r0 - r3, lr}
mov r0, ip
mov ip, r0
ldmfd sp!, {r0 - r3, pc}^

反匯編:
00000000 <.text>:
0: e92d400f stmdb sp!, {r0, r1, r2, r3, lr}
4: e1a0000c mov r0, ip
8: e8fd800f ldmia sp!, {r0, r1, r2, r3, pc}^
...
20: e92d400f stmdb sp!, {r0, r1, r2, r3, lr}
24: e1a0000c mov r0, ip
28: e1a0c000 mov ip, r0
2c: e8fd800f ldmia sp!, {r0, r1, r2, r3, pc}^
30: e1a00000 nop (mov r0,r0)
34: e1a00000 nop (mov r0,r0)
38: e1a00000 nop (mov r0,r0)
3c: e1a00000 nop (mov r0,r0)

一些忠告:
In the future, everytime when you build an elf file, you need meantime created your map file.
And then you will avoid mistakes like this align.

Also, please also pick up some linker script knowlege part. For embedded system,
we frequently play the linker script to tune an image, for example,
align some special section and so on for protection or/and cache purpose.
wish helpful



關(guān)鍵詞: arm匯編中alig

評論


技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>