-
Notifications
You must be signed in to change notification settings - Fork 722
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 powerpc
target
#814
add powerpc
target
#814
Conversation
I intentionally don't support targets that are currently not supported. In the case of Power, we need to add the proper support to ring (from OpenSSL upstream) to get Power builds working. |
I'm not fan of From my perspective, the assembly code is just a performance optimizing that should be able to degenerate to a pure software implementation, right? Anyway, we could try to migrate those code form the upstream OpenSSL. |
asm_srcs
when target not in ASM_TARGETS
powerpc
target
I will test this as soon as I can. |
I took a rough look at it. There are at least two issues:
The correct way to determine ELFv2 ABI in this case is from your compiler, like this
|
I raised the problem in openssl upstream: openssl/openssl#8858 |
I suggest that we try to take an approach that doesn't require modifying the OpenSSL code. If OpenSSL doesn't support a particular configuration, that's a pretty good indication that that configuration isn't urgent to support, right? |
It is when you don't have a fallback, in OpenSSL you can just disable asm and carry on. It's definitely wrong, I don't see a single reason to carry over incorrect code and break perfectly valid configurations, especially with as much of a pain in the ass as it is to patch rust dependencies downstream, and especially when all it takes is modifying some Perl code. |
Very wrong, for two reasons. One: All remaining, maintained, cared-for PowerPC distros are targeting ELFv2. The fact that OpenSSL doesn't support it yet is because the C fallbacks are performant enough that none of us really care about fixing the asm code at this point. Two: Since OpenSSL does support this configuration with disable-asm, that means it is supported. |
The asm code should be okay by itself, but the perl preprocessor needs to be changed to also use ELFv2 on big endian when requested. The least invasive way would be something like, coming up with a new flavor |
First, it would be useful if people could list ALL the POWER/PowerPC target triples, including the operating system and specific POWER or PowerPC chips that they are interested in, including endianness in particular. In the case of Linux, it would be useful to know which distros you are targetting. |
Also, BoringSSL has a policy of only supporting Little Endian mode. I'm not sure why they have that policy but I do wonder why, if they can get away with that, why we can't too? |
For Linux, these are relevant these days:
additionally The assembly supports 32-bit ppc as well as ppc64, both ELFv1 and ELFv2. The glibc vs musl and linux vs freebsd distinction should not matter if the ABI version is handled correctly. Basically all that is needed to make sure is
As for specific distributions it should not really matter. My distribution where I maintain the ppc64 port (Void Linux) supports both LE and BE, with ELFv2, we have a 32-bit port as well, 32-bit ppc is always BE. Adélie Linux (@awilfox) supports BE on ppc64 and also supports ppc32. Most major Linux distros are little endian, some (Debian) are little endian ELFv2 and big endian ELFv1, and distros like Gentoo let you choose your endianness and ABI. |
boringssl rejects non-LE because it's google and they have their political reasons; don't be as bad as google |
@q66 Which specific chips are you using? Version and vendor? e.g. IBM POWER9? Are you planning to test this PR on all the targets you mentioned? |
We (@AdelieLinux) specifically target We test on many CPUs; currently in our test matrix:
|
I can test on all 64-bit ELFv2 targets (glibc/musl, little endian and big endian) as that's what my distro handles, I'm not handing the 32-bit port and I don't think we have Rust on it at all yet. I'm testing on POWER8 and POWER9. It should be the same for both. (our second maintainer can also test on older powerpc G5 on big endian, should not matter much) |
We would be willing to test the |
It seems like the most transparent thing to do would be to donate test PPC hardware. |
Is @briansmith even accepting donations? Alternatively, there are many different resources for getting access to PowerPC hardware for little or no cost for open source projects. Then Brian wouldn't have to fill his house with hardware. |
I don't think assuming I want to fill someone's house with PowerPC hardware is a very generous interpretation of my comment. Maybe it would be more productive to determine a good protocol for releases. Most platforms find their way into an automated test harness run as part of a release and review process. That seems like the best way to support PowerPC. |
By the way, the OpenSSL assembly code works perfectly fine with ELFv2 big endian. All that's needed is this simple change: dot-asm/cryptogams@50e1ff6 followed by making it actually use the |
Anyway, trying to find the best way to test the C compiler for which perlasm format to use. I need to do a test like this:
The value of Any ideas? (also, @briansmith, did you ever mention why not have support for platform independent fallbacks, so that different OSes can actually use this without having to add separate support for each?) |
There is no |
There is no support for ppc OS X in the code, so you can remove those. Also, it'll be necessary to integrate the |
I have a potential solution for the checks. The
Then we could create a special
Afterwards, in
or something like that anyway. Not exactly like that, as I don't know Rust too well and and that check would probably be best moved out of the loop, but something along those lines. |
One could also apparently use |
Need to add
in
when i try to |
The functions were prefixed with ring/crypto/fipsmodule/ec/ecp_nistz256.c Line 78 in 717d0c2
ring/crypto/fipsmodule/ec/asm/ecp_nistz256-armv8.pl Lines 551 to 554 in 9814ac4
|
I did my own attempt and got a bit further than this pull request, after one workaround I can make the entire testsuite pass on at least ppc64le: #819 |
I think this can probably be closed at this point. #819 is a lot more complete and is currently functional, passing the testsuite OOTB. |
sure, thanks for your help |
Yeah, no problem. I figured it would be faster this way, as I run ppc64 as my primary environment and therefore have machines to test on :) |
When cross compile
ring
forpower
target which not inASM_TARGETS
, thebuild.rs
will crash on unwrap()RustCrypto/hashes#82