[Toybox] [PATCH] readelf: fix 32-bit build on Android.

enh enh at google.com
Wed May 19 16:00:05 PDT 2021


ptrdiff_t is int rather than long on 32-bit x86 (which is where i happened
to test first; i didn't get as far as arm32), and the compiler doesn't care
that int==long on ILP32 (presumably to help ILP32-first folks from
introducing bugs that only bite LP64 users?).

On Wed, May 19, 2021 at 3:50 PM Rob Landley <rob at landley.net> wrote:

> On 5/19/21 12:46 PM, enh via Toybox wrote:
> >
> > ---
> >  toys/other/readelf.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/toys/other/readelf.c b/toys/other/readelf.c
> > index 45afd83a..29e27244 100644
> > --- a/toys/other/readelf.c
> > +++ b/toys/other/readelf.c
> > @@ -57,7 +57,7 @@ static long long elf_get(char **p, int len)
> >    long long result;
> >
> >    if (*p+len-TT.elf>TT.size)
> > -    perror_exit("Access off end: %ld[%d] of %lld\n", *p-TT.elf, len,
> TT.size);
> > +    perror_exit("Access off end: %td[%d] of %lld\n", *p-TT.elf, len,
> TT.size);
>
> Applied, but you do realize it's the same everywhere except Windows,
> right? (LP64.)
>
> Rob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20210519/f3e0fab7/attachment-0001.htm>


More information about the Toybox mailing list