mcst-linux-kernel/patches-2024.06.26/elfutils-0.184/0001_nested_remove.patch

72 lines
2.4 KiB
Diff

diff -Naur old/src/readelf.c new/src/readelf.c
--- old/src/readelf.c 2021-05-10 19:15:30.000000000 +0300
+++ new/src/readelf.c 2021-05-17 18:44:02.718280082 +0300
@@ -8373,6 +8373,20 @@
return readp;
}
+static inline void
+advance_pc (unsigned int op_advance,
+ uint_fast8_t max_ops_per_instr,
+ uint_fast8_t minimum_instr_len,
+ Dwarf_Word *address,
+ unsigned int *op_addr_advance,
+ unsigned int *op_index)
+{
+ *op_addr_advance = minimum_instr_len * ((*op_index + op_advance)
+ / max_ops_per_instr);
+ *address += *op_addr_advance;
+ *op_index = (*op_index + op_advance) % max_ops_per_instr;
+}
+
static void
print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg)
@@ -8763,14 +8777,6 @@
/* Apply the "operation advance" from a special opcode
or DW_LNS_advance_pc (as per DWARF4 6.2.5.1). */
unsigned int op_addr_advance;
- inline void advance_pc (unsigned int op_advance)
- {
- op_addr_advance = minimum_instr_len * ((op_index + op_advance)
- / max_ops_per_instr);
- address += op_addr_advance;
- op_index = (op_index + op_advance) % max_ops_per_instr;
- }
-
if (max_ops_per_instr == 0)
{
error (0, 0,
@@ -8806,7 +8812,9 @@
/* Perform the increments. */
line += line_increment;
- advance_pc ((opcode - opcode_base) / line_range);
+ advance_pc ((opcode - opcode_base) / line_range,
+ max_ops_per_instr, minimum_instr_len, &address,
+ &op_addr_advance, &op_index);
printf (_(" special opcode %u: address+%u = "),
opcode, op_addr_advance);
@@ -8924,7 +8932,8 @@
if (lineendp - linep < 1)
goto invalid_unit;
get_uleb128 (u128, linep, lineendp);
- advance_pc (u128);
+ advance_pc (u128, max_ops_per_instr, minimum_instr_len,
+ &address, &op_addr_advance, &op_index);
{
printf (_(" advance address by %u to "),
op_addr_advance);
@@ -8985,7 +8994,9 @@
if (unlikely (line_range == 0))
goto invalid_unit;
- advance_pc ((255 - opcode_base) / line_range);
+ advance_pc ((255 - opcode_base) / line_range,
+ max_ops_per_instr, minimum_instr_len,
+ &address, &op_addr_advance, &op_index);
{
printf (_(" advance address by constant %u to "),
op_addr_advance);