https://dwarfstd.org/languages-v6.html defines the DWARF v6 language
attributes, DW_AT_language_name, DW_AT_language_version and DW_LNAME
constants as usable by pre-DWARF v6 producers and consumers.

Also add new DW_LANG_V and DW_LANG_Algol68 (DWARFv5) language constants.

    * config/known-dwarf.awk: Handle DW_LNAME.
    * libdw/dwarf.h: Add DW_AT_language_name and DW_AT_language_version
    plus all currently defined DW_LNAME constants. Add DW_LANG_V and
    DW_LANG_Algol68.
    * libdw/dwarf_default_lower_bound.c: Add DW_LANG_V and
    DW_LANG_Algol68.

Signed-off-by: Mark Wielaard <m...@klomp.org>
---
 config/known-dwarf.awk            |  2 ++
 libdw/dwarf.h                     | 59 ++++++++++++++++++++++++++++++-
 libdw/dwarf_default_lower_bound.c |  2 ++
 3 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/config/known-dwarf.awk b/config/known-dwarf.awk
index bc9b02dbeeef..65a9bfb61b37 100755
--- a/config/known-dwarf.awk
+++ b/config/known-dwarf.awk
@@ -1,6 +1,7 @@
 #!/bin/gawk -f
 
 ## Copyright (C) 2012, 2015 Red Hat, Inc.
+## Copyright (C) 2025 Mark J. Wielaard <m...@klomp.org>
 ##
 ## This file is part of elfutils.
 ##
@@ -24,6 +25,7 @@ set == "" && $1 ~ /DW_([A-Z_]+)_([^ ]+)/ {
   sub(/^DW_/, "", set);
   sub(/_[^[:upper:]_].*$/, "", set);
   if (set ~ /LANG_.+/) set = "LANG";
+  if (set ~ /LNAME_.+/) set = "LNAME";
 }
 
 $1 ~ /DW([_A-Z]+)_([^ ]+)/ {
diff --git a/libdw/dwarf.h b/libdw/dwarf.h
index 573ffd6925b2..66017c1518dd 100644
--- a/libdw/dwarf.h
+++ b/libdw/dwarf.h
@@ -1,6 +1,6 @@
 /* This file defines standard DWARF types, structures, and macros.
    Copyright (C) 2000-2011, 2014, 2016, 2017, 2018 Red Hat, Inc.
-   Copyright (C) 2024 Mark J. Wielaard <m...@klomp.org>
+   Copyright (C) 2024, 2025 Mark J. Wielaard <m...@klomp.org>
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -295,6 +295,10 @@ enum
     DW_AT_defaulted = 0x8b,
     DW_AT_loclists_base = 0x8c,
 
+    /* https://dwarfstd.org/languages-v6.html  */
+    DW_AT_language_name = 0x90,
+    DW_AT_language_version = 0x91,
+
     DW_AT_lo_user = 0x2000,
 
     DW_AT_MIPS_fde = 0x2001,
@@ -771,6 +775,8 @@ enum
     DW_LANG_Ruby = 0x0040,          /* Ruby */
     DW_LANG_Move = 0x0041,          /* Move */
     DW_LANG_Hylo = 0x0042,          /* Hylo */
+    DW_LANG_V = 0x0043,                     /* V Programming Language */
+    DW_LANG_Algol68 = 0x0044,       /* Algol68 */
 
     DW_LANG_lo_user = 0x8000,
     DW_LANG_Mips_Assembler = 0x8001, /* Assembler */
@@ -780,6 +786,57 @@ enum
 /* Old (typo) '1' != 'I'.  */
 #define DW_LANG_PL1 DW_LANG_PLI
 
+/* https://dwarfstd.org/languages-v6.html  */
+enum
+  {
+    DW_LNAME_Ada = 0x0001,
+    DW_LNAME_BLISS = 0x0002,
+    DW_LNAME_C = 0x0003,
+    DW_LNAME_C_plus_plus = 0x0004,
+    DW_LNAME_Cobol = 0x0005,
+    DW_LNAME_Crystal = 0x0006,
+    DW_LNAME_D = 0x0007,
+    DW_LNAME_Dylan = 0x0008,
+    DW_LNAME_Fortran = 0x0009,
+    DW_LNAME_Go = 0x000a,
+    DW_LNAME_Haskell = 0x000b,
+    DW_LNAME_Java = 0x000c,
+    DW_LNAME_Julia = 0x000d,
+    DW_LNAME_Kotlin = 0x000e,
+    DW_LNAME_Modula2 = 0x000f,
+    DW_LNAME_Modula3 = 0x0010,
+    DW_LNAME_ObjC = 0x0011,
+    DW_LNAME_ObjC_plus_plus = 0x0012,
+    DW_LNAME_OCaml = 0x0013,
+    DW_LNAME_OpenCL_C = 0x0014,
+    DW_LNAME_Pascal = 0x0015,
+    DW_LNAME_PLI = 0x0016,
+    DW_LNAME_Python = 0x0017,
+    DW_LNAME_RenderScript = 0x0018,
+    DW_LNAME_Rust = 0x0019,
+    DW_LNAME_Swift = 0x001a,
+    DW_LNAME_UPC = 0x001b,
+    DW_LNAME_Zig = 0x001c,
+    DW_LNAME_Assembly = 0x001d,
+    DW_LNAME_C_sharp = 0x001e,
+    DW_LNAME_Mojo = 0x001f,
+    DW_LNAME_GLSL = 0x0020,
+    DW_LNAME_GLSL_ES = 0x0021,
+    DW_LNAME_HLSL = 0x0022,
+    DW_LNAME_OpenCL_CPP = 0x0023,
+    DW_LNAME_CPP_for_OpenCL = 0x0024,
+    DW_LNAME_SYCL = 0x0025,
+    DW_LNAME_Ruby = 0x0026,
+    DW_LNAME_Move = 0x0027,
+    DW_LNAME_Hylo = 0x0028,
+    DW_LNAME_HIP = 0x0029,
+    DW_LNAME_Odin = 0x002a,
+    DW_LNAME_P4 = 0x002b,
+    DW_LNAME_Metal = 0x002c,
+    DW_LNAME_V = 0x002d,
+    DW_LNAME_Algol68 = 0x002e
+  };
+
 /* DWARF identifier case encodings.  */
 enum
   {
diff --git a/libdw/dwarf_default_lower_bound.c 
b/libdw/dwarf_default_lower_bound.c
index 50639e32428e..f04ae46de0c5 100644
--- a/libdw/dwarf_default_lower_bound.c
+++ b/libdw/dwarf_default_lower_bound.c
@@ -88,6 +88,7 @@ dwarf_default_lower_bound (int lang, Dwarf_Sword *result)
     case DW_LANG_Ruby:
     case DW_LANG_Move:
     case DW_LANG_Hylo:
+    case DW_LANG_V:
       *result = 0;
       return 0;
 
@@ -109,6 +110,7 @@ dwarf_default_lower_bound (int lang, Dwarf_Sword *result)
     case DW_LANG_Ada2005:
     case DW_LANG_Ada2012:
     case DW_LANG_Fortran23:
+    case DW_LANG_Algol68:
       *result = 1;
       return 0;
 
-- 
2.48.1

Reply via email to