On Dec 17, 2010, at 1:52 PM, Ian Lance Taylor wrote: > Amittai Aviram <amittai.aviram@xxxxxxxx> writes: > >> int global_a, global_b; > > In C, by default, these are common symbols. They won't be defined in > the .bss section of the .o file. If the linker does not see another > definition, it will eventually allocate them in the .bss section, but > this will be independent of your head.s and tail.s files. You can > change this behaviour with gcc's -fno-common option, q.v. > >> (a) my_data_start is missing, only my_data_end appears. (If, however, >> I only include head.o in my Makefile,rule, then my_data_start appears >> in the location where my_data_end appears in the above extract.) > > I think my_data_start is missing because of the way you are examining > the .o file. There are two symbols at the address of > my_data_start--my_data_start and the first symbol in the .bss section. > objdump -D happens to be showing you just one of them. Use readelf -s > or objdump -t or nm. > >> (b) my_data_end is separated from global_a and global_b and seems to be in an arbitrary location in relation to them. > > That's because they are common symbols. > > Ian Great! To get my my_bss_start label, I just added a defiition: .section .bss .globl my_bss_start my_bss_start: .long 0 Then I compiled and linked with -fno-common, and I now have labels before and after my global variables, within my .bss section. Thanks! Amittai Aviram PhD Student in Computer Science Yale University 646 483 2639 amittai.aviram@xxxxxxxx http://www.amittai.com