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 8:29 PM, Cary Coutant <ccoutant@gmail.com> wrote:
>>> 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.
>

This would more than double the amount of memory for strings that the
assembler needs for this sort of thing. The general case for this is
for compiler generated code and it should be able to do that without
switching. Another option is to maybe have a numeric identifier after?

, unique NUM

to switch back? I'm not sure what the point of switching back is going
to be in the general case (other than "hey, this might be useful").

-eric


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