| 1 |
// REQUIRES: x86-registered-target |
| 2 |
|
| 3 |
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -o - < %s | FileCheck %s --check-prefix=PLAIN |
| 4 |
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -ffunction-sections -o - < %s | FileCheck %s --check-prefix=FUNC_SECT |
| 5 |
|
| 6 |
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fdata-sections -o - < %s | FileCheck %s --check-prefix=DATA_SECT |
| 7 |
|
| 8 |
// Try again through a clang invocation of the ThinLTO backend. |
| 9 |
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -O2 %s -flto=thin -emit-llvm-bc -o %t.o |
| 10 |
// RUN: llvm-lto -thinlto -o %t %t.o |
| 11 |
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -S -ffunction-sections -o - | FileCheck %s --check-prefix=FUNC_SECT |
| 12 |
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -S -fdata-sections -o - | FileCheck %s --check-prefix=DATA_SECT |
| 13 |
|
| 14 |
const int hello = 123; |
| 15 |
void world(void) {} |
| 16 |
|
| 17 |
// PLAIN-NOT: section |
| 18 |
// PLAIN: world: |
| 19 |
// PLAIN: section .rodata, |
| 20 |
// PLAIN: hello: |
| 21 |
|
| 22 |
// FUNC_SECT: section .text.world, |
| 23 |
// FUNC_SECT: world: |
| 24 |
// FUNC_SECT: section .rodata, |
| 25 |
// FUNC_SECT: hello: |
| 26 |
|
| 27 |
// DATA_SECT-NOT: .section |
| 28 |
// DATA_SECT: world: |
| 29 |
// DATA_SECT: .section .rodata.hello, |
| 30 |
// DATA_SECT: hello: |