summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2023-02-20 16:42:56 +0100
committerMark Wielaard <mark@klomp.org>2023-02-23 11:17:11 +0100
commit9548a7f06e4bcfc640e8d470444c1cdbea5a6f73 (patch)
tree86f4401037a2f98b8c26f3ce28b5ace3123f6da0
parent924bee3c416b50bfdfdb53a3058eac1d7d859ef0 (diff)
downloadelfutils-9548a7f06e4bcfc640e8d470444c1cdbea5a6f73.tar.gz
libdw: Use elf_rawdata when checking .debug section
.debug sections are raw bytes and don't need conversion even when host and file have different endian order. Signed-off-by: Mark Wielaard <mark@klomp.org>
-rw-r--r--libdw/ChangeLog4
-rw-r--r--libdw/dwarf_begin_elf.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index e0cd8f21..5e60f786 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2023-02-20 Mark Wielaard <mark@klomp.org>
+
+ * dwarf_begin_elf.c (check_section): Use elf_rawdata.
+
2023-02-14 Mark Wielaard <mark@klomp.org>
* dwarf_getlocation.c (__libdw_intern_expression): Correct check
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index 1d4bb333..92d76d24 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
@@ -1,5 +1,6 @@
/* Create descriptor from ELF descriptor for processing file.
Copyright (C) 2002-2011, 2014, 2015, 2017, 2018 Red Hat, Inc.
+ Copyright (C) 2023, Mark J. Wielaard <mark@klomp.org>
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -242,8 +243,8 @@ check_section (Dwarf *result, size_t shstrndx, Elf_Scn *scn, bool inscngrp)
}
}
- /* Get the section data. */
- Elf_Data *data = elf_getdata (scn, NULL);
+ /* Get the section data. Should be raw bytes, no conversion needed. */
+ Elf_Data *data = elf_rawdata (scn, NULL);
if (data == NULL)
goto err;