It still works using lower page sizes while also allowing page sizes > 4k
From: Fabian Maurer dark.shadow4@web.de
It still works using lower page sizes while also allowing page sizes > 4k
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52715 --- configure.ac | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/configure.ac b/configure.ac index cba55126869..bee57564983 100644 --- a/configure.ac +++ b/configure.ac @@ -1009,6 +1009,8 @@ This is an error since --enable-archs=$wine_arch was requested.])]) WINE_TRY_PE_CFLAGS([-Wnonnull]) WINE_TRY_PE_CFLAGS([-mcx16]) WINE_TRY_PE_CFLAGS([-mcmodel=small]) ;; + aarch64) WINE_TRY_PE_CFLAGS([-Wl,-section-alignment=65536], + [AS_VAR_APPEND([${wine_arch}_LDFLAGS],[" -Wl,-section-alignment=65536"])]) ;; esac
dnl Determine debug info format
https://github.com/AsahiLinux/docs/wiki/Broken-Software - quotes: "AArch64 machine can use 4K, 16K or 64K pages." "Though the default for AArch64 compilers is to produce ELF files with sections aligned to 64K for compatibility with all AArch64 machines"
It look like mingw is inconsistent with AArch64 standards, I think this should also be addressed with the upstream mingw project too.
Also 16k & 64k page alignment break Wine WoW for x86 binaries, but x86 PE support is out of scope for this PR.
It look like mingw is inconsistent with AArch64 standards, I think this should also be addressed with the upstream mingw project too.
Possibly, not sure how compilers should handle that situation.
Also 16k & 64k page alignment break Wine WoW for x86 binaries, but x86 PE support is out of scope for this PR.
AFAIK there isn't a Wine WoW for x86 on AArch64, correct me if I'm wrong.
It look like mingw is inconsistent with AArch64 standards, I think this should also be addressed with the upstream mingw project too.
First off let's have a look at what MSVC does; MSVC defaults to 4k pages for AArch64. So even if AArch64 in general can have 4k/16k/64k pages, it seems that Windows on AArch64 is not planned to run on anything else than 4k pages.
So for mingw, if it targets producing binaries that run on Windows on aarch64, there's strictly speaking no need for it to produce anything else than 4k pages. However, if targeting producing binaries that run on both actual Windows and Wine, then it could indeed make sense to use 16k or 64k pages. (And it has very little extra ill effects of course.)
I guess changing the default could be reasonable - if you have time, feel free to file an issue at https://github.com/llvm/llvm-project/issues for the lld component, and CC me on it.
So for mingw, if it targets producing binaries that run on Windows on aarch64, there's strictly speaking no need for it to produce anything else than 4k pages. However, if targeting producing binaries that run on both actual Windows and Wine, then it could indeed make sense to use 16k or 64k pages. (And it has very little extra ill effects of course.)
We want Wine to be able to run MSVC-produced binaries (and of course x86 binaries too), which means we have to support 4K pages no matter what. Using a higher alignment for Wine binaries may make things more efficient, but it cannot be a requirement for things to work at all.
On Mon Jan 1 21:51:44 2024 +0000, Alexandre Julliard wrote:
So for mingw, if it targets producing binaries that run on Windows on
aarch64, there's strictly speaking no need for it to produce anything else than 4k pages. However, if targeting producing binaries that run on both actual Windows and Wine, then it could indeed make sense to use 16k or 64k pages. (And it has very little extra ill effects of course.) We want Wine to be able to run MSVC-produced binaries (and of course x86 binaries too), which means we have to support 4K pages no matter what. Using a higher alignment for Wine binaries may make things more efficient, but it cannot be a requirement for things to work at all.
Right, so with that in mind, there's probably no reason to upstream such a change to LLVM - but this patch at hand might make Wine internal components more functional in the short term.
On Mon Jan 1 21:51:44 2024 +0000, Martin Storsjö wrote:
Right, so with that in mind, there's probably no reason to upstream such a change to LLVM - but this patch at hand might make Wine internal components more functional in the short term.
Not exactly sure what you mean. I made this patch because without higher alignment wine can't load those binaries at all. Is this patch okay or is there something to be done?
Any news on this?
This merge request was closed by Alexandre Julliard.
As explained, Wine needs to be able to load 4K-aligned binaries, so this change would only hide the bug.
We may still want to do this at some point if it turns out it improves performance, but only after we've made sure that things work without it.