Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Large Memory Model on AIX 32-bit #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vchaves123
Copy link

32-bit executables on AIX need to increase the address space to allow more than 256MB RAM.
It would be nice if this was available out of box.

@Larhzu
Copy link
Member

Larhzu commented Sep 3, 2024 via email

@vchaves123
Copy link
Author

Hello Lasse,
my setup consists of the GCC 10 compiler and the native IBM linker. I wouldn't be able to say if the GNU linker supports the maxdata flag.

Yes, I saw the notes about AIX in the INSTALL file, but they apply to those who use the paid IBM xlc compiler and need to use the xlc_r binary for programs that make use of the pthreads library.

My knowledge of autoconf is limited, but it seems to me that using sizeof is perfectly viable.
In fact, the most correct pseudo logic should be:

if AIX and sizeof=4 and GCC and IBM ld
then
set LDFLAGS

Again, it would be great to see the old AIX supported out of the box, but the best course of action is up to your discretion.

Sincerely,
Vicente.

@Larhzu
Copy link
Member

Larhzu commented Sep 6, 2024

I'm curious, how old AIX and hardware is it that 64-bit binaries aren't possible (or practical)?

PostgreSQL's platform-specific notes mention address space configuration on 32-bit AIX. Python mentions maxdata in README.AIX. It seems that these packages don't set the option by default.

Maybe setting this option by default could make sense but it's also a topic that people building on AIX will encounter with other packages too. Thus, it's somewhat likely that people are (or will be) aware of this special case on 32-bit AIX. Special handling in one package (xz) might have unwanted effects when experienced packagers are used to setting the option themselves, although perhaps this isn't a very likely problem.

This PR suggests using -Wl,-bmaxdata:0x80000000. Reading AIX 7.3 docs, that seems to allow 2 GiB of address space using large address-space model. But -Wl,-bmaxdata:0xD0000000/dsa would allow 3.25 GiB using very large address-space model. Shouldn't the latter be recommended? Or is it not available in old AIX versions? AIX 7.1 docs mention it still and 7.1 support ended in 2023.

The docs say that values higher than 0xAFFFFFFF have a downside of not sharing memory of shared libraries. So perhaps 0xD0000000 isn't ideal here. I don't have much clue because I haven't used AIX. 0xAFFFFFFF would still be 2.75 GiB.

It shouldn't be too hard to autodetect if the option is supported by just checking if linking works with those LDFLAGS. One would need to verify that user-defined LDFLAGS would always override the default value. But right now I feel it's enough to give a clue about this in INSTALL. How about:

If building a 32-bit executable, the address space available for xz might be limited to 256 MiB. To allow 2.75 GiB address space, pass LDFLAGS='-Wl,-bmaxdata:0xAFFFFFFF/dsa' as an argument to configure. For more information, see "Large program support" in the AIX documentation. For example, AIX 7.3 documentation is available at the following address (the link was checked on 2024-09-06):

https://www.ibm.com/docs/en/aix/7.3?topic=concepts-large-program-support

Improvement ideas for the text are welcome. I suppose the main question is, what value to suggest by default. If you have a 400-megabyte file, compressing it with xz -9 -T2 should work with 0xAFFFFFFF but not with 0x80000000. Can you test this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants