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

Hide symbols/functions in profiling native extension #1968

Merged
merged 2 commits into from
Apr 8, 2022

Conversation

ivoanjo
Copy link
Member

@ivoanjo ivoanjo commented Apr 6, 2022

The native extension is not intended to expose any symbols/functions for other native libraries to use, so let's set the default visibility to hidden.

This avoids accidental symbol naming clashes with other extensions/libraries.

Test suite still green :)

The native extension is not intended to expose any symbols/functions
for other native libraries to use, so let's set the default visibility
to hidden.

This avoids accidental symbol naming clashes with other
extensions/libraries.

Test suite still green :)
@ivoanjo ivoanjo requested a review from a team April 6, 2022 10:47
@@ -4,7 +4,7 @@

static VALUE native_working_p(VALUE self);

void Init_ddtrace_profiling_native_extension(void) {
void __attribute__ ((visibility ("default"))) Init_ddtrace_profiling_native_extension(void) {
Copy link

Choose a reason for hiding this comment

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

for conciseness I would have a #define EXPORT __attribute__ ((visibility ("default"))) somewhere (ir whatever fits better than EXPORT. Also, doesn't Ruby have such define for native extensions?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question! There's a RUBY_FUNC_EXPORTED but only from Ruby 3.0 on 😭

Since there's no common header where to place it, for now I left a #define DDTRACE_EXPORT in profiling.c, will move it once there's other places where we want to use it.

For now `DDTRACE_EXPORT` will live in `profiling.c` because we don't
yet have a shared generic header.
@codecov-commenter
Copy link

Codecov Report

Merging #1968 (3765196) into master (2ed82eb) will increase coverage by 0.00%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1968   +/-   ##
=======================================
  Coverage   97.69%   97.69%           
=======================================
  Files        1000     1000           
  Lines       50445    50445           
=======================================
+ Hits        49283    49284    +1     
+ Misses       1162     1161    -1     
Impacted Files Coverage Δ
spec/datadog/profiling/ext/forking_spec.rb 100.00% <0.00%> (+0.60%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@ivoanjo ivoanjo merged commit 8b88d88 into master Apr 8, 2022
@ivoanjo ivoanjo deleted the ivoanjo/hide-native-extension-symbols branch April 8, 2022 13:49
@github-actions github-actions bot added this to the 1.0.0.beta2 milestone Apr 8, 2022
@delner delner assigned delner and ivoanjo and unassigned delner Apr 14, 2022
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