On Tue, Feb 07, 2017 at 04:03:01PM +0000, Mark Rutland wrote:
> For x86 it's a little painful due to '%' in the register names, but it looks
> possible. The below appears to do the mangling correctly (then screams due to
> the mangled result being nonexistent).

> asm(
> "     .macro  reg_to_offset   r\n"
> "     .irp rs,eax,ebx,ecx,edx\n"
> "     .ifc \\r, %\\rs\n"
> "     __offset_of_\\rs\n"
> "     .endif\n"
> "     .endr\n"
> "     .endm\n"
> );
> 
> #define asm_sym(var)          asm volatile("reg_to_offset %0\n" : : "r" (var))

Oh gawd that's a most gnarly hack.

Do we want to go do that for all archs or somehow cook a generic
fallback that ends up doing a full function call or something?

Reply via email to