[Bug target/25967] Add attribute naked for x86

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Jul 30 16:08:00 GMT 2017


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

--- Comment #14 from Uroš Bizjak <ubizjak at gmail dot com> ---
I'm testing the above patch. Using the patched compiler, the testcase that is
mentioned by Daniel in Comment #12 can be changed to:

Index: testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c
===================================================================
--- testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c   (revision 250720)
+++ testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c   (working copy)
@@ -169,15 +169,9 @@

 #define TEST_DATA_OFFSET(f)    ((int)__builtin_offsetof(struct test_data, f))

-void __attribute__((used))
-do_test_body0 (void)
-{
-  __asm__ ("\n"
-       "       .globl " ASMNAME(do_test_body) "\n"
-#ifdef __ELF__
-       "       .type " ASMNAME(do_test_body) ",@function\n"
-#endif
-       ASMNAME(do_test_body) ":\n"
+void __attribute__((naked))
+do_test_body (void)
+{__asm__ (
        "       # rax, r10 and r11 are usable here.\n"
        "\n"
        "       # Save registers.\n"
@@ -212,9 +206,6 @@
        "       call    " ASMNAME(mem_to_regs) "\n"
        "\n"
        "       retq\n"
-#ifdef __ELF__
-       "       .size " ASMNAME(do_test_body) ",.-" ASMNAME(do_test_body) "\n"
-#endif
        ::
        "i"(TEST_DATA_OFFSET(regdata[REG_SET_SAVE])),
        "i"(TEST_DATA_OFFSET(regdata[REG_SET_INPUT])),


More information about the Gcc-bugs mailing list