This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Some extensions to the .section directive for ELF and COFF
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Rafael EspÃndola <rafael dot espindola at gmail dot com>, Binutils <binutils at sourceware dot org>, Eric Christopher <echristo at gmail dot com>, nickc at redhat dot com, Richard Sandiford <rsandifo at linux dot vnet dot ibm dot com>, Reid Kleckner <rnk at google dot com>
- Date: Wed, 25 Mar 2015 20:29:34 -0700
- Subject: Re: Some extensions to the .section directive for ELF and COFF
- Authentication-results: sourceware.org; auth=none
- References: <CAG3jReLKTfN_o1x7_jpMDVzMHemmx9K9P4-yU4qNLm2xtPpd+Q at mail dot gmail dot com> <20150326015631 dot GT26234 at bubble dot grove dot modra dot org>
>> 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'd prefer to extend the .section directive so you can give each
section both an "internal" (or "assembler") name, and an "external"
(or "linker") name. You can give each section a unique internal name
and switch back and forth at will, but they'll all get written to the
output file with the external name.
-cary