[PATCH] D94882: [MC] Upgrade DWARF version to 5 upon .file 0

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 12:18:25 PST 2021


MaskRay added a comment.

In D94882#2507660 <https://reviews.llvm.org/D94882#2507660>, @dblaikie wrote:

> A few thoughts:
>
> 1. If gnu-as already has accepted such a patch, we probably want to do the same just for compatibility

Agree.

> 2. it doesn't seem like adding a directive sooner (especially if it risks diverging from gnu-as if they add one in the future - they don't tend to be terribly interested in compatibility with clang from my experience) significantly reduces work here, especially if we're doing (1) - add the directive when it becomes necessary if file 0 becomes invalid in DWARFv6 or something (though I don't expect it to any time soon) or more likely if a new line table format arises with significant benefits/incompatibilities with the v5 line table format

Agree that a directive may not be sooner. If the line table format is going to be changed, the directive can probably be deferred to that time.

> 3. I'd be pretty happy with clang -gdwarfN and llvm-mc -dwarf-version doing the same thing & ignoring the specified format if the input contains dwarf of a different version - not too fussed in any direction for llvm-mc though.

I just checked latest binutils after https://sourceware.org/bugzilla/show_bug.cgi?id=27195

`gas/as-new a.s -gdwarf-3 -o a.o` happily upgrades to DWARF v5 upon `.file 0` (https://sourceware.org/pipermail/binutils/2021-January/114981.html was not adopted). Therefore this patch will match the behavior entirely, although I slightly dislike that explicit `-gdwarf-N` is not respected (as I said in the description).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94882/new/

https://reviews.llvm.org/D94882



More information about the llvm-commits mailing list