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 26.03.15 13:00, Eric Christopher wrote:
> 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.

To this assembly programmer such a gcc-centric feature seems best
avoided. Generating our own unique input sections, then combining them
into desired output sections via a custom linker script provides much
greater control.

But what about just putting subsections back into as?
(If 8192 are no longer enough, then more of them.)

> > 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.

OK, it can reduce the size of .o files. 
But wouldn't subsections do the same, i.e. emit only full sections in
ELF? (While retaining fully identifiable and re-accessible subsections.)

> 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").

In the case where reverting to the section might occur, then using an
unknown identifier makes little sense. Tacking a recognisable tag onto
an unknown identifier seems like trying to be a little bit pregnant.

What appears to be re-evolving is subsections, documented here:

http://tigcc.ticalc.org/doc/gnuasm.html

but no longer functional in "GNU assembler (GNU Binutils for Debian)
2.22" or avr-as 2.20.1.20100303, if I'm holding my mouth right. 

Is that due to bit rot? It is documented here:

https://www.sourceware.org/binutils/docs-2.12/as.info/Pseudo-Ops.html#Pseudo%20Ops

It would, IME, be far superior to bring back subsections to as, than
imitate them, limited by mystery identifiers. Let gcc apply mystery
identifiers to as subsections by all means, but couldn't we have the
power of subsections back into the bargain?

Then the word SUBSECTION_ALIGN in my local copy of "info ld" wouldn't be
so lonely, either.

Erik

-- 
Duct tape is like the force. It has a light side, and a dark side, and
it holds the universe together.
                                                         - Carl Zwanzig


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