Change ARM code to use position independent code#77
Conversation
|
@Araneidae I filter the DiamondLightSource notifications so did not see you had closed my original PR nor the request above, just saw when checking in on this I note that your code does not build <inline asm>:33:8: error: unknown AArch64 fixup kind!
33 | adr lr, action_entry
| ^
1 error generated.I note that the recommendation is to use the changes I had proposed in #76 I suspect you cannot avoid a conditional |
|
Alternatively, you could simply reopen #76 as this is likely the conceptually minimal change-set to address the fundamental issue? |
This is all arising from issue #68 and PR #76. It seems that MacOS Arm64 does not like the use of relocation in the original switch-arm64.c code. This arises from a single instruction ldr lr, =action_entry As action_entry is extremely close to this code this can simply be replaced with adr lr, action_entry for both ARM32 and ARM64.
|
That is interesting and rather annoying. I've done a bit of research, but unfortunately @graeme-winter I'm relying on you to run the tests as I don't actually have access to an OSX AArch64 compiler. The compiler appears to be complaining that it can't compute the relocation for I've also seen a hint that the OSX assembler doesn't actually look forwards when assembling this instruction, which suggests that using an explicit forward reference might work, so I've tried that. Let me know if this works any better. |
It would appear not: <inline asm>:33:8: error: unknown AArch64 fixup kind!
33 | adr lr, .1f
| ^
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1 |
|
Sigh. Ok, I give up, I'll reinstate your branch and merge it. My frustration is that |
This is all arising from issue #68 and PR #76. It seems that MacOS Arm64 does not like the use of relocation in the original switch-arm64.c code. This arises from a single instruction
ldr lr, =action_entry
As action_entry is extremely close to this code this can simply be replaced with
adr lr, action_entry
for both ARM32 and ARM64.
Apologies to @graeme-winter, this obsoletes your PR #76. Unfortunately I have no way to test this. Perhaps you can test this, at least for ARM64?