"H.J. Lu" <hjl.to...@gmail.com> writes: > GNU assembler understands: > > .section .init_array* > > If Solaris assembler doesn't, I don't know how it will work > with .init_array with priority.
That's not the issue: merging .init_array* sections is handled all right by gld irrespective of sh_type; there's nothing required from the assembler here. My problem is different: consider $ cat ia-no-sht.s .section .init_array $ cat ia-no-sht-f.s .section .init_array,"aw" If I assemble this with gas 2.22, I get the same section header for both inputs: gas/ia-no-sht.o: Section Header[4]: sh_name: .init_array sh_addr: 0 sh_flags: [ SHF_WRITE SHF_ALLOC ] sh_size: 0 sh_type: [ SHT_INIT_ARRAY ] sh_offset: 0x34 sh_entsize: 0 sh_link: 0 sh_info: 0 sh_addralign: 0x1 gas/ia-no-sht-f.o: Section Header[4]: sh_name: .init_array sh_addr: 0 sh_flags: [ SHF_WRITE SHF_ALLOC ] sh_size: 0 sh_type: [ SHT_INIT_ARRAY ] sh_offset: 0x34 sh_entsize: 0 sh_link: 0 sh_info: 0 sh_addralign: 0x1 With as instead, I get as/ia-no-sht.o: Section Header[3]: sh_name: .init_array sh_addr: 0 sh_flags: 0 sh_size: 0 sh_type: [ SHT_PROGBITS ] sh_offset: 0x59 sh_entsize: 0 sh_link: 0 sh_info: 0 sh_addralign: 0x1 as/ia-no-sht-f.o: Section Header[3]: sh_name: .init_array sh_addr: 0 sh_flags: [ SHF_WRITE SHF_ALLOC ] sh_size: 0 sh_type: [ SHT_PROGBITS ] sh_offset: 0x59 sh_entsize: 0 sh_link: 0 sh_info: 0 sh_addralign: 0x1 The problem is not the wrong sh_type (SHT_PROGBITS instead of SHT_INIT_ARRAY): gld handles both input sections alike and doesn't care. Rather, the 0 sh_flags when no section flags are specified seem to cause gld to mishandle the resulting objects. So for gas, my patch makes no difference, but fixes/works around the problematic as/gld combo. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University