[Dwarf-Discuss] Proposal to add DW_AT_alignment

Mark Wielaard mjw at redhat.com
Mon Jun 2 05:07:14 PDT 2014

On Wed, 2014-05-28 at 16:33 -0700, Joel Brobecker wrote:
> Very interesting proposal! Thanks for putting it together.

Thanks. BTW part of the reason to propose this was the new gcc/gdb
expression support for C as recently posted to the gcc and gdb lists:
Having the actual alignment used around makes it more useful/reliable.

> I thought I would mention that Ada allows the user to specify
> stricter alignments for objects too. And also, GNAT sometimes
> decides on its own to use stricter alignments for certain objects.
> Perhaps we might want to add Ada as an another example where
> such source-level requirements can be used? It is not strictly
> necessary but I have a feeling that it would convey the idea
> that the concept is used a little more widely than just through
> C11 and GNU extensions.

Thanks, I didn't know that. The proposal was certainly written with the
above and the description C11 in mind. One thing I wanted to make clear
was that a producer only needs to add the alignment if it is different
from the default alignment as used for the language and abi. And that
the producer should only add the alignment actually used (since in C11
you can add multiple alignment requests for the same type but only the
strictest is used). Adding an example for both C11 and Ada is probably a
good idea in case such assumptions might be similar (or different)
between the languages.

> I don't understand yet why you think that having a new TAG
> is a better approach. Is that because you think the compiler
> will generate the debug info for the base type regardless,
> and so having a new TAG with just that attribute and a reference
> to the base type would save a little bit of space? Or maybe
> it better follows how other modifiers such as "volatile" are
> being described? (I just realized this while typing this email)

Yes, both of those reasons. I was going through all the TAGs that might
carry an alignment attribute and then stumbled upon the type modifier
TAGs like volatile and realized that was a more direct fit instead of
adding a separate attribute only.

> > DW_TAG_aligned_type). Figure 15 Type modifier tags add:
> > DW_TAG_aligned_type non-default alignment requirements of type.
> Maybe it's just because of the formatting that got lost, but
> I don't understand what's being added.

Michael was so nice to send me a copy of the proposal as saved in the
web-submission-system that has most formatting as I originally submitted
it retained. Attached below. Hopefully that is more readable.

As Michael points out the official deadline for new proposals for DWARF
5 has passed. So maybe some of the later proposals don't make it for
DWARF 5.0 final if the committee is very strict about the dates. But the
important thing is that we review and discuss the proposal and make sure
any (GNU) extensions will be as close as possible to what gets adopted
into the standard eventually.

I'll try to prototype an implementation for GCC this week and see what
it looks like in practice so we can discuss things a bit more

BTW. It would be nice if the sources of the spec were available. Then we
could just exchange patches, which might be easier to read in context.


-------------- next part --------------
An embedded message was scrubbed...
From: Michael Eager <eager at eagercon.com>
Subject: Re: Dwarf Comment Submission
Date: Thu, 29 May 2014 00:34:19 -0700
Size: 5058
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20140602/824006bd/attachment.eml>

More information about the Dwarf-Discuss mailing list