1 /* { dg-do compile { target x86_64-*-* } } */
2 /* { dg-require-alias "" } */
9 #define TEST_COMPILING_TO_FILE
10 #define OUTPUT_KIND GCC_JIT_OUTPUT_KIND_ASSEMBLER
11 #define OUTPUT_FILENAME "output-of-test-alias-attribute.c.s"
15 create_code (gcc_jit_context
*ctxt
, void *user_data
)
17 /* Let's try to inject the equivalent of:
20 void f () __attribute__ ((alias ("xxx")));
22 gcc_jit_type
*void_type
=
23 gcc_jit_context_get_type (ctxt
, GCC_JIT_TYPE_VOID
);
25 /* Creating the `xxx` function. */
26 gcc_jit_function
*xxx_func
=
27 gcc_jit_context_new_function (ctxt
, NULL
,
28 GCC_JIT_FUNCTION_EXPORTED
,
34 /* Creating the `f` function. */
35 gcc_jit_function
*f_func
=
36 gcc_jit_context_new_function (ctxt
, NULL
,
37 GCC_JIT_FUNCTION_IMPORTED
,
42 gcc_jit_function_add_string_attribute(f_func
, GCC_JIT_FN_ATTRIBUTE_ALIAS
, "xxx");
45 gcc_jit_block
*block
= gcc_jit_function_new_block (xxx_func
, NULL
);
46 gcc_jit_block_end_with_void_return (block
, NULL
);
49 /* { dg-final { jit-verify-output-file-was-created "" } } */
50 /* Check that the attribute was applied correctly */
51 /* { dg-final { jit-verify-assembler-output ".set\\s+f,xxx" } } */