[PATCH] D130566: [Driver] Default to DWARF 4 on Linux/sparc64

Rainer Orth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 26 06:51:36 PDT 2022


ro created this revision.
ro added reviewers: glaubitz, MaskRay.
ro added a project: clang.
Herald added subscribers: jsji, StephenFan, pengfei, fedor.sergeev, jyknight.
Herald added a project: All.
ro requested review of this revision.

During a build on Debian 11/sparc64, several binaries fail to link with

  /usr/bin/ld: /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x23

`/usr/bin/ld` is `GNU ld (GNU Binutils for Debian) 2.38.50.20220707`.  `0x23 is `DW_FORM_rnglistx` which isn't handled even by GNU binutils master.  Building with `-gdwarf-4` avoids this.

Tested on `sparc64-unknown-linux-gnu`.

For comparison's sake, I've tried a build on Ubuntu 20.04/x86_64 with GNU `ld` 2.38.90, which isn't affected.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130566

Files:
  clang/lib/Driver/ToolChains/Linux.cpp


Index: clang/lib/Driver/ToolChains/Linux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -325,7 +325,7 @@
 }
 
 unsigned Linux::GetDefaultDwarfVersion() const {
-  if (getTriple().isAndroid())
+  if (getTriple().isAndroid() || getTriple().isSPARC())
     return 4;
   return ToolChain::GetDefaultDwarfVersion();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130566.447668.patch
Type: text/x-patch
Size: 426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220726/ded639bf/attachment.bin>


More information about the cfe-commits mailing list