public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: binutils@sourceware.org
Cc: amodra@gmail.com
Subject: Re: [PATCH] objcopy.c: Fix bfd_copy_private_symbol_data on 32-bit hosts
Date: Tue, 23 Apr 2024 08:30:03 -0700	[thread overview]
Message-ID: <CAMe9rOo4=6=0oUs1eEY_YaU6OrxNK=h0iA3ACt5y6f_B1cDTRg@mail.gmail.com> (raw)
In-Reply-To: <20240423141324.1156583-1-hjl.tools@gmail.com>

On Tue, Apr 23, 2024 at 7:13 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Use long with bfd_copy_private_symbol_data to fix
>
> .../binutils/objcopy.c: In
> function ‘copy_object’:
> .../binutils/objcopy.c:3383:17: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘long int’ [-Werror=sign-compare]
>  3383 |   for (i = 0; i < symcount; i++)
>       |                 ^
>
> on 32-bit hosts.
>
>         PR binutils/14493
>         * objcopy.c (copy_object): Use long with
>         bfd_copy_private_symbol_data.
> ---
>  binutils/objcopy.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/binutils/objcopy.c b/binutils/objcopy.c
> index 634ebae3fc3..e8ca1374935 100644
> --- a/binutils/objcopy.c
> +++ b/binutils/objcopy.c
> @@ -3380,8 +3380,8 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
>        symcount = filter_symbols (ibfd, obfd, osympp, isympp, symcount);
>      }
>
> -  for (i = 0; i < symcount; i++)
> -    if (!bfd_copy_private_symbol_data (ibfd, osympp[i], obfd, osympp[i]))
> +  for (long s = 0; s < symcount; s++)
> +    if (!bfd_copy_private_symbol_data (ibfd, osympp[s], obfd, osympp[s]))
>        {
>         status = 1;
>         return false;
> --
> 2.44.0
>

Tested on Linux/x86-64 and Linux/i686.  I am checking it in.

-- 
H.J.

  reply	other threads:[~2024-04-23 15:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 14:13 H.J. Lu
2024-04-23 15:30 ` H.J. Lu [this message]
2024-04-23 23:48   ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMe9rOo4=6=0oUs1eEY_YaU6OrxNK=h0iA3ACt5y6f_B1cDTRg@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).