irrt broken when nac3 is built inside msys2 #231

Closed
opened 2022-03-21 23:09:26 +08:00 by sb10q · 4 comments

LLVM built manually with:

cmake .. -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_UNWIND_TABLES=OFF -DLLVM_ENABLE_THREADS=OFF -DLLVM_TARGETS_TO_BUILD=X86;ARM;RISCV -DLLVM_LINK_LLVM_DYLIB=OFF -DLLVM_ENABLE_FFI=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_INSTALL_PREFIX=Z:\home\sb\msys\mingw64
ninja
ninja llvm-config
copy bin\llvm-config.exe Z:\home\sb\msys\mingw64\bin
ninja llvm-as
copy bin\llvm-as.exe Z:\home\sb\msys\mingw64\bin

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', nac3core\src\codegen\irrt\mod.rs:28:54
LLVM built manually with: ``` cmake .. -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_UNWIND_TABLES=OFF -DLLVM_ENABLE_THREADS=OFF -DLLVM_TARGETS_TO_BUILD=X86;ARM;RISCV -DLLVM_LINK_LLVM_DYLIB=OFF -DLLVM_ENABLE_FFI=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_INSTALL_PREFIX=Z:\home\sb\msys\mingw64 ninja ninja llvm-config copy bin\llvm-config.exe Z:\home\sb\msys\mingw64\bin ninja llvm-as copy bin\llvm-as.exe Z:\home\sb\msys\mingw64\bin ``` ``` thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', nac3core\src\codegen\irrt\mod.rs:28:54 ```
sb10q changed title from iirt broken when nac3 is built inside msys2 to irrt broken when nac3 is built inside msys2 2022-03-21 23:09:32 +08:00
Poster
Owner

The iirt.bc has all the functions removed, due to the regex it would seem. But I don't understand how it works on Linux because there is the same problem there.

llvm-dis ./target/release/build/nac3core-ac259b5eb89ed6f8/out/irrt.bc -o -
; ModuleID = './target/release/build/nac3core-ac259b5eb89ed6f8/out/irrt.bc'
source_filename = "<stdin>"

; Function Attrs: argmemonly nofree nounwind willreturn
declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1 immarg) #0

; Function Attrs: argmemonly nofree nounwind willreturn
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0

attributes #0 = { argmemonly nofree nounwind willreturn }

Clang output is identical on Linux and Windows.

The iirt.bc has all the functions removed, due to the regex it would seem. <s>But I don't understand how it works on Linux because there is the same problem there.</s> ``` llvm-dis ./target/release/build/nac3core-ac259b5eb89ed6f8/out/irrt.bc -o - ; ModuleID = './target/release/build/nac3core-ac259b5eb89ed6f8/out/irrt.bc' source_filename = "<stdin>" ; Function Attrs: argmemonly nofree nounwind willreturn declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1 immarg) #0 ; Function Attrs: argmemonly nofree nounwind willreturn declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #0 attributes #0 = { argmemonly nofree nounwind willreturn } ``` Clang output is identical on Linux and Windows.
Poster
Owner

This makes it work on Windows:

diff --git a/nac3core/build.rs b/nac3core/build.rs
index b2eda85..8cf85e6 100644
--- a/nac3core/build.rs
+++ b/nac3core/build.rs
@@ -56,6 +56,6 @@ fn main() {
         .arg(Path::new(&env::var("OUT_DIR").unwrap()).join("irrt.bc"))
         .spawn()
         .unwrap();
-    llvm_as.stdin.as_mut().unwrap().write_all(filtered_output.as_bytes()).unwrap();
+    llvm_as.stdin.as_mut().unwrap().write_all(output.as_bytes()).unwrap();
     assert!(llvm_as.wait().unwrap().success())
 }
This makes it work on Windows: ``` diff --git a/nac3core/build.rs b/nac3core/build.rs index b2eda85..8cf85e6 100644 --- a/nac3core/build.rs +++ b/nac3core/build.rs @@ -56,6 +56,6 @@ fn main() { .arg(Path::new(&env::var("OUT_DIR").unwrap()).join("irrt.bc")) .spawn() .unwrap(); - llvm_as.stdin.as_mut().unwrap().write_all(filtered_output.as_bytes()).unwrap(); + llvm_as.stdin.as_mut().unwrap().write_all(output.as_bytes()).unwrap(); assert!(llvm_as.wait().unwrap().success()) } ```
Poster
Owner

Clang output is identical on Linux and Windows.

Except for end-of-line characters, which may be the source of the problem.

> Clang output is identical on Linux and Windows. Except for end-of-line characters, which may be the source of the problem.
Poster
Owner
https://github.com/rust-lang/regex/issues/244
sb10q closed this issue 2022-03-22 16:04:59 +08:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#231
There is no content yet.