lifting-bits / remill

Library for lifting machine code to LLVM bitcode
Apache License 2.0
1.22k stars 141 forks source link

Support opaque pointers #596

Closed tetsuo-cpp closed 2 years ago

tetsuo-cpp commented 2 years ago

@pgoodman Ah the tests are a bit of a headache 🤦‍♂️ . So part of our building process for the test dependencies involves invoking Clang on some test bitcode that came from Remill (I think) and generating some textual assembly from it. However, what I've realised is that opaque pointers are supported in LLVM 14 but not in Clang 14 if that makes sense. So when the build invokes the Clang that came with the LLVM 14 toolchain, it barfs on our bitcode because it contains typeless pointers.

If we can somehow get it to use a Clang built off LLVM trunk this would work. Or we could wait until LLVM 15. Not sure what what best way to proceed is.

pgoodman commented 2 years ago

@tetsuo-cpp We'll leave fixing the tests to the next PR. I think you could probably use the vcpkg llc, perhaps.

tetsuo-cpp commented 2 years ago

Cool! As discussed, I'm going to get this in + the Anvill change and deal with the test fallout in a follow up fix.

To anyone curious, the issue is that our testing involves feeding some Remill-generated bitcode into Clang and trying to lower into some textual assembly. Unfortunately, Clang 14 doesn't support opaque pointers yet (15 will use opaque pointers by default and have a -no-opaque-pointers flag) and currently barfs on Remill's bitcode. I think the fix will involve using llc to convert the bitcode to assembly since there's no reason we need to use Clang.