From: Rob Pike Date: Fri, 11 Jul 2014 15:16:00 +0000 (+0000) Subject: ld: change DWARF output for structs X-Git-Tag: go1.4beta1~1111 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=125d1e9269572135d078ee128b239280c7101e6c;p=gostls13.git ld: change DWARF output for structs The debug/dwarf package cannot parse the format generated here, but the format can be changed so it does. After this edit, tweaking the expression defining the offset of a struct field, the dwarf package can parse the tables (again?). LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/105710043 --- diff --git a/src/cmd/ld/dwarf.c b/src/cmd/ld/dwarf.c index a9f9329932..90c6725bc7 100644 --- a/src/cmd/ld/dwarf.c +++ b/src/cmd/ld/dwarf.c @@ -835,11 +835,8 @@ newmemberoffsetattr(DWDie *die, int32 offs) int i; i = 0; - if (offs != 0) { - block[i++] = DW_OP_consts; - i += sleb128enc(offs, block+i); - block[i++] = DW_OP_plus; - } + block[i++] = DW_OP_plus_uconst; + i += uleb128enc(offs, block+i); newattr(die, DW_AT_data_member_location, DW_CLS_BLOCK, i, mal(i)); memmove(die->attr->data, block, i); }