[PATCH v3 07/18] BFD: Make file offset unsigned in archive symbols

Jan Beulich jbeulich@suse.com
Tue Dec 9 14:03:37 GMT 2025


On 20.11.2025 11:56, Maciej W. Rozycki wrote:
> --- binutils-gdb.orig/bfd/elflink.c
> +++ binutils-gdb/bfd/elflink.c
> @@ -6273,13 +6273,13 @@ elf_link_add_archive_symbols (bfd *abfd,
>  
>    do
>      {
> -      file_ptr last;
> +      ufile_ptr last;
>        symindex i;
>        carsym *symdef;
>        carsym *symdefend;
>  
>        loop = false;
> -      last = -1;
> +      last = ~0ULL;

This can go wrong when ufile_ptr is wider than long long. Imo such wants to
be ~0 (or, as before, -1).

> --- binutils-gdb.orig/bfd/linker.c
> +++ binutils-gdb/bfd/linker.c
> @@ -960,7 +960,7 @@ _bfd_generic_link_add_archive_symbols
>        carsym *arsym_end;
>        carsym *arsym;
>        unsigned int indx;
> -      file_ptr last_ar_offset = -1;
> +      ufile_ptr last_ar_offset = ~0ULL;

Same here then. Okay with those adjusted.

Unrelated question: Like me, you look to be using quilt. Could I talk you
into adding

QUILT_NO_DIFF_INDEX=1

to your .quiltrc, so the not really useful Index: lines and the separator
lines following them would go away?

Jan


More information about the Binutils mailing list