This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use __USER_LABEL_PREFIX__ in asm statement


On Tue, Jun 7, 2016 at 6:57 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> A target may have a prefix in function symbol.  Update interrrupt tests
> to use __USER_LABEL_PREFIX__ for function symbol in asm statement.
>
> Tested on Linux and Darwin.  OK for trunk?
>
> Thanks.
>
> H.J.
> ----
>         * gcc.dg/guality/pr68037-1.c (ASMNAME): New.
>         (ASMNAME2): Likewise.
>         (main): Replace fn in asm statement with ASMNAME ("fn").
>         * gcc.dg/guality/pr68037-2.c: Likewise.
>         * gcc.dg/guality/pr68037-3.c: Likewise.
>         * gcc.dg/torture/pr68037-1.c: Likewise.
>         * gcc.dg/torture/pr68037-2.c: Likewise.
>         * gcc.dg/torture/pr68037-3.c: Likewise.
>
> diff --git a/gcc/testsuite/gcc.dg/guality/pr68037-1.c b/gcc/testsuite/gcc.dg/guality/pr68037-1.c
> index c3ea645..74f61ec 100644
> --- a/gcc/testsuite/gcc.dg/guality/pr68037-1.c
> +++ b/gcc/testsuite/gcc.dg/guality/pr68037-1.c
> @@ -14,6 +14,8 @@ typedef unsigned int uword_t __attribute__ ((mode (__word__)));
>
>  #define STRING(x)      XSTRING(x)
>  #define XSTRING(x)     #x
> +#define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
> +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
>
>  struct interrupt_frame
>  {
> @@ -53,7 +55,7 @@ main ()
>         push    $" STRING (CS) ";               \
>         push    $" STRING (IP) ";               \
>         push    $" STRING (ERROR) ";            \
> -       jmp     fn");
> +       jmp      " ASMNAME ("fn"));
>    return 0;
>  }
>
> diff --git a/gcc/testsuite/gcc.dg/guality/pr68037-2.c b/gcc/testsuite/gcc.dg/guality/pr68037-2.c
> index 6f7e920..c3cd73d 100644
> --- a/gcc/testsuite/gcc.dg/guality/pr68037-2.c
> +++ b/gcc/testsuite/gcc.dg/guality/pr68037-2.c
> @@ -13,6 +13,8 @@ typedef unsigned int uword_t __attribute__ ((mode (__word__)));
>
>  #define STRING(x)      XSTRING(x)
>  #define XSTRING(x)     #x
> +#define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
> +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
>
>  struct interrupt_frame
>  {
> @@ -49,7 +51,7 @@ main ()
>         push    $" STRING (FLAGS) ";            \
>         push    $" STRING (CS) ";               \
>         push    $" STRING (IP) ";               \
> -       jmp     fn");
> +       jmp      " ASMNAME ("fn"));
>    return 0;
>  }
>
> diff --git a/gcc/testsuite/gcc.dg/guality/pr68037-3.c b/gcc/testsuite/gcc.dg/guality/pr68037-3.c
> index 504a931..6e05472 100644
> --- a/gcc/testsuite/gcc.dg/guality/pr68037-3.c
> +++ b/gcc/testsuite/gcc.dg/guality/pr68037-3.c
> @@ -16,6 +16,8 @@ typedef int aligned __attribute__((aligned(64)));
>
>  #define STRING(x)      XSTRING(x)
>  #define XSTRING(x)     #x
> +#define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
> +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
>
>  struct interrupt_frame
>  {
> @@ -65,7 +67,7 @@ main ()
>         push    $" STRING (FLAGS) ";            \
>         push    $" STRING (CS) ";               \
>         push    $" STRING (IP) ";               \
> -       jmp     fn");
> +       jmp      " ASMNAME ("fn"));
>    return 0;
>  }
>
> diff --git a/gcc/testsuite/gcc.dg/torture/pr68037-1.c b/gcc/testsuite/gcc.dg/torture/pr68037-1.c
> index 15fe08c..23d7c6f 100644
> --- a/gcc/testsuite/gcc.dg/torture/pr68037-1.c
> +++ b/gcc/testsuite/gcc.dg/torture/pr68037-1.c
> @@ -14,6 +14,8 @@ typedef unsigned int uword_t __attribute__ ((mode (__word__)));
>
>  #define STRING(x)      XSTRING(x)
>  #define XSTRING(x)     #x
> +#define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
> +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
>
>  struct interrupt_frame
>  {
> @@ -53,6 +55,6 @@ main ()
>         push    $" STRING (CS) ";               \
>         push    $" STRING (IP) ";               \
>         push    $" STRING (ERROR) ";            \
> -       jmp     fn");
> +       jmp      " ASMNAME ("fn"));
>    return 0;
>  }
> diff --git a/gcc/testsuite/gcc.dg/torture/pr68037-2.c b/gcc/testsuite/gcc.dg/torture/pr68037-2.c
> index 00ba7d4..18f9844 100644
> --- a/gcc/testsuite/gcc.dg/torture/pr68037-2.c
> +++ b/gcc/testsuite/gcc.dg/torture/pr68037-2.c
> @@ -13,6 +13,8 @@ typedef unsigned int uword_t __attribute__ ((mode (__word__)));
>
>  #define STRING(x)      XSTRING(x)
>  #define XSTRING(x)     #x
> +#define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
> +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
>
>  struct interrupt_frame
>  {
> @@ -49,6 +51,6 @@ main ()
>         push    $" STRING (FLAGS) ";            \
>         push    $" STRING (CS) ";               \
>         push    $" STRING (IP) ";               \
> -       jmp     fn");
> +       jmp      " ASMNAME ("fn"));
>    return 0;
>  }
> diff --git a/gcc/testsuite/gcc.dg/torture/pr68037-3.c b/gcc/testsuite/gcc.dg/torture/pr68037-3.c
> index abf8adb..86324f1 100644
> --- a/gcc/testsuite/gcc.dg/torture/pr68037-3.c
> +++ b/gcc/testsuite/gcc.dg/torture/pr68037-3.c
> @@ -16,6 +16,8 @@ typedef int aligned __attribute__((aligned(64)));
>
>  #define STRING(x)      XSTRING(x)
>  #define XSTRING(x)     #x
> +#define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
> +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
>
>  struct interrupt_frame
>  {
> @@ -65,6 +67,6 @@ main ()
>         push    $" STRING (FLAGS) ";            \
>         push    $" STRING (CS) ";               \
>         push    $" STRING (IP) ";               \
> -       jmp     fn");
> +       jmp      " ASMNAME ("fn"));
>    return 0;
>  }

I will check in it to fix the testcases I added.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]