From 70506c5fdda82aea11745e545bdd9dc28cd9c211 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Thu, 13 Mar 2014 23:26:25 +0000 Subject: [PATCH] Use DW_AT_linkage_name when we're emitting DWARF4 or above. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203867 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 3 +- .../DebugInfo/X86/debug-info-static-member.ll | 34 +++++++++---------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index c743cbbb45d..c91f5fd361c 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1651,7 +1651,8 @@ void DwarfCompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) { // TAG_variable. addString(IsStaticMember && VariableSpecDIE ? VariableSpecDIE : VariableDIE, - dwarf::DW_AT_MIPS_linkage_name, + DD->getDwarfVersion() >= 4 ? dwarf::DW_AT_linkage_name + : dwarf::DW_AT_MIPS_linkage_name, GlobalValue::getRealLinkageName(LinkageName)); } else if (const ConstantInt *CI = dyn_cast_or_null(GV.getConstant())) { diff --git a/test/DebugInfo/X86/debug-info-static-member.ll b/test/DebugInfo/X86/debug-info-static-member.ll index adf8ff09b6d..f15f2c14f22 100644 --- a/test/DebugInfo/X86/debug-info-static-member.ll +++ b/test/DebugInfo/X86/debug-info-static-member.ll @@ -1,7 +1,7 @@ -; RUN: llc %s -o %t -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu +; RUN: llc %s -o %t -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu -dwarf-version=4 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s -check-prefix=PRESENT ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s -check-prefix=ABSENT -; RUN: llc %s -o %t -filetype=obj -O0 -mtriple=x86_64-apple-darwin +; RUN: llc %s -o %t -filetype=obj -O0 -mtriple=x86_64-apple-darwin -dwarf-version=4 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s -check-prefix=DARWINP ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s -check-prefix=DARWINA ; Verify that attributes we do want are PRESENT; @@ -133,15 +133,15 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone ; PRESENT: DW_TAG_variable ; PRESENT-NEXT: DW_AT_specification {{.*}} {0x[[DECL_A]]} ; PRESENT-NEXT: DW_AT_location -; PRESENT-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1aE" +; PRESENT-NEXT: DW_AT_linkage_name {{.*}} "_ZN1C1aE" ; PRESENT: DW_TAG_variable ; PRESENT-NEXT: DW_AT_specification {{.*}} {0x[[DECL_B]]} ; PRESENT-NEXT: DW_AT_location -; PRESENT-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1bE" +; PRESENT-NEXT: DW_AT_linkage_name {{.*}} "_ZN1C1bE" ; PRESENT: DW_TAG_variable ; PRESENT-NEXT: DW_AT_specification {{.*}} {0x[[DECL_C]]} ; PRESENT-NEXT: DW_AT_location -; PRESENT-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1cE" +; PRESENT-NEXT: DW_AT_linkage_name {{.*}} "_ZN1C1cE" ; For Darwin gdb: ; DARWINP: .debug_info contents: @@ -183,19 +183,19 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone ; DARWINP: DW_TAG_variable ; DARWINP-NEXT: DW_AT_specification {{.*}} {0x[[DECL_A]]} ; DARWINP-NEXT: DW_AT_location -; DARWINP-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1aE" +; DARWINP-NEXT: DW_AT_linkage_name {{.*}} "_ZN1C1aE" ; DARWINP: DW_TAG_variable ; DARWINP-NEXT: DW_AT_specification {{.*}} {0x[[DECL_B]]} ; DARWINP-NEXT: DW_AT_location -; DARWINP-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1bE" +; DARWINP-NEXT: DW_AT_linkage_name {{.*}} "_ZN1C1bE" ; DARWINP: DW_TAG_variable ; DARWINP-NEXT: DW_AT_specification {{.*}} {0x[[DECL_C]]} ; DARWINP-NEXT: DW_AT_location -; DARWINP-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1C1cE" +; DARWINP-NEXT: DW_AT_linkage_name {{.*}} "_ZN1C1cE" ; ABSENT verifies that static member declarations do not have either ; DW_AT_location or DW_AT_data_member_location; also, variables do not -; have DW_AT_const_value and constants do not have DW_AT_MIPS_linkage_name. +; have DW_AT_const_value and constants do not have DW_AT_linkage_name. ; ; ABSENT: .debug_info contents: ; ABSENT: DW_TAG_member @@ -203,24 +203,24 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone ; ABSENT-NOT: DW_AT_const_value ; ABSENT-NOT: location ; ABSENT: DW_AT_name {{.*}} "const_a" -; ABSENT-NOT: DW_AT_MIPS_linkage_name +; ABSENT-NOT: DW_AT_linkage_name ; ABSENT-NOT: location ; ABSENT: DW_AT_name {{.*}} "b" ; ABSENT-NOT: DW_AT_const_value ; ABSENT-NOT: location ; ABSENT: DW_AT_name {{.*}} "const_b" -; ABSENT-NOT: DW_AT_MIPS_linkage_name +; ABSENT-NOT: DW_AT_linkage_name ; ABSENT-NOT: location ; ABSENT: DW_AT_name {{.*}} "c" ; ABSENT-NOT: DW_AT_const_value ; ABSENT-NOT: location ; ABSENT: DW_AT_name {{.*}} "const_c" -; ABSENT-NOT: DW_AT_MIPS_linkage_name +; ABSENT-NOT: DW_AT_linkage_name ; ABSENT-NOT: location ; While we're here, a normal member does not have a linkage name, constant ; value, or DW_AT_location. ; ABSENT: DW_AT_name {{.*}} "d" -; ABSENT-NOT: DW_AT_MIPS_linkage_name +; ABSENT-NOT: DW_AT_linkage_name ; ABSENT-NOT: DW_AT_const_value ; ABSENT-NOT: DW_AT_location ; ABSENT: NULL @@ -232,24 +232,24 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone ; DARWINA-NOT: DW_AT_const_value ; DARWINA-NOT: location ; DARWINA: DW_AT_name {{.*}} "const_a" -; DARWINA-NOT: DW_AT_MIPS_linkage_name +; DARWINA-NOT: DW_AT_linkage_name ; DARWINA-NOT: location ; DARWINA: DW_AT_name {{.*}} "b" ; DARWINA-NOT: DW_AT_const_value ; DARWINA-NOT: location ; DARWINA: DW_AT_name {{.*}} "const_b" -; DARWINA-NOT: DW_AT_MIPS_linkage_name +; DARWINA-NOT: DW_AT_linkage_name ; DARWINA-NOT: location ; DARWINA: DW_AT_name {{.*}} "c" ; DARWINA-NOT: DW_AT_const_value ; DARWINA-NOT: location ; DARWINA: DW_AT_name {{.*}} "const_c" -; DARWINA-NOT: DW_AT_MIPS_linkage_name +; DARWINA-NOT: DW_AT_linkage_name ; DARWINA-NOT: location ; While we're here, a normal member does not have a linkage name, constant ; value, or DW_AT_location. ; DARWINA: DW_AT_name {{.*}} "d" -; DARWINA-NOT: DW_AT_MIPS_linkage_name +; DARWINA-NOT: DW_AT_linkage_name ; DARWINA-NOT: DW_AT_const_value ; DARWINA-NOT: DW_AT_location ; DARWINA: NULL -- 2.34.1