-
Notifications
You must be signed in to change notification settings - Fork 96
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
Extend source file finding heuristic. #72
Extend source file finding heuristic. #72
Conversation
It looks like the current heuristic to find the source file in the compilation command doesn't cover all possible scenarios. In particular, there are situations where the source file is specified just before the `-o` flag. This commit extends the heuristic to check for that as well.
Thanks for the awesome tool. For context, I found this while building Carbon. |
Cool! Great to meet you, @ergawy. Thanks for using and contributing, leaving things better than you found them. |
Just for my learning, any chance you have one of these commands lying around so I can see an example? |
And while you're reading, since I saw you work at GuardSquare :) |
Hi Christopher, Thanks for merging, here is a an example command:
For the corresponding |
Happy to hear you are enjoy working with ProGuard. We have iXGuard for iOS. However, it is a licensed product (and doesn't have an open-source component) that focuses mainly on obfuscation. Also, it is an LLVM-based compiler that works on the IR level: the only requirement is that the input app embeds bitcode then iXGuard re-compiles the IR into an obfuscated one. Also, unfortunately it doesn't not integrate with any build system: it is a post-processing tool after you build and export your app. |
Sweet! Thanks. Yeah, similarly non-obvious to me what's causing this one to have such a different order than the others we've seen. [Sounds like iXGuard is not our man, but thanks so much for thinking about it!] |
After some more thought, I'd propose we switch over to using just your heuristic. I'd expect it to be more robust, since presumably the file and it's -o are added together--and clearly the -c is added separately somewhere. And I've been looking through some test repos, and I haven't yet seen any situations where it doesn't work. If it captures all the cases, then I should strip things down for simplicity. Does that square with what you saw? By default, I'll move on that soon, maybe tomorrow. The one exception is msvc, where, to my knowledge, there's no /o flag like the one you'd put in (instead /Fo). There, I think we want to just go after the /c, since the order is flipped (example). Wish there were a better overall option, so if you think of one, please do say something. |
Added a commit moving us to your heuristic as the primary for GCC-formatted commands. Please lmk if that works for you, too! |
It looks like the current heuristic to find the source file in the
compilation command doesn't cover all possible scenarios. In particular,
there are situations where the source file is specified just before the
-o
flag. This commit extends the heuristic to check for that as well.