c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / jit.dg / test-link-section-assembler.c
bloba78e9fd26effddac601d05f84427ce555e898e51
1 #include <stdlib.h>
2 #include <stdio.h>
4 #include "libgccjit.h"
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"
9 #include "harness.h"
11 void
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);
19 gcc_jit_lvalue *foo =
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,
27 int_type,
28 "main",
29 0, NULL,
30 0);
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" } } */