[llvm] r198389 - Revert "Reverting r193835 due to weirdness with Go..."

dblaikie at gmail.com dblaikie at gmail.com
Fri Jan 3 10:26:17 PST 2014


One caveat is that Eric (& I can't really disagree) would rather like to
kill off some of the old DWARF support to keep our codebase simple - so if
there's any way you can upgrade those tools to cope with modern DWARF,
that'd be really nice.

But for the specific issue of stmt_list and sec_offset, so far as I can
tell this is not reproducible with ToT Clang/LLVM. I get:

echo "int main(void) { return 0; }" | clang-tot -gdwarf-2 -S -x c - -o -

        .byte   16                      # DW_AT_stmt_list
        .byte   6                       # DW_FORM_data4

And the code in LLVM looks like it does the right thing here, choosing the
form based on DWARF version.

On Fri Jan 03 2014 at 8:26:06 AM, Dimitry Andric <dimitry at andric.com> wrote:

> On 03 Jan 2014, at 02:30, David Blaikie <dblaikie at gmail.com> wrote:
> > Author: dblaikie
> > Date: Thu Jan  2 19:30:05 2014
> > New Revision: 198389
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=198389&view=rev
> > Log:
> > Revert "Reverting r193835 due to weirdness with Go..."
> >
> > The cgo problem was that it wants dwarf2 which doesn't support direct
> > constant encoding of the location. So let's add support for dwarf2
> > encoding (using a location expression) of data member locations.
> >
> > This reverts commit r198385.
>
> Hi David,
>
> This solves at least one problem that I encountered when importing clang
> 3.4 into FreeBSD 11.  Some of our kernel tools for DTrace support require
> dwarf 2, so we compile with -gdwarf-2.  Applying a slightly modified form
> of this commit to my copy of clang 3.4 makes it work partially.
>
> Though even with -gdwarf-2, clang still outputs DW_FORM_sec_offset
> attribute forms, which apparently are DWARF4 only.  The DWARF4 spec says,
> under "Changes from Version 3 to Version 4": "Add a new attribute form for
> section offsets, DW_FORM_sec_offset, to replace the use of DW_FORM_data4
> and DW_FORM_data8 for section offsets."
>
> For example, if you compile an "int main(void) { return 0; }" program with
> -gdwarf-2 -S, the resulting .debug_abbrev section has:
>
>         .section        .debug_abbrev,"", at progbits
> .L.debug_abbrev_begin:
>         .byte   1                       # Abbreviation Code
>         .byte   17                      # DW_TAG_compile_unit
>         .byte   1                       # DW_CHILDREN_yes
>         .byte   37                      # DW_AT_producer
>         .byte   14                      # DW_FORM_strp
>         .byte   19                      # DW_AT_language
>         .byte   5                       # DW_FORM_data2
>         .byte   3                       # DW_AT_name
>         .byte   14                      # DW_FORM_strp
>         .byte   17                      # DW_AT_low_pc
>         .byte   1                       # DW_FORM_addr
>         .byte   16                      # DW_AT_stmt_list
>         .byte   23                      # DW_FORM_sec_offset   <=== DWARF4?
>         .byte   27                      # DW_AT_comp_dir
>         .byte   14                      # DW_FORM_strp
>         .byte   0                       # EOM(1)
>         .byte   0                       # EOM(2)
>         .byte   2                       # Abbreviation Code
>         .byte   46                      # DW_TAG_subprogram
>         .byte   0                       # DW_CHILDREN_no
>         .byte   3                       # DW_AT_name
>         .byte   14                      # DW_FORM_strp
>         .byte   58                      # DW_AT_decl_file
>         .byte   11                      # DW_FORM_data1
>         .byte   59                      # DW_AT_decl_line
>         .byte   11                      # DW_FORM_data1
>         .byte   39                      # DW_AT_prototyped
>         .byte   12                      # DW_FORM_flag
>         .byte   73                      # DW_AT_type
>         .byte   19                      # DW_FORM_ref4
>         .byte   63                      # DW_AT_external
>         .byte   12                      # DW_FORM_flag
>         .byte   17                      # DW_AT_low_pc
>         .byte   1                       # DW_FORM_addr
>         .byte   18                      # DW_AT_high_pc
>         .byte   1                       # DW_FORM_addr
>         .byte   64                      # DW_AT_frame_base
>         .byte   10                      # DW_FORM_block1
>         .byte   0                       # EOM(1)
>         .byte   0                       # EOM(2)
>         .byte   3                       # Abbreviation Code
>         .byte   36                      # DW_TAG_base_type
>         .byte   0                       # DW_CHILDREN_no
>         .byte   3                       # DW_AT_name
>         .byte   14                      # DW_FORM_strp
>         .byte   62                      # DW_AT_encoding
>         .byte   11                      # DW_FORM_data1
>         .byte   11                      # DW_AT_byte_size
>         .byte   11                      # DW_FORM_data1
>         .byte   0                       # EOM(1)
>         .byte   0                       # EOM(2)
>         .byte   0                       # EOM(3)
> .L.debug_abbrev_end:
>
> -Dimitry
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140103/9687442c/attachment.html>


More information about the llvm-commits mailing list