[2/2] elfcpp/dwarf.h: Add new DWARF5 constants to DW_LANG enum

Message ID 20241210122332.751493-2-ahajkova@redhat.com
State New
Headers
Series [1/2] display_lang: Add descriptions for new DWARF5 constants |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Build failed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Build failed

Commit Message

Alexandra Hájková Dec. 10, 2024, 12:23 p.m. UTC
  Also add the new Ada and Fortran language codes to gold/gdb-index.cc
Gdb_index_info_reader::visit_top_die check as --gdb-index only
supports C and C++ languages and emits warnings otherwise.
---
 elfcpp/dwarf.h    | 9 +++++++++
 gold/gdb-index.cc | 6 +++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
  

Comments

Jan Beulich Dec. 10, 2024, 12:54 p.m. UTC | #1
On 10.12.2024 13:23, Alexandra Hájková wrote:
> --- a/elfcpp/dwarf.h
> +++ b/elfcpp/dwarf.h
> @@ -247,6 +247,15 @@ enum DW_LANG
>    DW_LANG_C_plus_plus_14 = 0x0021,
>    DW_LANG_Fortran03 = 0x0022,
>    DW_LANG_Fortran08 = 0x0023,
> +  DW_LANG_C_plus_plus_20 = 0x002b,
> +  DW_LANG_C17 = 0x002c,
> +  DW_LANG_Ada2005 = 0x002e,
> +  DW_LANG_Ada2012 = 0x002f,
> +  DW_LANG_Assembly = 0x0031,
> +  DW_LANG_Fortran18 = 0x002d,

Why out of order?

> +  DW_LANG_C_plus_plus_23 = 0x003a,
> +  DW_LANG_C23 = 0x003e,
> +  DW_LANG_Fortran23 = 0x003fi,

You're also omitting quite a few. Why? Many certainly would fit ...

> --- a/gold/gdb-index.cc
> +++ b/gold/gdb-index.cc
> @@ -371,9 +371,13 @@ Gdb_index_info_reader::visit_top_die(Dwarf_die* die)
>  		|| this->cu_language_ == elfcpp::DW_LANG_Fortran90
>  		|| this->cu_language_ == elfcpp::DW_LANG_Java
>  		|| this->cu_language_ == elfcpp::DW_LANG_Ada95
> +		|| this->cu_language_ == elfcpp::DW_LANG_Ada2005
> +		|| this->cu_language_ == elfcpp::DW_LANG_Ada2012
>  		|| this->cu_language_ == elfcpp::DW_LANG_Fortran95
>  		|| this->cu_language_ == elfcpp::DW_LANG_Fortran03
> -		|| this->cu_language_ == elfcpp::DW_LANG_Fortran08)
> +		|| this->cu_language_ == elfcpp::DW_LANG_Fortran08
> +		|| this->cu_language_ == elfcpp::DW_LANG_Fortran18
> +		|| this->cu_language_ == elfcpp::DW_LANG_Fortran23)
>  	      {
>  		gold_warning(_("%s: --gdb-index currently supports "
>  			       "only C and C++ languages"),

... the purpose here.

Jan
  
Hans-Peter Nilsson Dec. 10, 2024, 8:38 p.m. UTC | #2
On Tue, 10 Dec 2024, Alexandra Hájková wrote:

> --- a/elfcpp/dwarf.h
> +  DW_LANG_Fortran23 = 0x003fi,

"i"?

brgds, H-P
  

Patch

diff --git a/elfcpp/dwarf.h b/elfcpp/dwarf.h
index 2adb8642019..90d12f595ea 100644
--- a/elfcpp/dwarf.h
+++ b/elfcpp/dwarf.h
@@ -247,6 +247,15 @@  enum DW_LANG
   DW_LANG_C_plus_plus_14 = 0x0021,
   DW_LANG_Fortran03 = 0x0022,
   DW_LANG_Fortran08 = 0x0023,
+  DW_LANG_C_plus_plus_20 = 0x002b,
+  DW_LANG_C17 = 0x002c,
+  DW_LANG_Ada2005 = 0x002e,
+  DW_LANG_Ada2012 = 0x002f,
+  DW_LANG_Assembly = 0x0031,
+  DW_LANG_Fortran18 = 0x002d,
+  DW_LANG_C_plus_plus_23 = 0x003a,
+  DW_LANG_C23 = 0x003e,
+  DW_LANG_Fortran23 = 0x003fi,
 
   DW_LANG_lo_user = 0x8000,	// Implementation-defined range start.
   DW_LANG_hi_user = 0xffff,	// Implementation-defined range start.
diff --git a/gold/gdb-index.cc b/gold/gdb-index.cc
index 4d0ae0941b5..2f2164603dd 100644
--- a/gold/gdb-index.cc
+++ b/gold/gdb-index.cc
@@ -371,9 +371,13 @@  Gdb_index_info_reader::visit_top_die(Dwarf_die* die)
 		|| this->cu_language_ == elfcpp::DW_LANG_Fortran90
 		|| this->cu_language_ == elfcpp::DW_LANG_Java
 		|| this->cu_language_ == elfcpp::DW_LANG_Ada95
+		|| this->cu_language_ == elfcpp::DW_LANG_Ada2005
+		|| this->cu_language_ == elfcpp::DW_LANG_Ada2012
 		|| this->cu_language_ == elfcpp::DW_LANG_Fortran95
 		|| this->cu_language_ == elfcpp::DW_LANG_Fortran03
-		|| this->cu_language_ == elfcpp::DW_LANG_Fortran08)
+		|| this->cu_language_ == elfcpp::DW_LANG_Fortran08
+		|| this->cu_language_ == elfcpp::DW_LANG_Fortran18
+		|| this->cu_language_ == elfcpp::DW_LANG_Fortran23)
 	      {
 		gold_warning(_("%s: --gdb-index currently supports "
 			       "only C and C++ languages"),