I have created two files - file.s
.data
.global hello
hello: .int 23
file1.s
.bss
.comm hello,32,4
.text
.global _start
_start:
mov $hello,%rbx
movl (%rbx),%eax
mov $60,%rax
xor %rdi,%rdi
syscall
now when linking, ld: warning: alignment 1 of symbol `hello' in file.o is smaller than 4 in file1.o I didn't get the alignment part. From the Doc ,
When using ELF or (as a GNU extension) PE, the .comm directive takes an optional third argument. This is the desired alignment of the symbol, specified for ELF as a byte boundary (for example, an alignment of 16 means that the least significant 4 bits of the address should be zero)
Now, why the least significant 4 bits should be zero? I assume because the 12 bits is the size of the symbol and the rest 4 bits now to be aligned to 16 is 0 ? Then why the warning is there from ld?