From patchwork Tue Oct 4 20:03:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?RnLDqWTDqXJpYyBQw6l0cm90?= X-Patchwork-Id: 1702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp288819wrs; Tue, 4 Oct 2022 13:03:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cVr5I4BnIALHEowUQw/FY1y1Vr5RBobPah/j8z/on1pQXEz0galy7hxeBbA6vGRs2DnWq X-Received: by 2002:aa7:cad5:0:b0:454:88dc:2c22 with SMTP id l21-20020aa7cad5000000b0045488dc2c22mr25272428edt.352.1664913822748; Tue, 04 Oct 2022 13:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664913822; cv=none; d=google.com; s=arc-20160816; b=qS5UhuWLxUxNvtzNKeWvVGKY2E2BE6A6tGrEaL2Bm9Ubs/CY5NPeT5Gdgz3K21mk49 8Byyuix4oIhQmZdvERxznOTLqNxp2LobefxFYAhGjx7QxJJT8lQNBxoeBNHnc5wSngZW 1nKx/f0D3J4l8H3C3AP7NGseZBVXDUWzRAI5l1ULpu7PMneQivCIvIAYoB9i6kL+CBf4 3LNyFOD2tSC+BvCe0kF68QNYXAwrNct9kFy0trycVh0miaM7QSM4KIEg7puuvrtNRJys DYJZX1nJg64NTNdHobE+bcX9GOMicXfUjEAN14yG9RYXGP0IJlOVFhoGLAJ8/V0EmC6p y+DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:subject:to:content-language:user-agent :mime-version:date:message-id:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=v/r1RIhztx1na3ypFHOzMbjN2f70P8DTanh0gjGimuc=; b=XesA9cqKa2Dm3ypfn+6f5gFiaKmay8rt+ZGddkD0EmhUSNhHUPaSvRnWw1YxxUAVqP cqLGwhBsSZ8Sf7b8Movmo/GWC5NVE5tHI4yKxz/fVkusSkVRs36q4RCI7sbsKXwcz3rN xt9e1LFa7glvMVYPB1ssOcGyI34SCMtGF7JJlUf8xLIi8nJYfdq3xSc+R0Jic4IQS5xE 3w23AJgyc11iUwy7saDSTaMKTF7Jmu6X+ykDr4FuVb8k0ck/TusbZIzBkfd9/Klsqdlf 9xEMoCriyJFDZ8TFGslenmY2a9Hbgcf2ipj/IbGtQTYMAAgwiv81FQ44PRTykdYjv2q8 NQCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=IlUb0DkE; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id cr11-20020a170906d54b00b00783602ab27bsi11809722ejc.33.2022.10.04.13.03.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 13:03:42 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=IlUb0DkE; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 75A233858010 for ; Tue, 4 Oct 2022 20:03:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 75A233858010 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664913821; bh=v/r1RIhztx1na3ypFHOzMbjN2f70P8DTanh0gjGimuc=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=IlUb0DkEfW+a7JbLkFelT5K6W7noBFNJz8w2o1Y48PzHC70Zp3ugxesBt5Bg/iD+7 ucg6A6AeqSR9PhcZT4vaVnrc3HzdTukOxv9z7JnCNeDw+OcW7Atn4BL1dr9dOqiaSo Q3G3q2w7pgfHArNAXaxOHn56zvWhEF3st7SRz4eE= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from zm-mta-out-3.u-ga.fr (zm-mta-out-3.u-ga.fr [152.77.200.56]) by sourceware.org (Postfix) with ESMTPS id E70E83858D39 for ; Tue, 4 Oct 2022 20:03:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E70E83858D39 Received: from mailhub.u-ga.fr (mailhub-1.u-ga.fr [129.88.178.98]) by zm-mta-out-3.u-ga.fr (Postfix) with ESMTP id 86637403B2 for ; Tue, 4 Oct 2022 22:03:29 +0200 (CEST) Received: from smtps.univ-grenoble-alpes.fr (smtps3.u-ga.fr [195.83.24.62]) by mailhub.u-ga.fr (Postfix) with ESMTP id 83EDC100056 for ; Tue, 4 Oct 2022 22:03:29 +0200 (CEST) Received: from [192.168.1.62] (35.201.90.79.rev.sfr.net [79.90.201.35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: petrotf@univ-grenoble-alpes.fr) by smtps.univ-grenoble-alpes.fr (Postfix) with ESMTPSA id 7AF794005E for ; Tue, 4 Oct 2022 22:03:29 +0200 (CEST) Message-ID: <5f482299-6c60-b2b3-9abe-f4a55a5a26c5@univ-grenoble-alpes.fr> Date: Tue, 4 Oct 2022 22:03:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Content-Language: fr, en-US To: binutils@sourceware.org Subject: [RFC PATCH] bfd: use bfd_vma for the 64-bit version of put[lb] and get[lb] X-Greylist: Whitelist-UGA SMTP Authentifie (petrotf@univ-grenoble-alpes.fr) via submission-587 ACL (41) X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_ASCII_DIVIDERS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: =?utf-8?q?Fr=C3=A9d=C3=A9ric_P=C3=A9trot_via_Binutils?= From: =?utf-8?b?RnLDqWTDqXJpYyBQw6l0cm90?= Reply-To: =?utf-8?b?RnLDqWTDqXJpYyBQw6l0cm90?= Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745788676819162420?= X-GMAIL-MSGID: =?utf-8?q?1745788676819162420?= Hi, During summer (around Aug.4) Alan replaced in many places the use of bfd_vma and such by the c99 types. However, when compiling for an ad-hoc target of ours, the fact that the 64-bit version of the put and get functions does not share the same prototypes as the other bit-width versions needs a patch while making the prototypes consistent might be acceptable, what do you think? Thanks, Frédéric The 16-bit, 24-bit and 32-bit versions of these functions use an argument of type bfd_[signed_]vma while the 64-bit version uses [u]int64_t. Given the comment in front of the definition of the bfd vma types in bfd-in.h, the use of the bfd specific types should be possible and would make the code consistent across all function versions. bfd/ * bfd-in.h: change argument or return value types in put/get functions prototypes * libbfd.c: likewise for implementations --- bfd/bfd-in.h | 12 ++++++------ bfd/libbfd.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 4765ea80536..9efb5ce5a84 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -403,10 +403,10 @@ extern bool bfd_record_phdr /* Byte swapping routines. */ -uint64_t bfd_getb64 (const void *); -uint64_t bfd_getl64 (const void *); -int64_t bfd_getb_signed_64 (const void *); -int64_t bfd_getl_signed_64 (const void *); +bfd_vma bfd_getb64 (const void *); +bfd_vma bfd_getl64 (const void *); +bfd_signed_vma bfd_getb_signed_64 (const void *); +bfd_signed_vma bfd_getl_signed_64 (const void *); bfd_vma bfd_getb32 (const void *); bfd_vma bfd_getl32 (const void *); bfd_signed_vma bfd_getb_signed_32 (const void *); @@ -415,8 +415,8 @@ bfd_vma bfd_getb16 (const void *); bfd_vma bfd_getl16 (const void *); bfd_signed_vma bfd_getb_signed_16 (const void *); bfd_signed_vma bfd_getl_signed_16 (const void *); -void bfd_putb64 (uint64_t, void *); -void bfd_putl64 (uint64_t, void *); +void bfd_putb64 (bfd_vma, void *); +void bfd_putl64 (bfd_vma, void *); void bfd_putb32 (bfd_vma, void *); void bfd_putl32 (bfd_vma, void *); void bfd_putb24 (bfd_vma, void *); diff --git a/bfd/libbfd.c b/bfd/libbfd.c index d33f3416206..5eab59d2e76 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -757,7 +757,7 @@ bfd_getl_signed_32 (const void *p) return COERCE32 (v); } -uint64_t +bfd_vma bfd_getb64 (const void *p) { const bfd_byte *addr = (const bfd_byte *) p; @@ -775,7 +775,7 @@ bfd_getb64 (const void *p) return v; } -uint64_t +bfd_vma bfd_getl64 (const void *p) { const bfd_byte *addr = (const bfd_byte *) p; @@ -793,7 +793,7 @@ bfd_getl64 (const void *p) return v; } -int64_t +bfd_signed_vma bfd_getb_signed_64 (const void *p) { const bfd_byte *addr = (const bfd_byte *) p; @@ -811,7 +811,7 @@ bfd_getb_signed_64 (const void *p) return COERCE64 (v); } -int64_t +bfd_signed_vma bfd_getl_signed_64 (const void *p) { const bfd_byte *addr = (const bfd_byte *) p; @@ -850,7 +850,7 @@ bfd_putl32 (bfd_vma data, void *p) } void -bfd_putb64 (uint64_t data, void *p) +bfd_putb64 (bfd_vma data, void *p) { bfd_byte *addr = (bfd_byte *) p; addr[0] = (data >> (7*8)) & 0xff; @@ -864,7 +864,7 @@ bfd_putb64 (uint64_t data, void *p) } void -bfd_putl64 (uint64_t data, void *p) +bfd_putl64 (bfd_vma data, void *p) { bfd_byte *addr = (bfd_byte *) p; addr[7] = (data >> (7*8)) & 0xff;