On Sun, Oct 30, 2016 at 08:31:47PM +0100, Jan Kratochvil wrote:
> On Fri, 21 Oct 2016 21:32:42 +0200, Jakub Jelinek wrote:
> > This patch changes the .debug_info headers to follow the current
> > specification (I still hope the useless padding1/padding2 fields will be
> > removed), and also changes the -gsplit-dwarf stuff to move dwo_id into
> > the header and use DW_UT_{skeleton,split_*}.
> 
> During GDB consumer patch testing I needed this fix on top of your patch.

Thanks for noticing it.  As I had no consumer, all I did was eyeballing
-gdwarf-5 -dA output, and haven't noticed this.

> diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
> index 7c6a9e9..1c0ca35 100644
> --- a/gcc/dwarf2out.c
> +++ b/gcc/dwarf2out.c
> @@ -2977,7 +2977,8 @@ skeleton_chain_node;
>  
>  /* Fixed size portion of the DWARF compilation unit header.  */
>  #define DWARF_COMPILE_UNIT_HEADER_SIZE \
> -  (DWARF_INITIAL_LENGTH_SIZE + DWARF_OFFSET_SIZE + 3)
> +  (DWARF_INITIAL_LENGTH_SIZE + DWARF_OFFSET_SIZE \
> +   + (dwarf_version < 5 ? 3 : 4 + 8 + DWARF_OFFSET_SIZE))

I'd use DWARF_TYPE_SIGNATURE_SIZE instead of the 8 to match the define
below it.

>  /* Fixed size portion of the DWARF comdat type unit header.  */
>  #define DWARF_COMDAT_TYPE_UNIT_HEADER_SIZE \

And this define needs adjusting too.

I still hope we can get rid of the useless padding for the most common
DW_UT_* types, I've raised it on dwarf workgroup and got some positive
reactions, but will now file it officially as public review issue.

2016-10-31  Jan Kratochvil  <jan.kratoch...@redhat.com>
            Jakub Jelinek  <ja...@redhat.com>

        * dwarf2out.c (DWARF_COMPILE_UNIT_HEADER_SIZE): Adjust for -gdwarf-5.
        (DWARF_COMDAT_TYPE_UNIT_HEADER_SIZE): Likewise.

--- gcc/dwarf2out.c.jj  2016-10-27 15:57:24.000000000 +0200
+++ gcc/dwarf2out.c     2016-10-31 10:12:20.338761079 +0100
@@ -2805,12 +2805,15 @@ skeleton_chain_node;
 
 /* Fixed size portion of the DWARF compilation unit header.  */
 #define DWARF_COMPILE_UNIT_HEADER_SIZE \
-  (DWARF_INITIAL_LENGTH_SIZE + DWARF_OFFSET_SIZE + 3)
+  (DWARF_INITIAL_LENGTH_SIZE + DWARF_OFFSET_SIZE                       \
+   + (dwarf_version >= 5                                               \
+      ? 4 + DWARF_TYPE_SIGNATURE_SIZE + DWARF_OFFSET_SIZE : 3))
 
 /* Fixed size portion of the DWARF comdat type unit header.  */
 #define DWARF_COMDAT_TYPE_UNIT_HEADER_SIZE \
-  (DWARF_COMPILE_UNIT_HEADER_SIZE + DWARF_TYPE_SIGNATURE_SIZE \
-   + DWARF_OFFSET_SIZE)
+  (DWARF_COMPILE_UNIT_HEADER_SIZE                                      \
+   + (dwarf_version >= 5                                               \
+      ? 0 : DWARF_TYPE_SIGNATURE_SIZE + DWARF_OFFSET_SIZE))
 
 /* Fixed size portion of public names info.  */
 #define DWARF_PUBNAMES_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 2)


        Jakub

Reply via email to