[llvm] r339288 - [DWARF] Unclamp line table version on Darwin for v5 and later.

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 8 14:16:51 PDT 2018


Author: jdevlieghere
Date: Wed Aug  8 14:16:50 2018
New Revision: 339288

URL: http://llvm.org/viewvc/llvm-project?rev=339288&view=rev
Log:
[DWARF] Unclamp line table version on Darwin for v5 and later.

On Darwin we pin the DWARF line tables to version 2. Stop doing so for
DWARF v5 and later.

Differential revision: https://reviews.llvm.org/D49381

Modified:
    llvm/trunk/lib/MC/MCDwarf.cpp
    llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll
    llvm/trunk/test/CodeGen/Generic/dwarf-source.ll
    llvm/trunk/test/MC/ELF/dwarf-file0.s
    llvm/trunk/test/MC/ELF/dwarf-loc0.s

Modified: llvm/trunk/lib/MC/MCDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=339288&r1=339287&r2=339288&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)
+++ llvm/trunk/lib/MC/MCDwarf.cpp Wed Aug  8 14:16:50 2018
@@ -462,11 +462,14 @@ MCDwarfLineTableHeader::Emit(MCStreamer
   emitAbsValue(*MCOS,
                MakeStartMinusEndExpr(*MCOS, *LineStartSym, *LineEndSym, 4), 4);
 
-  // Next 2 bytes is the Version.
-  // FIXME: On Darwin we still default to V2.
   unsigned LineTableVersion = context.getDwarfVersion();
-  if (context.getObjectFileInfo()->getTargetTriple().isOSDarwin())
+
+  // On Darwin we default to v2 for anything before DWARF v5.
+  if (context.getObjectFileInfo()->getTargetTriple().isOSDarwin() &&
+      LineTableVersion < 5)
     LineTableVersion = 2;
+
+  // Next 2 bytes is the Version.
   MCOS->EmitIntValue(LineTableVersion, 2);
 
   // Keep track of the bytes between the very start and where the header length

Modified: llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll?rev=339288&r1=339287&r2=339288&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll (original)
+++ llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll Wed Aug  8 14:16:50 2018
@@ -1,8 +1,8 @@
 ; MD5 checksums provided by IR should be passed through to asm.
 ; They'll be emitted to an object file only for DWARF 5 or later.
-
-; Darwin clamps the line table at DWARF v2 so XFAIL this test.
-; XFAIL: darwin
+;
+; Note that on Darwin for DWARF 4 or earlier, the line table version is clamped
+; to version 2. However that doesn't affect the output checked in this test.
 
 ; REQUIRES: object-emission
 ; RUN: %llc_dwarf -dwarf-version 4 -filetype=asm -o - %s | FileCheck %s --check-prefix=ASM-4

Modified: llvm/trunk/test/CodeGen/Generic/dwarf-source.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/dwarf-source.ll?rev=339288&r1=339287&r2=339288&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/dwarf-source.ll (original)
+++ llvm/trunk/test/CodeGen/Generic/dwarf-source.ll Wed Aug  8 14:16:50 2018
@@ -1,8 +1,8 @@
 ; Source text provided by IR should be passed through to asm.
 ; It is emitted to an object file only for DWARF 5 or later.
-
-; Darwin clamps the line table at DWARF v2 so XFAIL this test.
-; XFAIL: darwin
+;
+; Note that on Darwin for DWARF 4 or earlier, the line table version is clamped
+; to version 2. However that doesn't affect the output checked in this test.
 
 ; REQUIRES: object-emission
 ; RUN: %llc_dwarf -dwarf-version 4 -filetype=asm -o - %s | FileCheck %s --check-prefix=ASM-4

Modified: llvm/trunk/test/MC/ELF/dwarf-file0.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/dwarf-file0.s?rev=339288&r1=339287&r2=339288&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/dwarf-file0.s (original)
+++ llvm/trunk/test/MC/ELF/dwarf-file0.s Wed Aug  8 14:16:50 2018
@@ -4,8 +4,6 @@
 # RUN: llvm-mc -dwarf-version 4 %s -filetype=asm -o - 2>&1 | FileCheck %s --check-prefix=WARN
 # RUN: llvm-mc -dwarf-version 5 %s -filetype=obj -o - | llvm-dwarfdump -debug-line - | FileCheck %s --check-prefixes=CHECK,CHECK-5
 # RUN: llvm-mc -dwarf-version 5 %s -filetype=asm -o - | FileCheck %s --check-prefixes=ASM,ASM-5
-# Darwin is stuck on DWARF v2.
-# XFAIL: darwin
         .file 0 "/test" "root.cpp"
         .file 1 "/include" "header.h"
         .file 2 "/test" "root.cpp"

Modified: llvm/trunk/test/MC/ELF/dwarf-loc0.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/dwarf-loc0.s?rev=339288&r1=339287&r2=339288&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/dwarf-loc0.s (original)
+++ llvm/trunk/test/MC/ELF/dwarf-loc0.s Wed Aug  8 14:16:50 2018
@@ -1,8 +1,6 @@
 # REQUIRES: default_triple
 # RUN: llvm-mc -dwarf-version 5 %s -filetype=obj -o - | llvm-dwarfdump -debug-line - | FileCheck %s
 # RUN: not llvm-mc -dwarf-version 4 %s -filetype=asm -o - 2>&1 | FileCheck %s -check-prefix=ERR
-# Darwin line table is stuck on DWARF v2.
-# XFAIL: darwin
 # Show that ".loc 0" works in DWARF v5, gets an error for earlier versions.
         .file 0 "root.cpp"
         .file 1 "header.h"




More information about the llvm-commits mailing list