AArch64 ILP32 strcmp bug

Keith Packard keithp@keithp.com
Fri Nov 27 05:35:19 GMT 2020


Richard Earnshaw <Richard.Earnshaw@foss.arm.com> writes:

> AFAICT gcc doesn't define __LP64__, so I don't think this will work;
> it's also backwards - you shouldn't assume that because __LP64__ isn't
> defined that we have a 32-bit pointer.  GCC does, however, define
> __ILP32__ when building for that ABI.

I borrowed that symbol from glibc; figuring it was better to use a
mechanism already in use elsewhere.

> The right way to do this is to create a new header file,
> machine/aarch64/machine/asm.h, which contains a gas macro called, lets
> say `ptr_param', that takes the *number* of register argument and is
> then conditionally defined to either nothing or an assembly statement
> that narrows the register with that number.  In the main function code
> you can then write simply
>
> 	ptr_param 0
>
> and avoid all conditional assembly in the main source files.

Yes, it would be good to see all of the asm code fixed up to work on
ilp32. For now, just getting setjmp/longjmp working and bypassing all of
the other aarch64 asm code on ilp32 will suffice to make the library
work. I've got an aarch64 toolchain with ilp32 support built. Figuring
out how to catch errors of this particular sort seems challenging
though; the bug report makes it clear that even the incorrect functions
work most of the time.

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/newlib/attachments/20201126/15656938/attachment.sig>


More information about the Newlib mailing list