From 111a0a8305b31c4e3b1b714272316d49f32e0310 Mon Sep 17 00:00:00 2001 From: Frederic Riss Date: Fri, 13 Mar 2015 18:35:39 +0000 Subject: [PATCH] [dsymutil] Fix location cloning for newer dwarf versions. The typo got unnoticed because we were testing only on Dwarf 2. Add a Dwarf4 test that exercises the code path, and also tests some newer FORMs that the other test doesn't cover. llvm-svn: 232191 --- .../dsymutil/Inputs/basic-lto-dw4.macho.x86_64 | Bin 0 -> 8920 bytes .../dsymutil/Inputs/basic-lto-dw4.macho.x86_64.o | Bin 0 -> 3800 bytes .../dsymutil/X86/basic-lto-dw4-linking-x86.test | 94 +++++++++++++++++++++ llvm/tools/dsymutil/DwarfLinker.cpp | 2 +- 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100755 llvm/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64 create mode 100644 llvm/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64.o create mode 100644 llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test diff --git a/llvm/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64 b/llvm/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64 new file mode 100755 index 0000000000000000000000000000000000000000..7e7ba2f48f865e3d75364d78faf46ec1a8b312b7 GIT binary patch literal 8920 zcmeHNOGs5g7@p&!L`_{7^g?f8Vwv|EnivFKLrF=@QXwLl&VAvH`w;KBz9>+7kVsHa z5EMaMS1k%!6bLSCSIbuI0ypi$g}3jUdyaRmNJYz-AO17*{jZt%&TQt)`MmjKYp)Pi zsSpb#LWnx(7l8Z1hn^4zq5V)PhkGveUGKYknbu;lis7z^bvB?;nvaakdpU_pmcW>YiqR7A#8u{0bz=l9mFM-C{& z-dysQ;%8x3gfn!DyJ?2EyHp-X+e1KvCJ?N}!;<*Qqa?^CaJ4EwHKMf~C66M}Ipa{xLE zd>CyD3cNvE1s#S`=%+IF5L6!z@UNr>Q9fujG?2|q1rqU4ATpPT08=M3ept ze#|2t%4avD;dt#nA^7f2xVRgb(h8-YIEdDWVZbn87%&VN1`Gp+0mFb{z%cOd42<fp!!X@J$NDtB7OQQ% zhpv}@3%$F!*4vf2)ur-rfbli!=hFJdt6VOJE(}MY6usqnhv$k;wA6R*8H0VEEvs>! zs4JX?)Uk-?6C;KJ!+>GHFkl!k3>XFs1BL;^fMLKeU>GnA{O1f<68GyRGC3imv(a$Y ziOPwn9f?kfqe(lS636*bp;W9kxHPOb)CJky{8r6t`EyY99RY1UY-o7Jscd`DGP_E< zx&&08B9tRS>GcIEWt)?|%O*aFd4VZ-T13SG2@Kc<7k8ed@%hE5Myr=5*2Z&O?A2ccuC?;)aF}Nb7x;Yv3_D#)d?GNA zn#?+xfC$-{c=)tGylqj2wuF;zi_CQTlXiF_?Vs)Ll3kttw2*2W$ygfQkUb^jw4GpY pUdYL*__U1;7f(4t3s624RTQwx7R}e@t-Q=Q*^mt3M-J><$}hQL(slp< literal 0 HcmV?d00001 diff --git a/llvm/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64.o b/llvm/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64.o new file mode 100644 index 0000000000000000000000000000000000000000..307a681309207adc3ea021758ef88d6852bf8059 GIT binary patch literal 3800 zcmb7G-)~e!6rS0;_inq}?rwK0rD*LM3L2ryFA*b&v;mO{iItX86PwF+yDbat?q+ve zkbn{)NP5q&TbHKBgr+?np}wjiA3%$alM zoNvyY`ElyBlr8KV(@Pw!xFO*c3u^`Ij}pf%UDNN+BG4*)Q>5bj2*ZV`G?$ktG{W7J}WX>&QrU2@B3~GD-2;348N~JZIHHa30*`M>D(Xpe>+;JTb;rxt4KKiTm%axjjc4wMXj;Tk z0f0a1MVfehKk@~ISYJQ&7{T?X4w?fV>8U&9$9;>_A?$4&lV1()hd)#M2=XyVmaQL5 zVoAw7;yQiw?vD=boBdgx!IAk`Cn`++5)j7~0z45pEwMkwd znIDgJp69SH{@lWb)8U0{vkGivUf!DZ07vE@hhKIQ7cDiDD_8QxLTX!jM|yKgjAknN z?3Q#^Z0akNrmGdtuoZ^s!gM7!=DorBLKOq2M5&yg$y9T$rz3J39A`3=nbkqK;9APr-}=~-<>pN{N|JlftD-vuno76EPQ!+{9;)Fie$Ci)%<(-!7PLi*f3UbE1R~5u-^W9%}ROT5GOE6nrJUihJLdCZP@-tPktT zQUJ7ev8l+Rm)WlQ5Upil)6OiaK{@!kQjVY%c8<+4G!DNQp*Pu+;$w)V)2@eQ517*; zX+=BGHf%z(9W0&DP6#{LxXW0qM$7yGH10OWV54O|C`D+B%z zIh3bOIVIMit8!9ml7%73glL_n3^88kqJN#BGhI@fCziGQ2734L*->7)6A+zfrTjPAj8<~ZU|IVd!GI@~bysAyOFJCiZ(GiA z;5Z@e!&zq22A~|gtQaDXmQ5vaM~HL+iuuh&hvKXPqvi~Yyv7Pc~?|^?lh{Y zx)oz)d+pG1J3L^^i*};h4m)XEI@5swFoh_1A>9mx+A*XhFGmpilUibKIT3@B*uW&-w`5uzv*C2u8T!y55gO+@@sP|}@(h@@1 zztXa#CG(^IYRD)$rmoC4iiylihmWNiHx=SJ;<$O35h|ic$h_WMXN*QeE`K##|Gx$- QW#RJQ!c~77F8?|H14odGi2wiq literal 0 HcmV?d00001 diff --git a/llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test b/llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test new file mode 100644 index 0000000..5f85952 --- /dev/null +++ b/llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test @@ -0,0 +1,94 @@ +RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-lto-dw4.macho.x86_64 | llvm-dwarfdump - | FileCheck %s + +CHECK: file format Mach-O 64-bit x86-64 + +CHECK: debug_info contents + +CHECK: Compile Unit: {{.*}} version = 0x0004 + +CHECK: DW_TAG_compile_unit [1] * +CHECK: DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000001] = "clang version 3.7.0 ") +CHECK: DW_AT_language [DW_FORM_data2] (DW_LANG_C99) +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000016] = "basic1.c") +CHECK: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x0000001f] = "/Inputs") +CHECK: DW_TAG_subprogram [2] * +CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f40) +CHECK: DW_AT_high_pc [DW_FORM_data4] (0x0000000b) +CHECK: DW_AT_frame_base [DW_FORM_exprloc] (<0x1> 56 ) +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000027] = "main") +CHECK: DW_AT_prototyped [DW_FORM_flag_present] (true) +CHECK: DW_AT_external [DW_FORM_flag_present] (true) +CHECK: DW_TAG_formal_parameter [3] +CHECK: DW_AT_location [DW_FORM_exprloc] (<0x3> 55 93 04 ) +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000002c] = "argc") +CHECK: DW_TAG_formal_parameter [4] +CHECK: DW_AT_location [DW_FORM_exprloc] (<0x1> 54 ) +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000031] = "argv") +CHECK: NULL +CHECK: DW_TAG_pointer_type [5] +CHECK: DW_TAG_pointer_type [5] +CHECK: DW_TAG_const_type [6] +CHECK: DW_TAG_base_type [7] +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000036] = "char") +CHECK: DW_AT_encoding [DW_FORM_data1] (DW_ATE_signed_char) +CHECK: DW_AT_byte_size [DW_FORM_data1] (0x01) +CHECK: NULL + +CHECK: Compile Unit:{{.*}} version = 0x0004 + +CHECK: DW_TAG_compile_unit [1] * +CHECK: DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000001] = "clang version 3.7.0 ") +CHECK: DW_AT_language [DW_FORM_data2] (DW_LANG_C99) +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000003b] = "basic2.c") +CHECK: DW_TAG_base_type [7] +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000044] = "int") +CHECK: DW_TAG_variable [8] +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000048] = "baz") +CHECK: DW_AT_location [DW_FORM_exprloc] (<0x9> 03 00 10 00 00 01 00 00 00 ) +CHECK: DW_TAG_variable [8] +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000004c] = "private_int") +CHECK: DW_AT_location [DW_FORM_exprloc] (<0x9> 03 08 10 00 00 01 00 00 00 ) +CHECK: DW_TAG_subprogram [9] +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000058] = "inc") +CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x002a => {0x000000a1}) +CHECK: DW_AT_inline [DW_FORM_data1] (DW_INL_inlined) +CHECK: DW_TAG_subprogram [10] * +CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f50) +CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000037) +CHECK: DW_AT_frame_base [DW_FORM_exprloc] (<0x1> 56 ) +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000005c] = "foo") +CHECK: DW_AT_prototyped [DW_FORM_flag_present] (true) +CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x002a => {0x000000a1}) +CHECK: DW_TAG_formal_parameter [11] +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "arg") +CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x002a => {0x000000a1}) +CHECK: DW_TAG_inlined_subroutine [12] +CHECK: DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x005b => {0x000000d2} "inc") +CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f61) +CHECK: DW_AT_high_pc [DW_FORM_data4] (0x0000000f) +CHECK: NULL +CHECK: NULL + +CHECK: Compile Unit: {{.*}} version = 0x0004 + +CHECK: DW_TAG_compile_unit [1] * +CHECK: DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000001] = "clang version 3.7.0 ") +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000064] = "basic3.c") +CHECK: DW_TAG_variable [13] +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000006d] = "val") +CHECK: DW_AT_location [DW_FORM_exprloc] (<0x9> 03 04 10 00 00 01 00 00 00 ) +CHECK: DW_TAG_volatile_type [14] +CHECK: DW_TAG_subprogram [15] +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000058] = "inc") +CHECK: DW_AT_inline [DW_FORM_data1] (DW_INL_inlined) +CHECK: DW_TAG_subprogram [2] * +CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f90) +CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000024) +CHECK: DW_AT_frame_base [DW_FORM_exprloc] (<0x1> 56 ) +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000071] = "bar") +CHECK: DW_TAG_formal_parameter [16] +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "arg") +CHECK: DW_TAG_inlined_subroutine [17] +CHECK: DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x0044 => {0x0000015f} "inc") +CHECK: NULL +CHECK: NULL diff --git a/llvm/tools/dsymutil/DwarfLinker.cpp b/llvm/tools/dsymutil/DwarfLinker.cpp index 4e3dc52..f71a01d 100644 --- a/llvm/tools/dsymutil/DwarfLinker.cpp +++ b/llvm/tools/dsymutil/DwarfLinker.cpp @@ -1225,7 +1225,7 @@ unsigned DwarfLinker::cloneBlockAttribute(DIE &Die, AttributeSpec AttrSpec, DIELoc *Loc = nullptr; DIEBlock *Block = nullptr; // Just copy the block data over. - if (AttrSpec.Attr == dwarf::DW_FORM_exprloc) { + if (AttrSpec.Form == dwarf::DW_FORM_exprloc) { Loc = new (DIEAlloc) DIELoc(); DIELocs.push_back(Loc); } else { -- 2.7.4