[PATCH v2] ld: remove unnecessary check

H.J. Lu hjl.tools@gmail.com
Fri Nov 1 21:45:01 GMT 2024


On Fri, Nov 1, 2024 at 5:07 PM Xin Wang <yw987194828@gmail.com> wrote:
>
> Signed-off-by: Xin Wang <yw987194828@gmail.com>
>
> ---
>  bfd/elf64-x86-64.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
> index 4330bbd1648..707bbf9b103 100644
> --- a/bfd/elf64-x86-64.c
> +++ b/bfd/elf64-x86-64.c
> @@ -1590,7 +1590,7 @@ elf_x86_64_need_pic (struct bfd_link_info *info,
>  {
>    const char *v = "";
>    const char *und = "";
> -  const char *pic = "";
> +  const char *pic;
>    const char *object;
>
>    const char *name;
> @@ -1613,7 +1613,6 @@ elf_x86_64_need_pic (struct bfd_link_info *info,
>             v = _("protected symbol ");
>           else
>             v = _("symbol ");
> -         pic = NULL;
>           break;
>         }
>
> @@ -1621,16 +1620,12 @@ elf_x86_64_need_pic (struct bfd_link_info *info,
>         und = _("undefined ");
>      }
>    else
> -    {
>        name = bfd_elf_sym_name (input_bfd, symtab_hdr, isym, NULL);
> -      pic = NULL;
> -    }
>
>    if (bfd_link_dll (info))
>      {
>        object = _("a shared object");
> -      if (!pic)
> -       pic = _("; recompile with -fPIC");
> +      pic = _("; recompile with -fPIC");
>      }
>    else
>      {
> @@ -1638,8 +1633,7 @@ elf_x86_64_need_pic (struct bfd_link_info *info,
>         object = _("a PIE object");
>        else
>         object = _("a PDE object");
> -      if (!pic)
> -       pic = _("; recompile with -fPIE");
> +      pic = _("; recompile with -fPIE");
>      }
>
>    /* xgettext:c-format */
> --
> 2.25.1
>

I don't think this is correct.   Please rebase to include this commit:

https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=360f74a101937d1c26e5e0b341043bac6e2d299d

to see why it is incorrect.

-- 
H.J.


More information about the Binutils mailing list