aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.test-framework/dg-scan-symbol-section-exp-P.S
blob: 4e7df419651fb192256a57a3b07a004f3fc08127 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Test the scan-symbol-section directive.

// { dg-do preprocess }

// The .section directive changes the section for all following symbols.
    .section .text
// { dg-final { scan-symbol-section "dg-scan-symbol-section-exp-P.i" {^_test_function_1$} {^\.text$} } }
_test_function_1:
// { dg-final { scan-symbol-section "dg-scan-symbol-section-exp-P.i" {^_test_function_2$} {^\.text$} } }
_test_function_2:

// For ELF targets, the .section directive can take multiple arguments.
    .section .other_text_section,"ax",progbits
// { dg-final { scan-symbol-section "dg-scan-symbol-section-exp-P.i" {^_test_elf_function$} {^\.other_text_section$} } }
_test_elf_function:

// For Mach-O targets, the .section directive takes a segment name and a section name.
    .section __TEXT,__my_text_section
// { dg-final { scan-symbol-section "dg-scan-symbol-section-exp-P.i" {^_test_macho_function$} {^__TEXT,__my_text_section$} } }
_test_macho_function:
// Extra whitespace between .section arguments should be ignored.
    .section  __DATA , __testsection
// { dg-final { scan-symbol-section "dg-scan-symbol-section-exp-P.i" {^_test_macho_var$} {^__DATA,__testsection$} } }
_test_macho_var:

// The .data directive sets the section for all following symbols to '.data'.
// { dg-final { scan-symbol-section "dg-scan-symbol-section-exp-P.i" {^_test_var_1$} {^\.data$} } }
    .data
_test_var_1:

// The .text directive sets the section for all following symbols to '.text'.
// { dg-final { scan-symbol-section "dg-scan-symbol-section-exp-P.i" {^_test_function_3$} {^\.text$} } }
    .text
_test_function_3:

// The .const directive sets the section for all following symbols to '.const'.
// { dg-final { scan-symbol-section "dg-scan-symbol-section-exp-P.i" {^_test_data_1$} {^\.const$} } }
    .const
_test_data_1:

// Other directives do not affect the section of following symbols.
// { dg-final { scan-symbol-section "dg-scan-symbol-section-exp-P.i" {^_test_var_2$} {^\.data$} } }
    .data
    .p2align 2
    .size _test_var_2, 4
_test_var_2:

// Symbol name patterns can match multiple symbols, and section name patterns
// can match multiple sections.
// { dg-final { scan-symbol-section "dg-scan-symbol-section-exp-P.i" {^_test_function_} {^(\.|__TEXT,).*text} } }