readelf: Handle SHT_RISCV_ATTRIBUTES like SHT_GNU_ATTRIBUTES

Message ID mvmiln0jx9h.fsf@suse.de
State Committed
Headers
Series readelf: Handle SHT_RISCV_ATTRIBUTES like SHT_GNU_ATTRIBUTES |

Commit Message

Andreas Schwab Aug. 10, 2022, 8:52 a.m. UTC
  Signed-off-by: Andreas Schwab <schwab@suse.de>
---
 src/ChangeLog | 4 ++++
 src/readelf.c | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)
  

Comments

Mark Wielaard Aug. 13, 2022, 7:12 p.m. UTC | #1
On Wed, 10 Aug 2022 10:52:42 +0200, Andreas Schwab wrote:
> 


Applied, thanks!

[1/1] readelf: Handle SHT_RISCV_ATTRIBUTES like SHT_GNU_ATTRIBUTES
      commit: b713edb9a7f3da8e4dd28ac69a1665ed493ca504

Best regards,
  

Patch

diff --git a/src/ChangeLog b/src/ChangeLog
index fbcef29e..88db4051 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@ 
+2022-08-10  Andreas Schwab  <schwab@suse.de>
+
+	* readelf.c (print_attributes): Also handle SHT_RISCV_ATTRIBUTES.
+
 2022-08-09  Andreas Schwab  <schwab@suse.de>
 
 	* elflint.c (check_program_header): Don't complain about p_filesz
diff --git a/src/readelf.c b/src/readelf.c
index f1f77ce8..1a10fd01 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -3672,7 +3672,9 @@  print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr)
 			   && (shdr->sh_type != SHT_ARM_ATTRIBUTES
 			       || ehdr->e_machine != EM_ARM)
 			   && (shdr->sh_type != SHT_CSKY_ATTRIBUTES
-			       || ehdr->e_machine != EM_CSKY)))
+			       || ehdr->e_machine != EM_CSKY)
+			   && (shdr->sh_type != SHT_RISCV_ATTRIBUTES
+			       || ehdr->e_machine != EM_RISCV)))
 	continue;
 
       printf (_("\