Skip to content
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

Pass opaque pointer flag to Clang so it can handle Remill's IR #605

Merged
merged 3 commits into from
Jun 27, 2022

Conversation

tetsuo-cpp
Copy link
Contributor

Closes #604

@@ -181,6 +181,8 @@ MAKE_RW_FP_MEMORY(64)
//MAKE_RW_FP_MEMORY(80)
MAKE_RW_FP_MEMORY(128)

State __remill_state{};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once I fixed the problem with the Clang flag, I noticed the linker yelling at me when building test dependencies. That's what this fix is for.

add_custom_command(
OUTPUT tests_${name}.S
COMMAND ${CMAKE_BC_COMPILER} -Wno-override-module -S -O0 -g0 -c tests_${name}.bc -o tests_${name}.S
COMMAND ${CMAKE_BC_COMPILER} -Wno-override-module -S -O0 -g0 -c tests_${name}.bc -o tests_${name}.S -mllvm -opaque-pointers
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I didn't know what I was talking about. This is quite straightforward. The only catch is that the flag is named differently in LLVM trunk (-Xclang -opaque-pointers). However, in LLVM 15 opaque pointers should be on by default so we'll be able to just check the LLVM version and only supply -mllvm -opaque-pointers when using LLVM 14.

// TODO(alex): Some of the optimization passes that the builder adds still rely on typed pointers
// so we cannot use them. We should switch to using the new pass manager and choose which passes
// we want.
builder.OptLevel = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't ideal but it looks like Anvill doesn't actually use this. It's just remill-lift that calls into it so I'm assuming the impact of this is minimal.

@pgoodman pgoodman merged commit 65549b3 into master Jun 27, 2022
@pgoodman pgoodman deleted the alex/opaque-ptr-test-fix branch June 27, 2022 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tests: Clang complains about bitcode with typeless pointers generated by Remill
2 participants