https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68414
Bug ID: 68414 Summary: gcc doesn't emit .skip for .vtable_map_vars sections Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: ro at gcc dot gnu.org CC: ctice at gcc dot gnu.org Target Milestone: --- Host: *-*-solaris2.* Target: *-*-solaris2.* Build: *-*-solaris2.* Created attachment 36760 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36760&action=edit minimal patch, untested While doing the libvtv port to Solaris, all testcases were failing on Solaris/SPARC with Solaris as. It turned out that as doesn't set sh_addralign in the section header for .vtable_map_vars. This is not a problem with gas in this case, but for a regular .bss section gcc emits .skip 1 which avoids this. Consider the following: $ cat align.bss.c #define VTV_PAGE_SIZE 4096 char _vtable_map_vars_start [] __attribute__ ((aligned(VTV_PAGE_SIZE))) = { }; $ gcc -S align.bss.c $ cat align.vmv.c #define VTV_PAGE_SIZE 4096 char _vtable_map_vars_start [] __attribute__ ((aligned(VTV_PAGE_SIZE),section(".vtable_map_vars"))) = { }; $ gcc -S align.vmv.c $ diff -u align.{bss,vmv}.s --- align.bss.s 2015-11-18 16:20:37.628513468 +0100 +++ align.vmv.s 2015-11-18 16:21:43.411691226 +0100 @@ -1,9 +1,9 @@ - .file "align.bss.c" + .file "align.vmv.c" .global _vtable_map_vars_start - .section ".bss" + .section ".vtable_map_vars%_vtable_map_vars_start",#alloc,#write,#progbits + .group _vtable_map_vars_start,".vtable_map_vars%_vtable_map_vars_start",#comdat .align 4096 .type _vtable_map_vars_start, #object .size _vtable_map_vars_start, 0 _vtable_map_vars_start: - .skip 1 .ident "GCC: (GNU) 5.1.0" I think this needs to be fixed in varasm.c (assemble_variable) in the special case for .vtable_map_vars, with something like the attached patch. I'm just not sure which conditions are necessary to avoid emitting .skip in unappropriate cases. Rainer