assembly - Gas .align instruction doesn't work correctly -


i'm using gas , trying align .lcomm buffer on 16 bytes.

code :

.align 16  .lcomm buffer, size 

but when checking address of buffer using leal instruction. seems not aligned. think .align directive doesn't work correctly.

do have idea please ?

of course works correctly, use wrong. manual says:

some targets permit third argument used .lcomm. argument specifies desired alignment of symbol in bss section.

so correct code .lcomm buffer, size, 16. note .align not affect .lcomm if not in .bss section. if want allocate stuff hand, switch .bss, use .align , allocate using .space not .lcomm.

also, manual gives workaround suggestion as:

for targets .lcomm directive (see lcomm) not accept alignment argument, case elf targets, .local directive can used in combination .comm (see comm) define aligned local common data.

indeed, x86 elf alignment argument not supported, implementing workaround like:

.local buffer .comm buffer, size, 16 

(thanks @wumpus-q-wumbley pointing out.)


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -