This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Some extensions to the .section directive for ELF and COFF


On Wed, Mar 25, 2015 at 01:03:57PM -0400, Rafael Espíndola wrote:
> The solutions was to make the COFF .section look a bit more like the ELF one:
> 
>  .section foo, "dr", discard, "Symbol1"
>  .section foo, "dr", discard, "Symbol2"
> 
> creates two sections named foo with different comdat symbols. This is
> currently used by LLVM on windows as it matches the behavior of cl.
> 
> The issue with the ELF one was similar: We need different section
> names unless the comdats are different. This in turn requires the
> compiler to be creative with section names when using
> -ffunction-section -fdata-sections and those can get quite big.
> 
> The extension was to add an optional ",unique":
> 
> -----------------------------------------
> .section .text,"ax",@progbits,unique
> .section .text,"ax",@progbits,unique
> -----------------------------------------
> 
> Creates two sections named ".text".

Sounds reasonable, but, having changed from one of these sections, how
do you change back into the right one?  Hmm, I guess .pushsection
.popsection will work, and .previous, but plain .text won't.  Oh well,
I guess that's not a really big problem, but something that assembly
programmers will need to consider.

I suspect having two .text sections will run into other issues lurking
in gas..  For example, section symbols for these sections, ARM and
IA64 unwind sections for .text, obj-ecoff.c:tc_frob_file_before_fix,
and probably more.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]