Clang Project

clang_source_code/test/Driver/function-sections.c
1// Test handling of -f(no-)function-sections and -f(no-)data-sections
2//
3// CHECK-FS: -ffunction-sections
4// CHECK-NOFS-NOT: -ffunction-sections
5// CHECK-DS: -fdata-sections
6// CHECK-NODS-NOT: -fdata-sections
7// CHECK-US-NOT: -fno-unique-section-names
8// CHECK-NOUS: -fno-unique-section-names
9
10// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
11// RUN:     -target i386-unknown-linux \
12// RUN:   | FileCheck --check-prefix=CHECK-NOFS --check-prefix=CHECK-NODS %s
13
14// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
15// RUN:     -target i386-unknown-linux \
16// RUN:     -ffunction-sections \
17// RUN:   | FileCheck --check-prefix=CHECK-FS %s
18
19// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
20// RUN:     -target i386-unknown-linux \
21// RUN:     -fno-function-sections \
22// RUN:   | FileCheck --check-prefix=CHECK-NOFS %s
23
24// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
25// RUN:     -target i386-unknown-linux \
26// RUN:     -ffunction-sections -fno-function-sections \
27// RUN:   | FileCheck --check-prefix=CHECK-NOFS %s
28
29// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
30// RUN:     -target i386-unknown-linux \
31// RUN:     -fno-function-sections -ffunction-sections \
32// RUN:   | FileCheck --check-prefix=CHECK-FS %s
33
34// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
35// RUN:     -target i386-unknown-linux \
36// RUN:     -ffunction-sections -fno-function-sections -ffunction-sections \
37// RUN:   | FileCheck --check-prefix=CHECK-FS %s
38
39
40// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
41// RUN:     -target i386-unknown-linux \
42// RUN:     -fdata-sections \
43// RUN:   | FileCheck --check-prefix=CHECK-DS %s
44
45// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
46// RUN:     -target i386-unknown-linux \
47// RUN:     -fno-data-sections \
48// RUN:   | FileCheck --check-prefix=CHECK-NODS %s
49
50// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
51// RUN:     -target i386-unknown-linux \
52// RUN:     -fdata-sections -fno-data-sections \
53// RUN:   | FileCheck --check-prefix=CHECK-NODS %s
54
55// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
56// RUN:     -target i386-unknown-linux \
57// RUN:     -fno-data-sections -fdata-sections \
58// RUN:   | FileCheck --check-prefix=CHECK-DS %s
59
60// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
61// RUN:     -target i386-unknown-linux \
62// RUN:     -fdata-sections -fno-data-sections -fdata-sections \
63// RUN:   | FileCheck --check-prefix=CHECK-DS %s
64
65
66// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1        \
67// RUN:     -target i386-unknown-linux \
68// RUN:     -funique-section-names \
69// RUN:   | FileCheck --check-prefix=CHECK-US %s
70
71// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1        \
72// RUN:     -target i386-unknown-linux \
73// RUN:     -fno-unique-section-names \
74// RUN:   | FileCheck --check-prefix=CHECK-NOUS %s
75