From: Paul Floyd Date: Mon, 9 May 2022 05:49:56 +0000 (+0200) Subject: FreeBSD: only set osrel for executables. X-Git-Tag: VALGRIND_3_20_0~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=407c00c2e9ef2bf3e87412d01e8ebc7baefbe8ef;p=thirdparty%2Fvalgrind.git FreeBSD: only set osrel for executables. --- 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