Debian Codegraph @

clang/test/Misc/noexecstack.c

raw
1 // REQUIRES: x86-registered-target
2 // RUN: %clang -cc1 -triple x86_64 %s -emit-obj -o %t.o -mnoexecstack
3 // RUN: llvm-readelf -S %t.o | FileCheck %s
4
5 // RUN: %clang -cc1 -triple x86_64 %s -S -o %t.s
6 // RUN: FileCheck --check-prefix=ASM %s < %t.s
7 // RUN: %clang -cc1as -triple x86_64 %t.s -filetype obj -mnoexecstack -o %t.o
8 // RUN: llvm-readelf -S %t.o | FileCheck %s
9 /// Without -mnoexecstack on a .s that lacks .note.GNU-stack, the section should be absent.
10 // RUN: echo "nop" | %clang -cc1as -triple x86_64 - -filetype obj -o %t.o
11 // RUN: llvm-readelf -S %t.o | FileCheck --check-prefix=NOSTACK %s
12
13 // CHECK: .text PROGBITS 0000000000000000 {{[0-9a-f]+}} 000001 00 AX 0 0 16
14 // CHECK: .note.GNU-stack PROGBITS 0000000000000000 {{[0-9a-f]+}} 000000 00 0 0 1
15
16 // NOSTACK-NOT: .note.GNU-stack
17
18 // ASM: .text
19 // ASM: .section ".note.GNU-stack","",@progbits
20 // ASM-NOT: ".note.GNU-stack"
21
22 void f() {}