Hello list, I have been working on improving the x32 support in LLVM. Currently, LLVM has wrong code bugs, a libcxx bug, missing JIT support, some general assumptions that happen to hold for all other ABIs but not for x32, but also some tests that do not make sense for multiple ABIs, including x32, and are suppressed for multiple ABIs, but not x32. I have patched LLVM 11.0.0 to a good enough state where the tests that do not make sense are disabled, and the rest of the tests pass when built for x32. Additionally, when those same changes are applied to Rust's LLVM, they allow building Rust for x32 as well (after also fixing some non-LLVM portability issues in Rust). For the moment, I have put this up as a single massive commit, <https://github.com/hvdijk/llvm-project/commit/07c7cd28df079c6dce02f5d7ebba58c8f85039b7>. I intend to split this into separate smaller commits with clear commit messages explaining what they do, rebase it onto master, and submit individual patches when they are ready. However, I felt it would also be good to put up my current work in case anyone else is interested as well. Feedback is welcome, especially suggestions for different approaches for any of the issues addressed by this. Cheers, Harald van Dijk
John Paul Adrian Glaubitz via llvm-dev
2020-Oct-24 15:30 UTC
[llvm-dev] Improving x32 support
Hi Harald! On 10/24/20 5:15 PM, Harald van Dijk via llvm-dev wrote:> I have been working on improving the x32 support in LLVM.I haven't checked your changes yet, hence I'm asking right away: Do you also have a fix for the search paths for the driver? [1] I tried to contribute that change back then but somehow the discussion ceased at some point.> I have patched LLVM 11.0.0 to a good enough state where the tests that do not make sense > are disabled, and the rest of the tests pass when built for x32. Additionally, when those > same changes are applied to Rust's LLVM, they allow building Rust for x32 as well (after also > fixing some non-LLVM portability issues in Rust).Ah, that's nice. Then we can finally bootstrap Rust for Debian/x32. Great work! Do you have the fixes for Rust somewhere accessible?> For the moment, I have put this up as a single massive commit, > <https://github.com/hvdijk/llvm-project/commit/07c7cd28df079c6dce02f5d7ebba58c8f85039b7>.I'll have a look and see if we can already use it in Debian. In any case, thanks a lot for fixing this! Much appreciated! Adrian> [1] https://reviews.llvm.org/D52050-- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaubitz at debian.org `. `' Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Hi Adrian, On 24/10/2020 16:30, John Paul Adrian Glaubitz wrote:> Hi Harald! > > On 10/24/20 5:15 PM, Harald van Dijk via llvm-dev wrote: >> I have been working on improving the x32 support in LLVM. > > I haven't checked your changes yet, hence I'm asking right away: Do you also have a fix > for the search paths for the driver? [1] I tried to contribute that change back then but > somehow the discussion ceased at some point.I merely added x86_64-pc-linux-gnux32 to X86_64Triples, sorry. The /usr/include/x86_64-linux-gnux32 and /usr/lib/x86_64-linux-gnux32 directories are specific to Debian and not present on my system, so I did not need to make changes to support them to get things to work.>> I have patched LLVM 11.0.0 to a good enough state where the tests that do not make sense >> are disabled, and the rest of the tests pass when built for x32. Additionally, when those >> same changes are applied to Rust's LLVM, they allow building Rust for x32 as well (after also >> fixing some non-LLVM portability issues in Rust). > > Ah, that's nice. Then we can finally bootstrap Rust for Debian/x32. Great work! > > Do you have the fixes for Rust somewhere accessible?I have not pushed these anywhere, but I went over my list of changes for Rust 1.47.0, and actually all of them are just changing #[cfg(target_arch = "x86_64")] to #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] in checks for various structure sizes, where the values being checked are only meant to apply to x86_64-linux-gnu, not x86_64-linux-gnux32.>> For the moment, I have put this up as a single massive commit, >> <https://github.com/hvdijk/llvm-project/commit/07c7cd28df079c6dce02f5d7ebba58c8f85039b7>. > > I'll have a look and see if we can already use it in Debian. > > In any case, thanks a lot for fixing this! Much appreciated! > > Adrian > >> [1] https://reviews.llvm.org/D52050 >