xref: /aosp_15_r20/external/clang/test/CodeGen/function-sections.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // REQUIRES: x86-registered-target
2*67e74705SXin Li 
3*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -o - < %s | FileCheck %s --check-prefix=PLAIN
4*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -ffunction-sections -fno-function-sections -o - < %s | FileCheck %s --check-prefix=PLAIN
5*67e74705SXin Li 
6*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -ffunction-sections -o - < %s | FileCheck %s --check-prefix=FUNC_SECT
7*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fno-function-sections -ffunction-sections -o - < %s | FileCheck %s --check-prefix=FUNC_SECT
8*67e74705SXin Li 
9*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fdata-sections -o - < %s | FileCheck %s --check-prefix=DATA_SECT
10*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fno-data-sections -fdata-sections -o - < %s | FileCheck %s --check-prefix=DATA_SECT
11*67e74705SXin Li 
12*67e74705SXin Li const int hello = 123;
world()13*67e74705SXin Li void world() {}
14*67e74705SXin Li 
15*67e74705SXin Li // PLAIN-NOT: section
16*67e74705SXin Li // PLAIN: world:
17*67e74705SXin Li // PLAIN: section .rodata,
18*67e74705SXin Li // PLAIN: hello:
19*67e74705SXin Li 
20*67e74705SXin Li // FUNC_SECT: section .text.world,
21*67e74705SXin Li // FUNC_SECT: world:
22*67e74705SXin Li // FUNC_SECT: section .rodata,
23*67e74705SXin Li // FUNC_SECT: hello:
24*67e74705SXin Li 
25*67e74705SXin Li // DATA_SECT-NOT: section
26*67e74705SXin Li // DATA_SECT: world:
27*67e74705SXin Li // DATA_SECT: .section .rodata.hello,
28*67e74705SXin Li // DATA_SECT: hello:
29