https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25967

--- Comment #12 from Daniel Santos <daniel.santos at pobox dot com> ---
For those interested in a work-around, you can define an __attribute__((used))
function and then within that function use inline assembly to declare your real
function.  This can get messy depending upon how portable you need you your
code to be, here is an example:

static void __attribute__((used)) dummy ()
{
  __asm__ ("\n"
        "       .globl myfunc\n"
#ifdef __ELF__
        "       .type myfunc,@function\n"
#endif
        "myfunc:\n"
        "       <your assembly here>\n"
        "       ret\n   # you must do your own ret.\n"
  )
}

I used this in the ms to system v function call tests:
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c#L172

Reply via email to