aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorAndrei Homescu <ah@immunant.com>2021-07-01 12:01:55 +0100
committerNick Clifton <nickc@redhat.com>2021-07-01 12:01:55 +0100
commit75a2da57a1bbff8686f56a43aabe1d7e55147894 (patch)
treedf54a4d3cdd1241fff656831cd238b4ee0e8b73f /binutils/readelf.c
parent417f991f08cb869e8274e0a6af6c88b14413e0ec (diff)
downloadgdb-75a2da57a1bbff8686f56a43aabe1d7e55147894.zip
gdb-75a2da57a1bbff8686f56a43aabe1d7e55147894.tar.gz
gdb-75a2da57a1bbff8686f56a43aabe1d7e55147894.tar.bz2
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.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c3
1 files changed, 3 insertions, 0 deletions
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;