From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by sourceware.org (Postfix) with ESMTPS id 5FBF4386F82E for ; Wed, 22 Jul 2020 09:39:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5FBF4386F82E Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06M9XUM3184495 for ; Wed, 22 Jul 2020 09:39:36 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 32d6kspbde-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 22 Jul 2020 09:39:36 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06M9cVHo189687 for ; Wed, 22 Jul 2020 09:39:36 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 32ehx039h5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 22 Jul 2020 09:39:36 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 06M9dZRu009829 for ; Wed, 22 Jul 2020 09:39:35 GMT Received: from loom.srvr.nix (/81.187.191.129) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 22 Jul 2020 02:39:35 -0700 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 2/4] libctf, binutils: fix big-endian libctf archive opening Date: Wed, 22 Jul 2020 10:39:24 +0100 Message-Id: <20200722093926.309568-3-nick.alcock@oracle.com> X-Mailer: git-send-email 2.27.0.247.g3dff7de930 In-Reply-To: <20200722093926.309568-1-nick.alcock@oracle.com> References: <20200630233146.338613-1-nick.alcock@oracle.com> <20200722093926.309568-1-nick.alcock@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9689 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=785 adultscore=0 phishscore=0 bulkscore=0 spamscore=0 suspectscore=13 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007220072 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9689 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=13 bulkscore=0 mlxscore=0 mlxlogscore=796 impostorscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007220072 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jul 2020 09:39:38 -0000 The recent commit "libctf, binutils: support CTF archives like objdump" broke opening of CTF archives on big-endian platforms. This didn't affect anyone much before now because the linker never emitted CTF archives because it wasn't detecting ambiguous types properly: now it does, and this bug becomes obvious. Fix trivial. libctf/ * ctf-archive.c (ctf_arc_bufopen): Endian-swap the archive magic number if needed. --- libctf/ctf-archive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libctf/ctf-archive.c b/libctf/ctf-archive.c index 3b4304f0894..4fbb246c67b 100644 --- a/libctf/ctf-archive.c +++ b/libctf/ctf-archive.c @@ -393,7 +393,7 @@ ctf_arc_bufopen (const ctf_sect_t *ctfsect, const ctf_sect_t *symsect, ctf_file_t *fp = NULL; if (ctfsect->cts_size > sizeof (uint64_t) && - ((*(uint64_t *) ctfsect->cts_data) == CTFA_MAGIC)) + (le64toh ((*(uint64_t *) ctfsect->cts_data)) == CTFA_MAGIC)) { /* The archive is mmappable, so this operation is trivial. -- 2.27.0.247.g3dff7de930