Accepting request 1288676 from devel:gcc

- pr33029.patch: Fix crash in assembler with -gdawrf-5 (forwarded request 1286747 from Andreas_Schwab)

OBS-URL: https://build.opensuse.org/request/show/1288676
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/binutils?expand=0&rev=179
This commit is contained in:
2025-06-27 21:00:03 +00:00
committed by Git OBS Bridge
3 changed files with 50 additions and 0 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Jun 18 09:30:37 UTC 2025 - Andreas Schwab <schwab@suse.de>
- pr33029.patch: Fix crash in assembler with -gdawrf-5
-------------------------------------------------------------------
Tue Jun 3 09:07:07 UTC 2025 - Andreas Schwab <schwab@suse.de>

View File

@@ -152,6 +152,7 @@ Patch42: binutils-compat-old-behaviour.diff
Patch43: binutils-revert-hlasm-insns.diff
Patch44: binutils-revert-rela.diff
Patch60: binutils-disable-code-arch-error.diff
Patch61: pr33029.patch
Patch90: cross-avr-nesc-as.patch
Patch92: cross-avr-omit_section_dynsym.patch
Patch93: cross-avr-size.patch
@@ -280,6 +281,7 @@ cp ld/ldgram.y ld/ldgram.y.orig
%patch -P 44 -p1
%endif
%patch -P 60 -p1
%patch -P 61 -p1
%if "%{TARGET}" == "avr"
cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h
%patch -P 90

43
pr33029.patch Normal file
View File

@@ -0,0 +1,43 @@
From f601ffb52199a883f16df385b73a14e756b3e19a Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 28 May 2025 18:20:17 +0930
Subject: [PATCH] PR 33029 segv in dwarf2_finish with --gdwarf-5
Specifying --gdwarf-5 with a source lacking a ".file 0" directive
results in this segfault.
* dwarf2dbg.c (out_debug_str): Use files[1] if files[0] is
empty regardless of dwarf level.
---
gas/dwarf2dbg.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index fd1f96d80c5..a40fe6967d5 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -3019,6 +3019,11 @@ out_debug_str (segT str_seg, symbolS **name_sym, symbolS **comp_dir_sym,
int len;
int first_file = DWARF2_LINE_VERSION > 4 ? 0 : 1;
+ if (files_in_use == 0)
+ abort ();
+ if (first_file == 0 && files[first_file].filename == NULL)
+ first_file = 1;
+
subseg_set (str_seg, 0);
/* DW_AT_name. We don't have the actual file name that was present
@@ -3026,8 +3031,7 @@ out_debug_str (segT str_seg, symbolS **name_sym, symbolS **comp_dir_sym,
We're not supposed to get called unless at least one line number
entry was emitted, so this should always be defined. */
*name_sym = symbol_temp_new_now_octets ();
- if (files_in_use == 0)
- abort ();
+
if (files[first_file].dir)
{
char *dirname = remap_debug_filename (dirs[files[first_file].dir]);
--
2.50.0