Page MenuHomeFreeBSD

Expose the ILP32/LP64 programming environments based on __ILP32__/__LP64__ instead of by architecture.
ClosedPublic

Authored by ngie on May 18 2017, 6:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 9 2024, 3:42 AM
Unknown Object (File)
Jan 2 2024, 7:09 PM
Unknown Object (File)
Dec 23 2023, 10:55 AM
Unknown Object (File)
Dec 18 2023, 4:08 PM
Unknown Object (File)
Oct 20 2023, 11:43 AM
Unknown Object (File)
Oct 19 2023, 3:00 PM
Unknown Object (File)
Oct 13 2023, 7:40 PM
Unknown Object (File)
Oct 12 2023, 10:09 PM
Subscribers

Details

Summary

Expose the ILP32/LP64 programming environments based on __ILP32__/__LP64__ instead of by architecture.

The list was incomplete (previous commits purged invalid architectures, like __alpha__, but failed to add new ones). It's best to base the symbol presence on whether or not the architecture is ILP32 / LP64 capable, per the compiler.

This fixes the ILP32/LP64 program environments on arm64.

MFC after: 1 month
Sponsored by: Dell EMC Isilon

Test Plan

Ran kyua tests on amd64 and i386 without issue.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.May 18 2017, 6:55 AM
imp requested changes to this revision.May 18 2017, 6:57 AM

Actually I think I take that back... mips and arm aren't listed at all. Are they affected?

This revision now requires changes to proceed.May 18 2017, 6:57 AM
ngie retitled this revision from Expose ILP32/LP64 symbols based on __ILP32__/__LP64__ instead of by architecture to Expose the ILP32/LP64 programming environments based on __ILP32__/__LP64__ instead of by architecture..May 18 2017, 6:58 AM
ngie edited the summary of this revision. (Show Details)

Only arm64 exposes __ILP32__ and __LP64__ (depending on whether or not it's 32-bit or 64-bit), per a quick grep of contrib/gcc and contrib/llvm .

ngie added a reviewer: andrew.
ngie edited the summary of this revision. (Show Details)
In D10787#223484, @ngie wrote:

Only arm64 exposes __ILP32__ and __LP64__ (depending on whether or not it's 32-bit or 64-bit), per a quick grep of contrib/gcc and contrib/llvm .

All the architectures do. We use it elsewhere in the tree and it works. Your grep has lead you astray.

contrib/gcc/config/i386/freebsd64.h: builtin_define ("LP64"); \
contrib/gcc/config/rs6000/freebsd.h: builtin_define ("LP64"); \
contrib/gcc/config/sparc/freebsd.h: builtin_define ("LP64"); \

are just three examples.

What I'm wondering about thought is why aren't arm and mips in this list at all? And why does powerpc assume 32 bit?

In D10787#223634, @imp wrote:
In D10787#223484, @ngie wrote:

Only arm64 exposes __ILP32__ and __LP64__ (depending on whether or not it's 32-bit or 64-bit), per a quick grep of contrib/gcc and contrib/llvm .

All the architectures do. We use it elsewhere in the tree and it works. Your grep has lead you astray.

contrib/gcc/config/i386/freebsd64.h: builtin_define ("LP64"); \
contrib/gcc/config/rs6000/freebsd.h: builtin_define ("LP64"); \
contrib/gcc/config/sparc/freebsd.h: builtin_define ("LP64"); \

are just three examples.

I meant to say "only arm64 exposes it, in addition to the other architectures currently handled".

What I'm wondering about thought is why aren't arm and mips in this list at all? And why does powerpc assume 32 bit?

Beats me why arm/mips were never considered, but there is an issue potentially with how __ILP32__, __LP32__, and __LP64__ are defined on those architectures.

This review specifically addresses the hardcoded have_<FOO> for LP64 and ILP32 that was incorrect (maybe not when this was first written, but wasn't correct after additional architectures were added).

What ILP32/LP32/LP64 are is a different topic discussed more at length here: http://www.unix.org/whitepapers/64bit.html (this is what I was looking for -- it helps because I personally didn't understand the nuances between ILP32 and LP32, until I read the whitepaper).

In D10787#224240, @ngie wrote:
In D10787#223634, @imp wrote:
In D10787#223484, @ngie wrote:

Only arm64 exposes __ILP32__ and __LP64__ (depending on whether or not it's 32-bit or 64-bit), per a quick grep of contrib/gcc and contrib/llvm .

All the architectures do. We use it elsewhere in the tree and it works. Your grep has lead you astray.

contrib/gcc/config/i386/freebsd64.h: builtin_define ("LP64"); \
contrib/gcc/config/rs6000/freebsd.h: builtin_define ("LP64"); \
contrib/gcc/config/sparc/freebsd.h: builtin_define ("LP64"); \

are just three examples.

I meant to say "only arm64 exposes it, in addition to the other architectures currently handled".

What I'm wondering about thought is why aren't arm and mips in this list at all? And why does powerpc assume 32 bit?

Beats me why arm/mips were never considered, but there is an issue potentially with how __ILP32__, __LP32__, and __LP64__ are defined on those architectures.

This review specifically addresses the hardcoded have_<FOO> for LP64 and ILP32 that was incorrect (maybe not when this was first written, but wasn't correct after additional architectures were added).

Correct, and my point, which I've not yet gotten an answer to, is that it pulls in several new architectures into defining have_ILP32_OFFBIG (adding 32-bit mips, risc V, and 32-bit arm) and have_LP64_OFF64 (adding arm64 and mips64). Why did they work before? Or do you need to make adjustments elsewhere to get them to build now? Have they been tested?

What ILP32/LP32/LP64 are is a different topic discussed more at length here: http://www.unix.org/whitepapers/64bit.html (this is what I was looking for -- it helps because I personally didn't understand the nuances between ILP32 and LP32, until I read the whitepaper).

Yea, we have no LP32 architectures, so you can ignore that. All our archs have 32-bit ints.

In D10787#224323, @imp wrote:
In D10787#224240, @ngie wrote:
In D10787#223634, @imp wrote:
In D10787#223484, @ngie wrote:

Only arm64 exposes __ILP32__ and __LP64__ (depending on whether or not it's 32-bit or 64-bit), per a quick grep of contrib/gcc and contrib/llvm .

All the architectures do. We use it elsewhere in the tree and it works. Your grep has lead you astray.

contrib/gcc/config/i386/freebsd64.h: builtin_define ("LP64"); \
contrib/gcc/config/rs6000/freebsd.h: builtin_define ("LP64"); \
contrib/gcc/config/sparc/freebsd.h: builtin_define ("LP64"); \

are just three examples.

I meant to say "only arm64 exposes it, in addition to the other architectures currently handled".

What I'm wondering about thought is why aren't arm and mips in this list at all? And why does powerpc assume 32 bit?

Beats me why arm/mips were never considered, but there is an issue potentially with how __ILP32__, __LP32__, and __LP64__ are defined on those architectures.

This review specifically addresses the hardcoded have_<FOO> for LP64 and ILP32 that was incorrect (maybe not when this was first written, but wasn't correct after additional architectures were added).

Correct, and my point, which I've not yet gotten an answer to, is that it pulls in several new architectures into defining have_ILP32_OFFBIG (adding 32-bit mips, risc V, and 32-bit arm) and have_LP64_OFF64 (adding arm64 and mips64). Why did they work before? Or do you need to make adjustments elsewhere to get them to build now? Have they been tested?

I don't genuinely know if they ever worked before. This functionality is somewhat obscure -- I ran into it purely because I wanted to add some tests for this program (in this case to exercise the -v flag), and in order to do so, I needed to know what was available (because unfortunately the documentation was very lacking). I ran into this and grew confused with the hardcoded list of architectures, because it seemed that this functionality had indeed been broken for some architectures that should support it.

In D10787#224691, @ngie wrote:

...

I don't genuinely know if they ever worked before. This functionality is somewhat obscure -- I ran into it purely because I wanted to add some tests for this program (in this case to exercise the -v flag), and in order to do so, I needed to know what was available (because unfortunately the documentation was very lacking). I ran into this and grew confused with the hardcoded list of architectures, because it seemed that this functionality had indeed been broken for some architectures that should support it.

Hi Warner: do you have any valid concerns about this change, or is it ok if I commit this?

In D10787#227340, @ngie wrote:

...

Hi Warner: do you have any valid concerns about this change, or is it ok if I commit this?

I'm going to commit this change in 3 days if I don't hear anything from the reviewers.