ghc 프론트 엔드 및 llvm 백엔드를 사용하여 haskell을 컴파일하려고합니다.llvm 백엔드가있는 haskell .ll 파일 컴파일 중 오류가 발생했습니다.
내 하스켈 hello.hs 파일에 다음 코드를했다 : 나는 다음 명령을 사용하여 GHC와 hello.hs를 컴파일
main = putStrLn "Hello World!"
을 기타와 함께 hello.ll 파일을 생성
ghc -fllvm -keep-llvm-files -force-recomp -hello.hs
파일. 그런 다음이 .ll 파일을 .bc 파일로 컴파일하려고합니다.
llvm-as hello.ll -o hello.bc
한 후 실행 파일을 생성하는 실행 파일
llc hello.bc -o hello
이 .bc 파일. 문제는 내가이 파일을 실행할 때 다음과 같은 오류
./hello: line 1: .file: command not found
./hello: line 2: .section: command not found
./hello: line 3: .globl: command not found
./hello: line 4: .align: command not found
./hello: line 5: .type: command not found
./hello: line 6: Main_main2_info:: command not found
./hello: line 8: subq: command not found
./hello: line 9: syntax error near unexpected token `('
./hello: line 9: ` movq
%r13, 112(%rsp)'
을 발견하고 내가 .bc 파일에 LLI를 사용할 때 내가 고정 표시기에 GHC과 LLVM을 실행하고
main function not found in module error
를 얻을 수있다. 나는 llvm의 버전 3.4와 ghc의 버전 7.6.3을 가지고있다.
Mac에서이 작업을 수행하려고하면 "비슷한"오류가 발생합니다. 왜이 오류가 발생하는지 알 수 없습니다.
hello 파일을 실행할 때 (내가 여러 번 시도한 경우) 세그멘테이션 오류가 발생합니다. 어떤 버전의 ghc와 llvm을 사용하고 있습니까? –
또한 "lli hello.bc"를 실행하려고하면 "main '함수가 모듈에 없습니다."라는 오류가 발생합니다. .bc 파일에 뭔가 빠졌습니까? –