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

Dimitry Andric dimitry at andric.com
Fri Jan 3 08:25:51 PST 2014


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 --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140103/89be7714/attachment.sig>


More information about the llvm-commits mailing list