From 407c00c2e9ef2bf3e87412d01e8ebc7baefbe8ef Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 9 May 2022 07:49:56 +0200 Subject: [PATCH] FreeBSD: only set osrel for executables. --- coregrind/m_debuginfo/readelf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index c586e3f332..998bc08fab 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -1147,6 +1147,12 @@ void read_and_set_osrel(DiImage* img) ElfXX_Ehdr ehdr; ML_(img_get)(&ehdr, img, 0, sizeof(ehdr)); + + /* only set osrel for executable files, not for subsequent shared libraries */ + if (ehdr.e_type != ET_EXEC) { + return; + } + /* Skip the phdrs when we have to search the shdrs. In separate .debug files the phdrs might not be valid (they are a copy of the main ELF file) and might trigger assertions when getting -- 2.47.2