-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[JITLINK]Fix endiannes issue with MachO_ptrauth_noolloc_sections.yaml #167902
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
Conversation
|
@lhames after enabling JITLink tests on SystemZ, one MachO test started failing. It looks like JITLink doesn't take relocation endianness into account like the main MachO code does - can you have a look at this PR? |
|
@uweigand This is unexpected: MachO::any_relocation_info ARI =
getObject().getRelocation(RelItr->getRawDataRefImpl());
MachO::relocation_info RI;
llvm-project/llvm/lib/Object/MachOObjectFile.cpp Line 4824 in 4fe79a7
getStruct performing the swap here:
Given that it is a yaml test that is failing I suspect that the endianness issue is in the MachO YAML reader / writer. |
|
@lhames , yes, a byte-swap is already happening. However, there's apparently also an endian-dependent bitfield difference that is not handled automatically. If you look at the full code in This calls calls which gets different bits depending on target endianness. This latter part is not currently not by the JITLink code. |
Oh, of course! Thanks for pointing that out. I want to avoid any external calls and further dependence on |
|
Scratch that -- I just got LLVM building on ppc64be to test this out and my "fix" breaks other test cases. I should have an update shortly. |
The "MachO_ptrauth_noolloc_sections.yaml" testcase had a typo in the name, and didn't explicitly specify its endianness. This was causing it to fail when enabled on big endian platforms. See conversation in llvm#167902
|
Previous PR was a bum steer. I believe that the "bitfields" in this struct have the same layout in both endiannesses (see comment at https://github.com/apple-oss-distributions/cctools/blob/920a2b45080fb9badf31bf675f03b19973f0dd4f/include/mach-o/reloc.h#L140). I think the real fix for this is #168323 |
|
#168323 has been merged. If that fixes your issue then I think that we can close this. |
…testcase. (#168323) The "MachO_ptrauth_noolloc_sections.yaml" testcase had a typo in the name, and didn't explicitly specify its endianness. This was causing it to fail when enabled on big endian platforms. See conversation in llvm/llvm-project#167902
Yes, this does indeed fix the issue for us. Thanks! |
Fix endianness issue with MachO_ptrauth_noolloc_sections.yaml relocations. Semantics of the r_word1 field is different depending on the endianness.