I can't get data alignment working in the data section on Linux/x86
I'm posting an example below. I always get the bss section correctly aligned, and no matter what, the data section doesn't have proper alignment?
; nasm -f elf test.asm; gcc -m32 -o test test.o
; $ nasm -v
; NASM version 0.98.39 compiled on Aug 29 2007
; $ gcc -v
; Using built-in specs.
; Target: i486-linux-gnu
; Thread model: posix
; gcc version 4.2.1 (Debian 4.2.1-5)
bits 32
global main
; the align are useless here, not getting 16 aligned data
section .data align 16
align 16
idata dw 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
; the align 16 is not even needed, I always get 16 aligned for this section
section .bss ; align 16
; align 16
bssdata resb 16
section .text
main:
mov ebx, bssdata
mov ebx, idata
mov eax, 1
int 0x80
disassembled to:
0x08048350 : mov $0x8049550,%ebx
0x08048355 : mov $0x804953c,%ebx
0x0804835a : mov $0x1,%eax
0x0804835f : int $0x80