Migrate the ARM entry point to global_asm!.#383
Conversation
Building `libtock_runtime` no longer requires an external toolchain. Help Needed ----------- This generates significantly different code for the entry point than the old implementation. I don't have an ARM board to test with, or enough knowledge to understand why the difference exists, so I need help testing/debugging this.
|
D'oh, I should've looked at my own comparison a bit harder before asking for help! When I compared the assembly using The source code uses the I'll push a new commit containing the fix, and remove the request for help from the PR description. I think the request for help should be archived for future reference, so I've copied it into this comment: Archived request for helpThis generates significantly different code for the entry point than the old Disassembly comparisonHere is a comparison of the disassembly of the entry point before and after this PR: |
LLVM doesn't automatically pick the smallest instructions for the add/mov/sub mnemonics like GCC did. This means that moving to global_asm! made `start` larger. This change explicitly names the smaller instructions, and generates code of identical size to the GCC toolchain. There is one remaining difference between the external assembly and this `global_asm!` implementation: LLVM translates `mov r5, r0` into `mov r5, r0`, whereas GCC translated it into `adds r5, r0, #0`.
|
I have not tested this code yet, but the changes look good |
Building
libtock_runtimeno longer requires an external toolchain.There is one instruction that compiles differently after this PR --
mov r5, r0now compiles intomov r5, r0rather thanadds r5, r0, #0. I don't anticipate any issues from this change, but I don't have any way to test it, so help testing this would be appreciated.