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

vm: build with -fPIC to simplify linking #23

Closed
wants to merge 1 commit into from
Closed

Conversation

ygrek
Copy link

@ygrek ygrek commented Nov 19, 2018

No description provided.

@pchaigno
Copy link
Collaborator

What's the use case for this change?

@pchaigno
Copy link
Collaborator

@ygrek Could you detail the use case for this change?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.68% when pulling 7ca98a6 on ygrek:pic into 10e0a45 on iovisor:master.

@ygrek
Copy link
Author

ygrek commented Feb 11, 2019

Shared objects require PIC, so code without -fPIC can not be linked into another .so
In my case (ocaml bindings in bytecode mode) all C code is compiled into shared object and then loaded by ocaml interpreter. So without -fPIC it is not easily possible to use ubpf from bytecode executables which is quite inconvenient.
I personally think that -fPIC should be used by default in libraries unless there are special performance considerations.
Naturally -fPIC changes code emitted by gcc into somewhat less efficient at function call sites, but difference is generally considered negligible. Though thinking about it ubpf interpreter is call-heavy probably so might suffer more. But anybody looking for perfomance will want to use jit so that should not matter?

@ygrek
Copy link
Author

ygrek commented Mar 26, 2019

Example usage : https://github.com/ahrefs/ocaml-ubpf

@ygrek ygrek mentioned this pull request Dec 17, 2020
@Alan-Jowett
Copy link
Collaborator

@ygrek it looks like this option was added in another PR. Are you ok closing this PR?

@Alan-Jowett
Copy link
Collaborator

Closing this PR as it appears to have been superseded by another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants