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

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 12:20:19 PST 2021


dblaikie added a comment.

In D94882#2527402 <https://reviews.llvm.org/D94882#2527402>, @jhenderson wrote:

> In D94882#2525883 <https://reviews.llvm.org/D94882#2525883>, @MaskRay wrote:
>
>> The default DWARF version is decided by clang driver. Different toolchains have different defaults. The version option does not require `-g`.
>>
>>   clang -target x86_64-linux -c a.s '-###' # "-dwarf-version=4"
>>   clang -target x86_64-freebsd12 -c a.s '-###' # "-dwarf-version=2"
>>
>> If we want a diagnostic, we will need additional information whether `-dwarf-version` is implicitly or explicitly specified. GNU as currently does not have a diagnostic.
>> I have put reason why I think the diagnostic is not very useful in my initial summary.
>
> Got it now, thanks. I don't have a strong feeling about whether a new option to enable this diagnostic is a good idea or not. If it existed, I'd expect to be something like --warn-for-mismatching-dwarf-version or something to that effect, and is specified automatically if the user explicitly specifies the DWARF version themselvse. I don't think whether GNU as produces a diagnostic or not is really relevant. I think I'd like someone else with more frontend experience to chime in at this point.

The issue isn't so much needing a flag to enable the warning, but needing a flag to pass down/differentiate explicit versus implicitly specified version number (currently we don't have that differentiation in the backend - so MCStreamer couldn't figure out whether to warn or not). But, yes, would also then want a flag for it.

I don't think a warning here is necessary - if someone's got a -gdwarf-4 flag specified in their build system but some DWARFv5 in an assembly file, there's nothing much to do but emit the DWARFv5 they have & it's probably fine. Indeed, passing any -g flag when you're assembling a file that already has DWARF in it is not necessary - arguably the flags are irrelevant/ignored/unrelated to the task at hand. (I guess not entirely true because we probably still pick the line table version from within the ones that would be valid given the line directives, using the command line flag)

I wouldn't stand in the way of someone adding a warning - with all the requisite support for plumbing through the needed flags (to support the necessary differentiation between implicit and explicit version and the ability to enable/disable it), but I wouldn't hold up this patch on that/suggest that that work needs to be done in conjunction with this.


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