Bug 24951 - Thin archive doesn't work with compressed section
Summary: Thin archive doesn't work with compressed section
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.33
: P2 normal
Target Milestone: 2.33
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-29 19:59 UTC by H.J. Lu
Modified: 2019-11-19 09:52 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2019-08-29 19:59:32 UTC
_bfd_get_elt_at_filepos failed to copy BFD_COMPRESS, BFD_DECOMPRESS and
BFD_COMPRESS_GABI flags for thin archive.  This patch fixes it:

diff --git a/bfd/archive.c b/bfd/archive.c
index 3baf83d40c..690718e949 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -692,6 +692,13 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
         return NULL;
       }
     n_bfd->proxy_origin = bfd_tell (archive);
+
+    /* Copy BFD_COMPRESS, BFD_DECOMPRESS and BFD_COMPRESS_GABI
+       flags.  */
+    n_bfd->flags |= archive->flags & (BFD_COMPRESS
+                  | BFD_DECOMPRESS
+                  | BFD_COMPRESS_GABI);
+
     return n_bfd;
   }
Comment 1 Sourceware Commits 2019-08-30 14:47:21 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6744bcad05396a5901149a202270e523e454769d

commit 6744bcad05396a5901149a202270e523e454769d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Aug 30 07:46:15 2019 -0700

    Copy BFD_COMPRESS/BFD_DECOMPRESS/BFD_COMPRESS_GABI for thin archive
    
    We need to copy BFD_COMPRESS, BFD_DECOMPRESS and BFD_COMPRESS_GABI flags
    for thin archive.
    
    	PR ld/24951
    	* archive.c (_bfd_get_elt_at_filepos): Copy BFD_COMPRESS,
    	BFD_DECOMPRESS and BFD_COMPRESS_GABI flags for thin archive.
Comment 2 Alan Modra 2019-11-19 09:52:06 UTC
Fixed for 2.33