Re: A question about .debug_macro sections and split dwarf

2015-12-19 Thread Jakub Jelinek
On Fri, Dec 18, 2015 at 10:40:10PM +, Eric Christopher wrote:
> > >> Without -gsplit-dwarf, there is only one .debug_macro section.
> > >>
> > >
> > > Well, that's fascinating. My guess is something in objcopy is mangling.
> >
> > I did some digging last week. It seemed to me that each block of macro
> > entries pointed to by a DW_MACRO_transparent_include (when NOT using
> > -gsplit-dwarf) was getting its own .debug_macro section when using
> > -gsplit-dwarf.
> >
> >
> Fun. Probably something for Jakub and Cary to argue about who is going to
> fix :)

Each block of transparent include of course gets its own section,
without -gsplit-dwarf it is .debug_macro (with various comdat groups, and
without comdat group for the main chunk, i.e. no transparent include part),
and with -gsplit-dwarf the same, except it is called .debug_macro.dwo.
That comdat group name used by GCC is wmN.[.].
That way, the merging of the identical transparent include files can be
performed by the linker at very small cost, rather than needing specialized
DWARF post-processing tool.
The reason for the confusion is that the dwo files are ET_REL object files,
which typically don't have sections merged - match what has been emitted in
assembly, while for -gno-split-dwarf you are probably looking at
ET_EXEC/ET_DYN objects, where the sections with the same name are combined
together.

Jakub


Re: basic asm and memory clobbers - Proposed solution

2015-12-19 Thread David Wohlferd

On 12/18/2015 11:55 AM, Bernd Edlinger wrote:

On 18.12.2015 10:27, David Wohlferd wrote:

On 12/17/2015 11:30 AM, Bernd Edlinger wrote:
Adding this warning to -Wall is too quickly and will bring the ia64, 
tilegx and mep ports into trouble. 

It doesn't look to me like adding the warnings will affect gcc
itself.  But I do see how it could have an impact on people using gcc
on those platforms, if the warning causes them to convert to extended
asm.


At least we should not start a panic until we have really understood all
the details, how to do that.


Phase 1 is a better place to start a panic.


mep: mep_interrupt_saved_reg looks for ASM_INPUT in the body, and
saves different registers if found.

I'm trying to follow this code.  A real challenge since I know nothing
about mep.  But what I see is:

- This routine only applies to functions marked as
__attribute__((interrupt)).
- To correctly generate entry/exit, it walks thru each register (up to
FIRST_PSEUDO_REGISTER) to see if it is used by the routine.  If there
is any basic asm within the routine (regardless of its contents), the
register is considered 'in use.'

The net result is that every register gets saved/restored by the
entry/exit of this routine if it contains basic asm.  The reason this
is important is that if someone just adds a colon, it would suddenly
*not* save/restore all the registers.  Depending on what the asm does,
this could be bad.

Does that sound about right?


Yes.


Seems like a doc update would be appropriate here too then, if anyone 
wanted to volunteer...



This is certainly worth mentioning in the 'convert' doc.

I wonder how often this 'auto-clobber' feature is used, though.  I
don't see it mentioned in the 'interrupt' attribute docs for mep, and
it's not in the basic asm docs either.  If your interrupt doesn't need
many registers, it seems like you'd want to know this and possibly use
extended.  And you'd really want to know if you are doing a
(redundant) push/pop in your interrupt.


tilegx:  They never wrap {} around inline asm. But extended asm, are
handled differently, probably automatically surrounded by braces.

I know nothing about tilegx either.  I've tried to read the code, and
it seems like basic asm does not get 'bundled' while extended might be.

Bundling for tilegx (as I understand it) is when you explicitly fill
multiple pipelines by doing something like this:

{ add r3,r4,r5 ; add r7,r8,r9 ; lw r10,r11 }

So if you have a basic asm statement, you wouldn't want it
automatically bundled by the compiler, since your asm could be more
than 3 statements (the max?).  Or your asm may do its own bundling. So
it makes sense to never output braces when outputting basic asm.

I know I'm guessing about what this means, but doesn't it seem like
those same limitations would apply to extended?  I wonder if this is a
bug.  I don't see any discussion of bundling (of this sort) in the docs.


I wold like to build a cross compiler, but currently that target seems
to be broken. I have to check
that target anyways, because of my other patch with the memory clobbers.

I see in tilegx_asm_output_opcode, that they do somehow automatically
place braces.
An asm("pseudo":) has a special meaning, and can be replaced with "" or "}".
However the static buf[100] means that any extended asm string > 95
characters, invokes
the gcc_assert in line 5487.  In the moment I would _not_ recommend
changing any asm
statements without very careful testing.


Yes, the handling of extended asm there is very strange.

If bundles can only be 3 instructions, then appending an entire extended 
asm in a single (already in-use) bundle seems odd.  But maybe that's 
just because I don't understand tilegx.


I'm not sure it's just changing basic asm to extended I would be 
concerned about.  I'd worry about using extended asm at all...



ia64:  ASM_INPUT emits stop-bits. extended asm does not the same.
That was already mentioned by Segher.

I already had this one from Segher's email.


Given all this, I'm more convinced than ever of the value of
-Wonly-top-basic-asm.  Basic asm is quirky, has undocumented bits and
its behavior is incompatible with other compilers, even though it uses
the same syntax.  If I had any of this in my projects, I'd sure want
to find it and look it over.

But maybe Bernd is right and it's best to leave the warning disabled
in v6, even by -Wall.  I may ask this question again in the next phase
1...


Aehm, yes, maybe the warning could by then be something more reasonable
like:
"Warning: the semantic of basic asm has changed to include implicit
memory clobber,
if you think that is a problem for you, please convert it to basic asm,
otherwise just relax."


I don't think Jeff wants to pursue changes to basic asm's semantics as 
part of v6.  I can't blame him, it's a big change for phase 3. So it 
seems a bit early for the warning to talk about changes in semantics.



With that in mind, how do you feel about the bas

doc maintainer questions

2015-12-19 Thread David Wohlferd
I have been discussing adding some content to the basic asm docs. As 
part of this work, I want to add a discussion of "How to convert basic 
asm to extended asm."  However it doesn't seem like this is a good fit 
for the User Guide.  This is both because the UG doesn't generally talk 
about "How To" write code, and because the text may need updates more 
often than the UG gets released.


I'm thinking this might be a better fit for the gcc wiki.  But that 
brings up a few questions:


1) Is it appropriate for the UG to link to sections in the wiki?  I see 
that we do, but should we?

2) How do I get 'edit' access to the wiki?
3) Where in the wiki should it go?

dw


Re: doc maintainer questions

2015-12-19 Thread Jonathan Wakely
On 19 December 2015 at 19:52, David Wohlferd wrote:
> 2) How do I get 'edit' access to the wiki?

Someone who already has it adds your username to the EditorGroup page
after you convince them you are not a spammer :-)

It would be nice if that step wasn't needed and you could just sign up
and start editing, but we've had too many spammers doing exactly that.

If you've already created an account let me know your username and I'll add you.