Skip to content

feat: new binding via go:linkname #362

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

feat: new binding via go:linkname #362

wants to merge 16 commits into from

Conversation

y1yang0
Copy link
Member

@y1yang0 y1yang0 commented Mar 18, 2025

This patch rewrites the code injection mechanism.

We no longer inject by copying code into the user's project and injecting via variable assignment. In the new approach, we will use go:linkname for injection. Since the injection is done by the linker through symbol overriding, the hook code is always fully initialized and ready before the target function is called. Therefore, the new implementation eliminates initialization order issues, which is a long-standing pain in older version #48

@123liuziming
Copy link
Collaborator

Add [WIP] on your title

@y1yang0 y1yang0 changed the title feat: bridge target and hook func with go:linkname [WIP] feat: bridge target and hook func with go:linkname Mar 18, 2025
@y1yang0 y1yang0 force-pushed the yyang/poc_linkname branch 28 times, most recently from 34e32a5 to 98931fc Compare March 20, 2025 02:47
@y1yang0 y1yang0 force-pushed the yyang/poc_linkname branch 2 times, most recently from 4514d3f to 6b22d5e Compare May 7, 2025 06:31
@y1yang0 y1yang0 mentioned this pull request May 7, 2025
@y1yang0 y1yang0 force-pushed the yyang/poc_linkname branch 2 times, most recently from fff38f7 to bea9104 Compare May 7, 2025 08:57
otel_importer.go
test/fiberv2/v2.43.0/fiber_http
test/redis/v9.0.5/test_redis_ring
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to add those test binary here?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's okay, gitignore is somewhat flexible, any unnecessary files generated during the development can be added to it.

@codecov-commenter
Copy link

codecov-commenter commented May 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.01%. Comparing base (00e4ab9) to head (68b1794).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #362      +/-   ##
==========================================
+ Coverage   83.70%   87.01%   +3.31%     
==========================================
  Files          27       25       -2     
  Lines        1209     1163      -46     
==========================================
  Hits         1012     1012              
+ Misses        159      113      -46     
  Partials       38       38              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

3 participants