From 75a2da57a1bbff8686f56a43aabe1d7e55147894 Mon Sep 17 00:00:00 2001 From: Andrei Homescu Date: Thu, 1 Jul 2021 12:01:55 +0100 Subject: readelf: Reset file position to beginning for thin archive members * readelf.c (process_archive): Reset file position to the beginning when calling process_object for thin archive members. * testsuite/binutils-all/readelf.exp: Add test. * testsuite/binutils-all/readelf.h.thin: New file. --- binutils/readelf.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'binutils/readelf.c') diff --git a/binutils/readelf.c b/binutils/readelf.c index f7c6432..a6073f7 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -21792,6 +21792,9 @@ process_archive (Filedata * filedata, bool is_thin_archive) filedata->archive_file_offset = arch.nested_member_origin; member_filedata->file_name = qualified_name; + /* The call to process_object() expects the file to be at the beginning. */ + rewind (member_filedata->handle); + if (! process_object (member_filedata)) ret = false; -- cgit v1.1