On Tue, Oct 14, 2014 at 02:42:47AM +0400, Ilya Verbin wrote: > > For that I guess > > lhd_begin_section > > would need to replace: > > section = get_section (name, SECTION_DEBUG, NULL); > > with: > > section = get_section (name, SECTION_DEBUG | SECTION_EXCLUDE, NULL); > > either just for the .gnu.offload_lto prefixed section, or all. > > The question is what will old assemblers and/or linkers do with that, and > > if there are any that support linker plugins, but not SHF_EXCLUDE. > > I've tried to set SECTION_EXCLUDE bit with as+ld version 2.20.51 and got a lot > of warnings like: > > /tmp/ccg7P7iS.s:2: Warning: entity size for SHF_MERGE not specified > /tmp/ccg7P7iS.s:2: Warning: group name for SHF_GROUP not specified > as: /tmp/ccKFKXfc.o: warning: sh_link not set for section > `.gnu.lto_main.11d9780ff2ebf166' > /usr/bin/ld: /tmp/ccKFKXfc.o: warning: sh_link not set for section > `.gnu.lto_main.11d9780ff2ebf166' > > I think, it can be placed under such ifdef: > > #if defined (HAVE_SECTION_EXCLUDE) && HAVE_SECTION_EXCLUDE == 1 > section = get_section (name, SECTION_DEBUG | SECTION_EXCLUDE, NULL); > #else > section = get_section (name, SECTION_DEBUG, NULL); > #endif > > Currently there is HAVE_GAS_SECTION_EXCLUDE implemented in gcc/configure.ac, > and > HAVE_SECTION_EXCLUDE can use it + check a version of the linker.
My preference would be to add the | SECTION_EXCLUDE unconditionally, and instead guard the if (flags & SECTION_EXCLUDE) *f++ = 'e'; in varasm.c (default_elf_asm_named_section). The only other user of SECTION_EXCLUDE seems to be -gsplit-dwarf right now, Cary, is such a change ok with you? If you have new gas and old linker, I'd expect it would just ignore SHF_EXCLUDE. Jakub