This is an archive of the discontinued LLVM Phabricator instance.

[PATCH] [DWARF] Kotlin language
AcceptedPublic

Authored by vvlevchenko on Jun 6 2018, 1:23 AM.

Details

Summary

Patch adds a DWARF language tag for Kotlin.
The language is intended to be added to the next version of the standard.
See http://www.dwarfstd.org/ShowIssue.php?issue=170503.1
For a moment language tag is placed in LLVM language extensions region.

Diff Detail

Event Timeline

vvlevchenko created this revision.Jun 6 2018, 1:23 AM

Please be warned that until the constant made it into an actual DWARF specification the numerical value could still change so you probably should be careful about shipping software depending on this value to end-users.

include/llvm/BinaryFormat/Dwarf.def
670

I think this should be "6", not "5"?

It would be nice to also add a testcase that compiles an otherwise empty llvm IR file with a DICompileUnit with Kotlin as the implementation language and pipes the output to llvm-dwarfdump and verifies that it comes out correctly.

include/llvm/BinaryFormat/Dwarf.def
670

Could you please also add a
// Tentative DWARF v.6 definitions.
comment above to drive home the point that these are subject to change?

thanks!

JDevlieghere accepted this revision.Jul 16 2018, 8:10 AM

LGTM with Adrian's comment addressed.

include/llvm/BinaryFormat/Dwarf.def
670

I think Adrian meant DWARF v6 without the dot as we currently stylize DWARF v5.

This revision is now accepted and ready to land.Jul 16 2018, 8:10 AM
vvlevchenko marked an inline comment as done.
vvlevchenko marked an inline comment as done.Oct 17 2018, 4:41 AM
probinson requested changes to this revision.Oct 19 2018, 12:04 PM
probinson added a subscriber: probinson.

It would be safer if we came up with an LLVM extension range for language constants (assuming the DWARF committee doesn't change the process for assigning language constants). It will be years before DWARF v6 comes out and there is a very reasonable chance that the numbers won't match.
I'd rather we don't ship any LLVM that could emit an incorrect language code.

This revision now requires changes to proceed.Oct 19 2018, 12:04 PM

+echristo re defining an LLVM range of language codes.

It would be safer if we came up with an LLVM extension range for language constants (assuming the DWARF committee doesn't change the process for assigning language constants). It will be years before DWARF v6 comes out and there is a very reasonable chance that the numbers won't match.
I'd rather we don't ship any LLVM that could emit an incorrect language code.

Just for my understanding. You suggest to put Kotlin under vendor extension? with id in range DW_LANG_lo_user ... DW_LANG_hi_user. If so who will choose the number? and what supposed to be the last two parameters HANDLE_DW_LANG(..., Kotlin, ) in this case?

Here's an incomplete list of extensions that haven't all been added to LLVM yet: https://sourceware.org/elfutils/DwarfExtensions

patches welcome, btw. :-)

Here's an incomplete list of extensions that haven't all been added to LLVM yet: https://sourceware.org/elfutils/DwarfExtensions

Hm..., now I'm even more confused :)
If there's any list of actions should be done to land this or appropriate change? I'd very appreciate any suggestion or clarification.

I think a patch that adds the missing constants to Dwarf.def would be sufficient. This is mostly for documentation purposes to avoid accidentally re-use ranges used by other compilers.

It's possible that libdwarf (http://wiki.dwarfstd.org/index.php?title=Libdwarf_And_Dwarfdump) also defines additional extensions.

I think a patch that adds the missing constants to Dwarf.def would be sufficient. This is mostly for documentation purposes to avoid accidentally re-use ranges used by other compilers.

Could you please elaborate more? I still doesn't understand which constants are missed and how I can get them. Actually I have got only one assigned by dwarfstd http://www.dwarfstd.org/ShowIssue.php?issue=170503.1.

It's possible that libdwarf (http://wiki.dwarfstd.org/index.php?title=Libdwarf_And_Dwarfdump) also defines additional extensions.

I think a patch that adds the missing constants to Dwarf.def would be sufficient. This is mostly for documentation purposes to avoid accidentally re-use ranges used by other compilers.

Could you please elaborate more? I still doesn't understand which constants are missed and how I can get them. Actually I have got only one assigned by dwarfstd http://www.dwarfstd.org/ShowIssue.php?issue=170503.1.

It's possible that libdwarf (http://wiki.dwarfstd.org/index.php?title=Libdwarf_And_Dwarfdump) also defines additional extensions.

Note that is is only tangentially related to your patch.

Paul was asking that instead of using the tentative DWARF 6 definition, you'd allocate an LLVM vendor extension somewhere between DW_LANG_lo_user and DW_LANG_hi_user. From there we discussed how to make a safe choice, which prompted me to point out that the list of vendor extensions in LLVM isn't complete and that there are a couple of other sources to consult before picking a spare number. And I said it would be nice (but not necessary!) to submit a patch that adds other known vendor extensions to LLVM's Dwarf.def so this gets easier next time.

I think a patch that adds the missing constants to Dwarf.def would be sufficient. This is mostly for documentation purposes to avoid accidentally re-use ranges used by other compilers.

Could you please elaborate more? I still doesn't understand which constants are missed and how I can get them. Actually I have got only one assigned by dwarfstd http://www.dwarfstd.org/ShowIssue.php?issue=170503.1.

It's possible that libdwarf (http://wiki.dwarfstd.org/index.php?title=Libdwarf_And_Dwarfdump) also defines additional extensions.

Note that is is only tangentially related to your patch.

Paul was asking that instead of using the tentative DWARF 6 definition, you'd allocate an LLVM vendor extension somewhere between DW_LANG_lo_user and DW_LANG_hi_user. From there we discussed how to make a safe choice, which prompted me to point out that the list of vendor extensions in LLVM isn't complete and that there are a couple of other sources to consult before picking a spare number. And I said it would be nice (but not necessary!) to submit a patch that adds other known vendor extensions to LLVM's Dwarf.def so this gets easier next time.

Thank you, for clarification.

I've put a note out to the DWARF committee to see if we can streamline the assignment of language codes. As long as there is a source of truth for these, we shouldn't have to wait for DWARF 6 to be published.
The idea has come up before, and now with a motivating case I think it's likely to happen. So if you could hold off a little longer (probably a few days) I can have an answer for you on that point.

vvlevchenko edited the summary of this revision. (Show Details)

I've put a note out to the DWARF committee to see if we can streamline the assignment of language codes. As long as there is a source of truth for these, we shouldn't have to wait for DWARF 6 to be published.
The idea has come up before, and now with a motivating case I think it's likely to happen. So if you could hold off a little longer (probably a few days) I can have an answer for you on that point.

Ok I'll wait as long as required, for now I've updated diff regarding my understanding of our yesterday conversation. Thank you for cooperation.

probinson accepted this revision.Oct 24 2018, 11:06 AM

I've put a note out to the DWARF committee to see if we can streamline the assignment of language codes. As long as there is a source of truth for these, we shouldn't have to wait for DWARF 6 to be published.
The idea has come up before, and now with a motivating case I think it's likely to happen. So if you could hold off a little longer (probably a few days) I can have an answer for you on that point.

Ok I'll wait as long as required, for now I've updated diff regarding my understanding of our yesterday conversation. Thank you for cooperation.

Out of all the current requests to the DWARF committee for a new language code, Kotlin is the only one to request a particular number, so there's a very high probability that you will actually get the requested number.
That said, the DWARF committee does not currently have a process for guaranteeing a language code, and it may be a little while (more than days, less than years) before that's in place.
Therefore, the current state of the patch LGTM, and sorry the DWARF committee can't be more responsive at this time.

This revision is now accepted and ready to land.Oct 24 2018, 11:06 AM

I've put a note out to the DWARF committee to see if we can streamline the assignment of language codes. As long as there is a source of truth for these, we shouldn't have to wait for DWARF 6 to be published.
The idea has come up before, and now with a motivating case I think it's likely to happen. So if you could hold off a little longer (probably a few days) I can have an answer for you on that point.

Ok I'll wait as long as required, for now I've updated diff regarding my understanding of our yesterday conversation. Thank you for cooperation.

Out of all the current requests to the DWARF committee for a new language code, Kotlin is the only one to request a particular number, so there's a very high probability that you will actually get the requested number.
That said, the DWARF committee does not currently have a process for guaranteeing a language code, and it may be a little while (more than days, less than years) before that's in place.
Therefore, the current state of the patch LGTM, and sorry the DWARF committee can't be more responsive at this time.

LGTM as well. I'll... try to poke the committee here.