use copy_private_symbol_data in objcopy
Checks
Commit Message
osympp appearing twice here is not a bug.
PR 14493
* objcopy.c (copy_object): Run the symbols through
bfd_copy_private_symbol_data.
Comments
On Tue, Apr 23, 2024 at 4:42 AM Alan Modra <amodra@gmail.com> wrote:
>
> osympp appearing twice here is not a bug.
>
> PR 14493
> * objcopy.c (copy_object): Run the symbols through
> bfd_copy_private_symbol_data.
>
> diff --git a/binutils/objcopy.c b/binutils/objcopy.c
> index d91ba123c01..634ebae3fc3 100644
> --- a/binutils/objcopy.c
> +++ b/binutils/objcopy.c
> @@ -3380,6 +3380,13 @@ 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++)
This failed to compile with GCC 14 on 32-bit hosts:
/export/gnu/import/git/sources/binutils-gdb/binutils/objcopy.c: In
function ‘copy_object’:
/export/gnu/import/git/sources/binutils-gdb/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++)
| ^
> + if (!bfd_copy_private_symbol_data (ibfd, osympp[i], obfd, osympp[i]))
> + {
> + status = 1;
> + return false;
> + }
> +
> if (dhandle != NULL)
> {
> bool res;
>
> --
> Alan Modra
> Australia Development Lab, IBM
@@ -3380,6 +3380,13 @@ 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]))
+ {
+ status = 1;
+ return false;
+ }
+
if (dhandle != NULL)
{
bool res;