Amanieu / naked-function

Proc macro implementation of #[naked]
Apache License 2.0
29 stars 5 forks source link

Fix compile error on arm targets #6

Closed chaten closed 1 year ago

chaten commented 1 year ago

On arm targets (in my case, thumbv6m-none-eabi), compilation fails due to

   |
14 |     #[naked_function::naked]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ could not find `__asm_type` in `$crate`
   |
   = note: this error originates in the macro `::naked_function::__asm_function_begin` which comes from the expansion of the attribute macro `naked_function::naked` (in Nightly builds, run with -Z macro-backtrace for more info)

This resolves the compile error by updating the unused __asm_function_type macro to have the same name as the non-arm macro __asm_type.

Thumb targets should probably also have a .thumb_func directive, but I wasn't able to get it to generate above the label. Even by replacing naked_function with the equivalent global_asm! -- it was always placed after the label. According to the as documentation, thumb_func isn't necessary for eabi targets, so I left that for now.

Amanieu commented 1 year ago

I addressed the .thumb_func issue separately while adding support for #[instruction_set].