6 #define TEST_COMPILING_TO_FILE
7 #define OUTPUT_KIND GCC_JIT_OUTPUT_KIND_ASSEMBLER
8 #define OUTPUT_FILENAME "output-of-test-link-section-assembler.c.s"
12 create_code (gcc_jit_context
*ctxt
, void *user_data
)
14 /* Let's try to inject the equivalent of:
15 int foo __attribute__((section(".section")));
17 gcc_jit_type
*int_type
=
18 gcc_jit_context_get_type (ctxt
, GCC_JIT_TYPE_INT
);
20 gcc_jit_context_new_global (
21 ctxt
, NULL
, GCC_JIT_GLOBAL_EXPORTED
, int_type
, "foo");
22 gcc_jit_lvalue_set_link_section(foo
, ".my_section");
24 gcc_jit_function
*func_main
=
25 gcc_jit_context_new_function (ctxt
, NULL
,
26 GCC_JIT_FUNCTION_EXPORTED
,
31 gcc_jit_rvalue
*zero
= gcc_jit_context_zero (ctxt
, int_type
);
32 gcc_jit_block
*block
= gcc_jit_function_new_block (func_main
, NULL
);
33 gcc_jit_block_end_with_return (block
, NULL
, zero
);
36 /* { dg-final { jit-verify-output-file-was-created "" } } */
37 /* { dg-final { jit-verify-assembler-output ".section\\s.my_section" } } */