From 1e27db2f4c45bf0f7dff00e341f60d8b6d8317a7 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 2 Dec 2024 23:41:40 +0100 Subject: [PATCH] 0.192-7 - Add elfutils-0.192-ATOMIC_VAR_INIT.patch - Add elfutils-0.192-more-dwarf5-lang.patch --- elfutils-0.192-ATOMIC_VAR_INIT.patch | 28 ++++ elfutils-0.192-more-dwarf5-lang.patch | 204 ++++++++++++++++++++++++++ elfutils.spec | 13 +- 3 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 elfutils-0.192-ATOMIC_VAR_INIT.patch create mode 100644 elfutils-0.192-more-dwarf5-lang.patch diff --git a/elfutils-0.192-ATOMIC_VAR_INIT.patch b/elfutils-0.192-ATOMIC_VAR_INIT.patch new file mode 100644 index 0000000..962d4c9 --- /dev/null +++ b/elfutils-0.192-ATOMIC_VAR_INIT.patch @@ -0,0 +1,28 @@ +commit 5cc89c78499cd37465d7b0b3f35ef0e5d07a98cc +Author: Mark Wielaard +Date: Mon Nov 18 19:50:17 2024 +0100 + + libdw: Don't use ATOMIC_VAR_INIT + + ATOMIC_VAR_INIT was introduced in C11, but not deemed necessary to + implement atomics. So deprecated in C17 and removed in C23. Normal + initialization syntax should be sufficient. + + * libdw/libdw_alloc.c (next_id): Initialize to zero without + using ATOMIC_VAR_INIT. + + Signed-off-by: Mark Wielaard + +diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c +index b3e533434939..adc729f525f2 100644 +--- a/libdw/libdw_alloc.c ++++ b/libdw/libdw_alloc.c +@@ -45,7 +45,7 @@ + + #define THREAD_ID_UNSET ((size_t) -1) + static __thread size_t thread_id = THREAD_ID_UNSET; +-static atomic_size_t next_id = ATOMIC_VAR_INIT(0); ++static atomic_size_t next_id = 0; + + struct libdw_memblock * + __libdw_alloc_tail (Dwarf *dbg) diff --git a/elfutils-0.192-more-dwarf5-lang.patch b/elfutils-0.192-more-dwarf5-lang.patch new file mode 100644 index 0000000..2aa0d3b --- /dev/null +++ b/elfutils-0.192-more-dwarf5-lang.patch @@ -0,0 +1,204 @@ +commit 04ba163e813f6b88da850c658a03ac7b5f19f7ad +Author: Mark Wielaard +Date: Fri Nov 22 18:17:29 2024 +0100 + + libdw: Update DW_LANG codes + + Pick up the language codes published after DWARF5 was published. + The are listed at https://dwarfstd.org/languages.html + + Also adjust C language dectection in dwarf_getfuncs and update the + dwarf_default_lower_bound function to return the default lower bounds + for the new langauge codes. + + There is one small change in dwarf_default_lower_bound. We now return + zero instead of an error when called for DW_LANG_Mips_Assembler. Since + there is now an "official" DW_LANG_Assembly which is explicitly + defined as having a default lower bound of zero. It seems better to do + the same for the vendor code too. + + * libdw/dwarf.h: Add new DW_LANG codes. + * libdw/dwarf_default_lower_bound.c (dwarf_default_lower_bound): + Handle new language codes and remove a special case for + DW_LANG_Mips_Assembler. + * libdw/dwarf_getfuncs.c (dwarf_getfuncs): Check against + DW_LANG_C17 and DW_LANG_C23. + * tests/dwarf_default_lower_bound.c: Also check for + DW_LANG_Mips_Assembler. + + Signed-off-by: Mark Wielaard + +diff --git a/libdw/dwarf.h b/libdw/dwarf.h +index 4be32de5a67d..573ffd6925b2 100644 +--- a/libdw/dwarf.h ++++ b/libdw/dwarf.h +@@ -1,5 +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 + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify +@@ -697,7 +698,11 @@ enum + }; + + +-/* DWARF language encodings. */ ++/* DWARF language encodings. ++ ++ See https://dwarfstd.org/languages.html for language code published ++ after DWARF5 was published (but before DWARF6 has been released, ++ which will introduce a new DW_AT_language_name/version scheme). */ + enum + { + DW_LANG_C89 = 0x0001, /* ISO C:1989 */ +@@ -738,6 +743,35 @@ enum + DW_LANG_RenderScript = 0x0024, /* RenderScript Kernal Language */ + DW_LANG_BLISS = 0x0025, /* BLISS */ + ++ DW_LANG_Kotlin = 0x0026, /* Kotlin */ ++ DW_LANG_Zig = 0x0027, /* Zig */ ++ DW_LANG_Crystal = 0x0028, /* Crystal */ ++ DW_LANG_C_plus_plus_17 = 0x002a, /* ISO C++:2017 */ ++ DW_LANG_C_plus_plus_20 = 0x002b, /* ISO C++:2018 */ ++ DW_LANG_C17 = 0x002c, /* ISO C:2017 */ ++ DW_LANG_Fortran18 = 0x002d, /* ISO/IEC 1539-1:2018 */ ++ DW_LANG_Ada2005 = 0x002e, /* ISO Ada:2005 */ ++ DW_LANG_Ada2012 = 0x002f, /* ISO Ada:2005 */ ++ DW_LANG_HIP = 0x0030, /* HIP */ ++ DW_LANG_Assembly = 0x0031, /* Assembly */ ++ DW_LANG_C_sharp = 0x0032, /* C# */ ++ DW_LANG_Mojo = 0x0033, /* Mojo */ ++ DW_LANG_GLSL = 0x0034, /* OpenGL Shading Language */ ++ DW_LANG_GLSL_ES = 0x0035, /* OpenGL ES Shading Language */ ++ DW_LANG_HLSL = 0x0036, /* High-Level Shading Language */ ++ DW_LANG_OpenCL_CPP = 0x0037, /* OpenCL C++ */ ++ DW_LANG_CPP_for_OpenCL = 0x0038, /* C++ for OpenCL */ ++ DW_LANG_SYCL = 0x0039, /* SYCL */ ++ DW_LANG_C_plus_plus_23 = 0x003a, /* ISO C++:2023 */ ++ DW_LANG_Odin = 0x003b, /* Odin */ ++ DW_LANG_P4 = 0x003c, /* P4 */ ++ DW_LANG_Metal = 0x003d, /* Metal */ ++ DW_LANG_C23 = 0x003e, /* ISO C:2023 */ ++ DW_LANG_Fortran23 = 0x003f, /* ISO/IEC 1539-1:2023 */ ++ DW_LANG_Ruby = 0x0040, /* Ruby */ ++ DW_LANG_Move = 0x0041, /* Move */ ++ DW_LANG_Hylo = 0x0042, /* Hylo */ ++ + DW_LANG_lo_user = 0x8000, + DW_LANG_Mips_Assembler = 0x8001, /* Assembler */ + DW_LANG_hi_user = 0xffff +diff --git a/libdw/dwarf_default_lower_bound.c b/libdw/dwarf_default_lower_bound.c +index a33a34335b1b..50639e32428e 100644 +--- a/libdw/dwarf_default_lower_bound.c ++++ b/libdw/dwarf_default_lower_bound.c +@@ -1,5 +1,6 @@ + /* Get the default subrange lower bound for a given language. + Copyright (C) 2016 Red Hat, Inc. ++ Copyright (C) 2024 Mark J. Wielaard + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify +@@ -63,6 +64,30 @@ dwarf_default_lower_bound (int lang, Dwarf_Sword *result) + case DW_LANG_Dylan: + case DW_LANG_RenderScript: + case DW_LANG_BLISS: ++ case DW_LANG_Kotlin: ++ case DW_LANG_Zig: ++ case DW_LANG_Crystal: ++ case DW_LANG_C_plus_plus_17: ++ case DW_LANG_C_plus_plus_20: ++ case DW_LANG_C17: ++ case DW_LANG_HIP: ++ case DW_LANG_Assembly: ++ case DW_LANG_C_sharp: ++ case DW_LANG_Mojo: ++ case DW_LANG_GLSL: ++ case DW_LANG_GLSL_ES: ++ case DW_LANG_HLSL: ++ case DW_LANG_OpenCL_CPP: ++ case DW_LANG_CPP_for_OpenCL: ++ case DW_LANG_SYCL: ++ case DW_LANG_C_plus_plus_23: ++ case DW_LANG_Odin: ++ case DW_LANG_P4: ++ case DW_LANG_Metal: ++ case DW_LANG_C23: ++ case DW_LANG_Ruby: ++ case DW_LANG_Move: ++ case DW_LANG_Hylo: + *result = 0; + return 0; + +@@ -80,9 +105,18 @@ dwarf_default_lower_bound (int lang, Dwarf_Sword *result) + case DW_LANG_Modula3: + case DW_LANG_PLI: + case DW_LANG_Julia: ++ case DW_LANG_Fortran18: ++ case DW_LANG_Ada2005: ++ case DW_LANG_Ada2012: ++ case DW_LANG_Fortran23: + *result = 1; + return 0; + ++ /* Special case vendor Assembly variant. */ ++ case DW_LANG_Mips_Assembler: ++ *result = 0; ++ return 0; ++ + default: + __libdw_seterrno (DWARF_E_UNKNOWN_LANGUAGE); + return -1; +diff --git a/libdw/dwarf_getfuncs.c b/libdw/dwarf_getfuncs.c +index b95f06f403d1..f6968f0081d4 100644 +--- a/libdw/dwarf_getfuncs.c ++++ b/libdw/dwarf_getfuncs.c +@@ -1,5 +1,6 @@ + /* Get function information. + Copyright (C) 2005, 2013, 2015 Red Hat, Inc. ++ Copyright (C) 2024 Mark J. Wielaard + This file is part of elfutils. + Written by Ulrich Drepper , 2005. + +@@ -104,7 +105,9 @@ dwarf_getfuncs (Dwarf_Die *cudie, int (*callback) (Dwarf_Die *, void *), + bool c_cu = (lang == DW_LANG_C89 + || lang == DW_LANG_C + || lang == DW_LANG_C99 +- || lang == DW_LANG_C11); ++ || lang == DW_LANG_C11 ++ || lang == DW_LANG_C17 ++ || lang == DW_LANG_C23); + + struct visitor_info v = { callback, arg, (void *) offset, NULL, c_cu }; + struct Dwarf_Die_Chain chain = { .die = CUDIE (cudie->cu), +diff --git a/tests/dwarf_default_lower_bound.c b/tests/dwarf_default_lower_bound.c +index d57424fc77fe..46e26f885a6b 100644 +--- a/tests/dwarf_default_lower_bound.c ++++ b/tests/dwarf_default_lower_bound.c +@@ -1,6 +1,7 @@ + /* Test all DW_LANG constants are handled by dwarf_default_lower_bound. + + Copyright (C) 2016 Red Hat, Inc. ++ Copyright (C) 2024 Mark J. Wielaard + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify +@@ -34,18 +35,6 @@ test_lang (const char *name, int lang) + Dwarf_Sword low; + int res = dwarf_default_lower_bound (lang, &low); + +- /* Assembler is special, it doesn't really have arrays. */ +- if (lang == DW_LANG_Mips_Assembler) +- { +- if (res == 0) +- { +- printf ("%s shouldn't have a known lower bound\n", name); +- exit (-1); +- } +- printf ("%s: \n", name); +- return; +- } +- + if (res != 0) + { + printf ("dwarf_default_lower_bound failed (%d) for %s\n", res, name); diff --git a/elfutils.spec b/elfutils.spec index 01e85ad..ea03564 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -4,7 +4,7 @@ Name: elfutils Version: 0.192 -%global baserelease 6 +%global baserelease 7 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -112,6 +112,12 @@ Patch5: elfutils-0.192-fix-zsh-profile.patch # Fix testsuite failure caused by ld changes. Patch6: elfutils-0.192-strip-ignore-non-ET_REL.patch +# In c23 ATOMIC_VAR_INIT has been removed +Patch7: elfutils-0.192-ATOMIC_VAR_INIT.patch + +# New DWARF5 language constants +Patch8: elfutils-0.192-more-dwarf5-lang.patch + %description Elfutils is a collection of utilities, including stack (to show backtraces), nm (for listing symbols from object files), size @@ -532,6 +538,11 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog + +* Mon Dec 2 2024 Mark Wielaard - 0.192-7 +- Add elfutils-0.192-ATOMIC_VAR_INIT.patch +- Add elfutils-0.192-more-dwarf5-lang.patch + * Tue Nov 12 2024 Aaron Merey - 0.192-6 - Add elfutils-0.192-strip-ignore-non-ET_REL.patch - Set debuginfod IMA cert path