-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
sparc issue when calling C++ functions which returns >16bytes structure #46679
Comments
I wrote more minimalistic version of test case which rules out use of clang-sys.
On intel it works as expected:
But on sparc it looks weird:
But with this "hack" it looks better:
|
Ok. I'm new to both Rust and LLVM. I tried to create for above example llvm-ir data on intel and used llc to build it on sparc. The same result could be seen. Does it mean that that issue is rather in LLVM?! On intel I did:
On Sparc I did:
The output is bad. See comment above ( [1]
|
https://github.com/rust-lang/rust/blob/master/src/librustc_trans/cabi_sparc64.rs#L27 and https://github.com/rust-lang/rust/blob/master/src/librustc_trans/cabi_sparc64.rs#L53 are wrong; structs up to 32 bytes in size, i.e. 256 bits, are returned in registers. I was also suspicious of this code in general when it was first merged as it doesn't seem very long, and handling mixed float and int structs is a little fiddly. EDIT: Well, actually, |
Can you please suggest how to implement this? I can confirm that when modifying cabi_sparc64.rs to contain 256 my above test examples passes as expected (though Firefox still wouldn't build). |
As mentioned above. With partial fix Firefox build dies later when it calls |
@psumbera Maybe you can suggest a preliminary patch to at least improve the code generation? |
Are you sure? That doesn't entirely control whether a |
Fixes sparc64 cabi fixes. Argument up to 16 bytes size is provided in registers. Return value up to 32 bytes size is stored in registers. Fixes: rust-lang#46679 --- Firefox now (almost) build on sparc. Original rust issue seems to be gone. Note that I'm not rust expert and the fix was suggested in bug.
I have an issue with rust (now version 1.22.1) on Solaris sparc (64bit). On intel I don't see it. I originally see it as part of Firefox build (https://bugzilla.mozilla.org/show_bug.cgi?id=1413887)
I now believe it's rustc issue (though it could be still issue with clang-sys). Any help would be greatly appreciated.
Run output looks like:
Stack:
With tracing:
Note that clang_getTranslationUnitCursor isn't called with 'tu' set to 0.
I have find out that the issue seems to be with the size of CXCursor structure which is returned:
CXCursor clang_getTranslationUnitCursor(CXTranslationUnit TU);
CXCursor is 32 bytes long. But if I tell clang-sys it's 16 bytes everything is perfect (when it's 17 bytes or more it causes the trouble):
Following is disassembly when CXCursor is pretended to be just 16 bytes:
And now with 17 bytes:
The text was updated successfully, but these errors were encountered: