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: Possible bug; code-block vanishes when adding one assembler-instruction.


On 15.05.13 06:17, Jens Bauer wrote:
> (Anyone - feel free to comment on this)

That is a dangerous invitation. :-)

ISTM that the "fix" proposal takes a somewhat limited view of gas usage
(see below), and the "problem" arose from not observing correct section
flag practice, which is to some extent documented in "7.79 `.section
NAME'" in "info gas". (At least in the one for binutils 2.20.1, which I
have to hand.) Admittedly, flag syntax is much easier to pick up from
seeing it used in code snippets.

> >> ...Or the assembler could perhaps mark bare .section .foo as
> >> "ax"/progbits by default; I guess it would be possible to create a
> >> plain .section .foo, by just using .section	.foo,"",@nobits

If we perform an "objdump -h" on a compiled ELF file, we may see
LOAD, as well as ALLOCATED. AIUI, @nobits is for the latter without the
former. Null content is not what I envisage as a "plain .section". As
for "ax", the "x" can be problematic as a default.

However, adding a gas option, which could enable warnings, would be an
adequately backward-compatible innovation, I think.

A couple of upthread points now also require belated comment, if only to
air other .section directive usage:

                             --------------
On 10.05.13 13:37, Jens Bauer wrote:
> It isn't often that the .section directive is used in an
> assembly-source file.

In reality, usage varies. In embedded systems, I almost always use it
several times in an assembler file. Each file becomes an "object" if it
has all its .bss, .initN, .text sections populated in succession. In
embedded systems there are often other sections as well. Everything is
in one place, making it easier to maintain.

Using .pushsection, and .popsection, I sometimes have a macro put code
into the current section, and also a labelled .space into .bss, so that
the macro is also object-like. There could then easily be a dozen
section directives in a modest sized file.

And if we're doing it in C, then there's also no limit to the number of
   __attribute__ ((section (".tramp")))
we might use in a file, with or without explicit flags. I will admit
that that does seem to give the default which you're looking for, IIUC.

                             --------------

Back to the later post:
On 15.05.13 06:17, Jens Bauer wrote:
> Actually, it was because I saw the way '.section .rodata' was used, I
> used '.section .fastcode' the same way. Yep, that was still my fault,
> that I did not read about how to use .section, before using it.

Groping in the dark is no fun, and learning is made more painful by lack
of examples to light the path.

Maybe a couple of examples ought to be added to the gas info page? For a
couple of decades now, I've just ambled from target to target, using the
same gas flags with impunity, so one set of examples might nearly do?
(The @ vs % warning is already in the info doc.)

Erik

-- 
Harrisberger's Fourth Law of the Lab:                                         
   Experience is directly proportional to the amount of equipment ruined.


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