-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Add initial support for position-independent executables. #77
Conversation
Add initial support for position-independent executables.
Haha! Did you wait with the submission until pi-day or was it just lucky coincidence? Anyway, very nice work and thanks for the submission! I can add test cases to cover this, it's not difficult to do. As for pybot, I install it with the "pip" tool, which seems to work in the Travis builds at least (see '''travis/Makefile''' for how it's setup in Ubuntu). |
@SimonKagstrom Just a lucky coincidence. ;) As the above issue linked suggests, I was trying to revive kcov for Rust programs (which are now compiled as a PIE by default, and non-PIE codegen needs some non-trivial work). Turned out that this too was a non-trivial task though. I've finally figured out what was wrong with my local pip ( |
Add tests for PIE support. (Continuation of issue #77)
…accumulation currently fails)
Locally I do more or less what you did. My build directories for the tests and kcov itself are laid out the same way as for travis (or really, the other way around), so I just do
in the build-tests directory. Anyway, I added a couple of more tests for PIE executables. One thing which doesn't work for these is coverage accumulation, i.e., data from multiple runs. I added the pie-accumulate test (failing) which checks for this. It's not an error in your commit, but rather a limitation in the kcov implementation which stores raw addresses and "re-runs" these when the binary is started again. Shared libraries used to have the same bug (Issue #54), which was solved through storing an offset instead of the absolute address. PIE executables should be possible to handle in the same way. Another possibility would be to use the same method as in Python/Bash (where a file/line hash is stored instead), but without being careful, it would mean missing information about partial hits. Good to hear that kcov gets used by the way :-) |
What an appropriate PR for pi(e) day, heh. :) Anyway, this PR adds two features that enable the support for position-independent executables:
solib_wrapper
. This has some design implications, and I went to the easiest way possible: DWARF parsing is deferred untilsolib_wrapper
returns. I think we already have to wait for that, so this should not be a big problem.Again with the prior PR, I haven't written a proper test case for this. (I tried to run test cases, but I'm blocked on pybot downloads...) Any executable compiled with
gcc -pie -fpie -fPIE
should work.