Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 72a8e6b

Browse files
committed
Adding checks for module level assembly
1 parent d8a7904 commit 72a8e6b

File tree

13 files changed

+115
-9
lines changed

13 files changed

+115
-9
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CHECK: cc_plus_one_asm
2+
CHECK-NEXT: movl
3+
CHECK-NEXT: lfence
4+
CHECK-NEXT: inc
5+
CHECK-NEXT: notq (%rsp)
6+
CHECK-NEXT: notq (%rsp)
7+
CHECK-NEXT: lfence
8+
CHECK-NEXT: retq
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHECK: cmake_plus_one_asm
2+
CHECK-NEXT: movl
3+
CHECK-NEXT: lfence
4+
CHECK-NEXT: incl
5+
CHECK-NEXT: shlq $0, (%rsp)
6+
CHECK-NEXT: lfence
7+
CHECK-NEXT: retq
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CHECK: cmake_plus_one_c_global_asm
2+
CHECK: lfence
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CHECK: cmake_plus_one_cxx_global_asm
2+
CHECK: lfence

src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ fn main() {
33
.file("foo.c")
44
.compile("foo_c");
55

6+
cc::Build::new()
7+
.file("foo_asm.s")
8+
.compile("foo_asm");
9+
610
cc::Build::new()
711
.cpp(true)
812
.cpp_set_stdlib(None)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.text
2+
.global cc_plus_one_asm
3+
.type cc_plus_one_asm, @function
4+
cc_plus_one_asm:
5+
movl (%rdi), %eax
6+
inc %eax
7+
retq
Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
1-
add_library(cmake_foo STATIC
1+
enable_language(C CXX ASM)
2+
3+
set(C_SOURCES
24
src/foo.c
5+
)
6+
7+
set_source_files_properties(${C_SOURCES}
8+
PROPERTIES
9+
LANGUAGE C)
10+
11+
set(CXX_SOURCES
312
src/foo_cxx.cpp
4-
)
13+
)
14+
15+
set_source_files_properties(${CXX_SOURCES}
16+
PROPERTIES
17+
LANGUAGE CXX)
18+
19+
set(ASM_SOURCES
20+
src/foo_asm.s
21+
)
22+
23+
set_source_files_properties(${ASM_SOURCES}
24+
PROPERTIES
25+
LANGUAGE ASM)
26+
27+
set(SOURCES
28+
${C_SOURCES}
29+
${CXX_SOURCES}
30+
${ASM_SOURCES})
31+
32+
add_library(cmake_foo STATIC
33+
${SOURCES})

src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ int cmake_plus_one_c_asm(int *arg) {
1515

1616
return value;
1717
}
18+
19+
asm(".text\n"
20+
" .global cmake_plus_one_c_global_asm\n"
21+
" .type cmake_plus_one_c_global_asm, @function\n"
22+
"cmake_plus_one_c_global_asm:\n"
23+
" movl (%rdi), %eax\n"
24+
" inc %eax\n"
25+
" retq\n" );
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.text
2+
.global cmake_plus_one_asm
3+
.type cmake_plus_one_asm, @function
4+
cmake_plus_one_asm:
5+
movl (%rdi), %eax
6+
inc %eax
7+
retq

src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_cxx.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ int cmake_plus_one_cxx_asm(int *arg) {
1818

1919
return value;
2020
}
21+
22+
asm(".text\n"
23+
" .global cmake_plus_one_cxx_global_asm\n"
24+
" .type cmake_plus_one_cxx_global_asm, @function\n"
25+
"cmake_plus_one_cxx_global_asm:\n"
26+
" movl (%rdi), %eax\n"
27+
" inc %eax\n"
28+
" retq\n" );

0 commit comments

Comments
 (0)