-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Label targets are not represented correctly for llvm-as consumption #114
Comments
[From Ryan Scott:] OK, I've extracted a test case that confirms that this is in fact an // callbr.c
int main(void) {
int cond = 0;
asm volatile goto("testl %0, %0; jne %l1;"
: /* No outputs */
: "r"(cond)
: /* No clobbers */
: label_true, loop);
return 0;
loop:
return 0;
label_true:
return 1;
} First, note how LLVM itself formats
Now note how it appears after round-tripping through -- Main.hs
module Main (main) where
import Data.LLVM.BitCode
import Text.LLVM.PP
main :: IO ()
main = do
res <- parseBitCodeFromFile "callbr.bc"
case res of
Left err -> fail $ formatError err
Right bc -> print $ ppLLVM38 ppModule bc Running this program after compiling with
Which lacks double quotes around the |
The `name` of a `DILabel` is meant to be escaped in double quotes. Fixes #114.
This does seem to fix those issues (in conjunction with the llvm-pretty-bc-parser adaptation on GaloisInc/llvm-pretty-bc-parser#233), but runs into another one: #116 |
Bitcode generated by clang and then parsed via llvm-pretty-bc-parser and then output via this library into
.ll
files may not be usable withllvm-as
because of the representation of the label targets.Generated code contains
call void @llvm.db.label(metadata !DILabel(scope: !8, name: loop,
which fails onloop
(presumably because it needs to be quoted).This error can be seen running `cabal run disasm-test -- -p '/callbr.c/' (requires https://github.com/galoisinc/llvm-pretty-bc-parser/pulls/230).
The text was updated successfully, but these errors were encountered: