Page MenuHomeFreeBSD

arch.7: deprecate __ILP32__ and __LP64__ macros
ClosedPublic

Authored by brooks on Wed, Oct 1, 9:39 AM.
Tags
None
Referenced Files
F132013843: D52820.id163414.diff
Sun, Oct 12, 11:10 PM
F132013831: D52820.id163751.diff
Sun, Oct 12, 11:10 PM
F132013807: D52820.id163446.diff
Sun, Oct 12, 11:10 PM
F132013738: D52820.id163685.diff
Sun, Oct 12, 11:09 PM
Unknown Object (File)
Sun, Oct 12, 12:45 AM
Unknown Object (File)
Sun, Oct 12, 12:44 AM
Unknown Object (File)
Sun, Oct 12, 12:44 AM
Unknown Object (File)
Sat, Oct 11, 3:14 PM

Details

Summary

With CHERI there now more options than ILP32 and LP64 so lack of
one does not imply the other. Encourage the use of SIZEOF_* macro
tests in their place.

Sponsored by: Innovate UK

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Are ILP32/LP64 undefined for cheri? If yes, I think that this should be explicitly mentioned, and in fact these macros are still useful, to exclude the outliers from regular arches.

Attempt to approve wording around continued use of ILP32 and LP64.

So are ILP32/LP64 defined for cheri? If not, please mention it explicitly.

Be explicit that the compiler does not define LP64 on CHERI
architectures. Don't bother mentioning ILP32 as FreeBSD will never
support 32-bit CHERI.

FWIW, we do currently add __LP64__ to CFLAGS in bsd.cpu.mk has a hack because there's a lot of code of the form:

#ifdef __LP64__
// 64-bit stuff
#else 
// 32-bit stuff
#endif

and we haven't cleaned it all up yet. The goal here is to get people stop adding more. It is usually less wrong to write:

#ifdef __ILP32__
// 32-bit stuff
#else 
// 64-bit stuff
#endif

since much of the time a the 64-bit stuff isn't about pointer size.

Latest update doesn't seem to include the mentioned change.

Actully add previous change I guess I hadn't rebased

This revision is now accepted and ready to land.Fri, Oct 3, 3:54 PM
jhb added inline comments.
share/man/man7/arch.7
346
357

Or perhaps "test only one"

361

Do we want to word this more strongly? Something like:

With the arrival of CHERI architectures, this is no longer the case.
.Dv __SIZEOF_*__
macros should be used instead.
New uses of
.Dv __ILP32__
and
.Dv __LP64__
should be avoided.
share/man/man7/arch.7
361

Since cheri does not define either ILP32 nor LP64, both macros become esp. useful in fact.

jrtc27 added inline comments.
share/man/man7/arch.7
361

No, if you want to ask "is not CHERI" then ask "is not CHERI". Don't use "is ILP32 or LP64" as a proxy for "is not CHERI". ILP32 and LP64 should only be used when you specifically want to check for that exact ABI's combination of types; anything else and you should be more precise and query the properties you actually care about (whether size of long, size of pointer, CHERI or not, etc).

Corrections and suggestions from @jhb

This revision now requires review to proceed.Tue, Oct 7, 9:39 AM
This revision is now accepted and ready to land.Tue, Oct 7, 1:39 PM