This is the mail archive of the
mailing list for the binutils project.
Re: Possible bug; code-block vanishes when adding one assembler-instruction.
- From: Erik Christiansen <dvalin at internode dot on dot net>
- To: binutils at sourceware dot org
- Date: Wed, 15 May 2013 20:03:22 +1000
- Subject: Re: Possible bug; code-block vanishes when adding one assembler-instruction.
- References: <877gj83448 dot fsf at sandifor-thinkpad dot stglab dot manchester dot uk dot ibm dot com> <20130509113822748942 dot 6df40120 at gpio dot dk> <87sj1w1nt4 dot fsf at sandifor-thinkpad dot stglab dot manchester dot uk dot ibm dot com> <20130509203639970923 dot 8532796d at gpio dot dk> <874nebhoud dot fsf at hase dot home> <20130509230759849349 dot 2f104060 at gpio dot dk> <87fvxvtblq dot fsf at talisman dot default> <20130510133705897264 dot dfd51dcb at gpio dot dk> <87obcdsagq dot fsf at talisman dot default> <20130515061711477582 dot 29984133 at gpio dot dk>
- Reply-to: dvalin at internode dot on dot net
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.)
Harrisberger's Fourth Law of the Lab:
Experience is directly proportional to the amount of equipment ruined.