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

src: make process.dlopen() load well-known symbol #18934

Merged
merged 2 commits into from
Mar 1, 2018

Conversation

bnoordhuis
Copy link
Member

Look for symbol node_register_module_v${NODE_MODULE_VERSION} if the
add-on didn't self-register. This can be used to create add-ons that
support multiple Node.js versions from a single shared object.

An experiment to make add-on loading more flexible. Can be extended to n-api, cc @nodejs/n-api.

Longer term, I'd like to get rid of the __attribute__((constructor)) approach. It's convoluted and complicated for no good reason.

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Feb 22, 2018
Copy link
Member

@tniessen tniessen left a comment

Choose a reason for hiding this comment

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

I like the idea!

@joyeecheung
Copy link
Member

@bnoordhuis
Copy link
Member Author

Small fix-up to make the test export the symbol on Windows: https://ci.nodejs.org/job/node-test-pull-request/13401/

Move some code around and clean up the DLib helper class as prep work
for a follow-up commit.

PR-URL: nodejs#18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Look for symbol `node_register_module_v${NODE_MODULE_VERSION}` if the
add-on didn't self-register.  This can be used to create add-ons that
support multiple Node.js versions from a single shared object.

PR-URL: nodejs#18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
@bnoordhuis bnoordhuis closed this Mar 1, 2018
@bnoordhuis bnoordhuis deleted the better-addon-loading branch March 1, 2018 12:48
@bnoordhuis bnoordhuis added the semver-minor PRs that contain new features and should be released in the next minor version. label Mar 1, 2018
@bnoordhuis
Copy link
Member Author

Landed in 197fbbe...3828fc6, thanks for the reviews.

@bnoordhuis bnoordhuis merged commit 3828fc6 into nodejs:master Mar 1, 2018
MylesBorins pushed a commit that referenced this pull request Mar 6, 2018
Move some code around and clean up the DLib helper class as prep work
for a follow-up commit.

PR-URL: #18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Mar 6, 2018
Look for symbol `node_register_module_v${NODE_MODULE_VERSION}` if the
add-on didn't self-register.  This can be used to create add-ons that
support multiple Node.js versions from a single shared object.

PR-URL: #18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
@MylesBorins MylesBorins mentioned this pull request Mar 6, 2018
MylesBorins pushed a commit that referenced this pull request Mar 6, 2018
Move some code around and clean up the DLib helper class as prep work
for a follow-up commit.

PR-URL: #18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Mar 6, 2018
Look for symbol `node_register_module_v${NODE_MODULE_VERSION}` if the
add-on didn't self-register.  This can be used to create add-ons that
support multiple Node.js versions from a single shared object.

PR-URL: #18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Mar 6, 2018
Move some code around and clean up the DLib helper class as prep work
for a follow-up commit.

PR-URL: #18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Mar 6, 2018
Look for symbol `node_register_module_v${NODE_MODULE_VERSION}` if the
add-on didn't self-register.  This can be used to create add-ons that
support multiple Node.js versions from a single shared object.

PR-URL: #18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Mar 6, 2018
Move some code around and clean up the DLib helper class as prep work
for a follow-up commit.

PR-URL: #18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Mar 6, 2018
Look for symbol `node_register_module_v${NODE_MODULE_VERSION}` if the
add-on didn't self-register.  This can be used to create add-ons that
support multiple Node.js versions from a single shared object.

PR-URL: #18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins added a commit that referenced this pull request Mar 6, 2018
Notable Changes:

* crypto:
  - add cert.fingerprint256 as SHA256 fingerprint (Hannes Magnusson)
    #17690
* lib:
  - v8_prof_processor works again 🎉 (Anna Henningsen)
    #19059
* loader:
  - --inspect-brk now works properly for esmodules (Gus Caplan)
    #18949
* src:
  - handle exceptions in env-\>SetImmediates (James M Snell)
    #18297
  - make process.dlopen() load well-known symbol (Ben Noordhuis)
    #18934
* trace_events:
  - add file pattern cli option (Andreas Madsen)
    #18480

PR-URL: #19181
MylesBorins pushed a commit that referenced this pull request Mar 7, 2018
Move some code around and clean up the DLib helper class as prep work
for a follow-up commit.

PR-URL: #18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Mar 7, 2018
Look for symbol `node_register_module_v${NODE_MODULE_VERSION}` if the
add-on didn't self-register.  This can be used to create add-ons that
support multiple Node.js versions from a single shared object.

PR-URL: #18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins added a commit that referenced this pull request Mar 7, 2018
Notable Changes:

* crypto:
  - add cert.fingerprint256 as SHA256 fingerprint (Hannes Magnusson)
    #17690
* lib:
  - v8_prof_processor works again 🎉 (Anna Henningsen)
    #19059
* loader:
  - --inspect-brk now works properly for esmodules (Gus Caplan)
    #18949
* src:
  - handle exceptions in env-\>SetImmediates (James M Snell)
    #18297
  - make process.dlopen() load well-known symbol (Ben Noordhuis)
    #18934
* trace_events:
  - add file pattern cli option (Andreas Madsen)
    #18480

PR-URL: #19181
MylesBorins added a commit that referenced this pull request Mar 7, 2018
Notable Changes:

* crypto:
  - add cert.fingerprint256 as SHA256 fingerprint (Hannes Magnusson)
    #17690
* http2:
  - Fixed issues with aborted connections in the HTTP/2 implementation
    (Anna Henningsen)
    #18987
    #19002
* loader:
  - --inspect-brk now works properly for esmodules (Gus Caplan)
    #18949
* src:
  - make process.dlopen() load well-known symbol (Ben Noordhuis)
    #18934
* trace_events:
  - add file pattern cli option (Andreas Madsen)
    #18480
* Added new collaborators:
  - Chen Gang (MoonBall) https://github.com/MoonBall

PR-URL: #19181
MylesBorins added a commit that referenced this pull request Mar 8, 2018
Notable Changes:

* crypto:
  - add cert.fingerprint256 as SHA256 fingerprint (Hannes Magnusson)
    #17690
* http2:
  - Fixed issues with aborted connections in the HTTP/2 implementation
    (Anna Henningsen)
    #18987
    #19002
* loader:
  - --inspect-brk now works properly for esmodules (Gus Caplan)
    #18949
* src:
  - make process.dlopen() load well-known symbol (Ben Noordhuis)
    #18934
* trace_events:
  - add file pattern cli option (Andreas Madsen)
    #18480
* Added new collaborators:
  - Chen Gang (MoonBall) https://github.com/MoonBall

PR-URL: #19181
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
Move some code around and clean up the DLib helper class as prep work
for a follow-up commit.

PR-URL: nodejs#18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
Look for symbol `node_register_module_v${NODE_MODULE_VERSION}` if the
add-on didn't self-register.  This can be used to create add-ons that
support multiple Node.js versions from a single shared object.

PR-URL: nodejs#18934
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
Notable Changes:

* crypto:
  - add cert.fingerprint256 as SHA256 fingerprint (Hannes Magnusson)
    nodejs#17690
* http2:
  - Fixed issues with aborted connections in the HTTP/2 implementation
    (Anna Henningsen)
    nodejs#18987
    nodejs#19002
* loader:
  - --inspect-brk now works properly for esmodules (Gus Caplan)
    nodejs#18949
* src:
  - make process.dlopen() load well-known symbol (Ben Noordhuis)
    nodejs#18934
* trace_events:
  - add file pattern cli option (Andreas Madsen)
    nodejs#18480
* Added new collaborators:
  - Chen Gang (MoonBall) https://github.com/MoonBall

PR-URL: nodejs#19181
@MylesBorins
Copy link
Contributor

set as don't land for v8.x. Feel free to change label and open backport PR if it should land

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants