-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Makefile: Add support for symbol versioning (ON by default) #49012
Conversation
5673534
to
f6c8719
Compare
90b843d
to
f89b147
Compare
Could we get a backport to v1.9.x here? |
@staticfloat @gbaraldi What do you think about turning this on by default? If we go ahead and do that, I'm guessing we'll want a separate change that we won't backport to 1.9? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you simplify this PR to only have the version script change for the Makefile?
Alright, I've added This PR can now be reviewed independently 🙂 |
Bump! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can you make sure this is on-by-default, so that release builds have this available? I think you also need to specify -fno-gnu-unique
, which disables a GNU extension to ELF as a feature to sometimes miscompile your C++ programs (https://bugs.llvm.org/show_bug.cgi?id=48221), and also check with @vchuravy that this won't break his fix in d8fa3c8. IIUC, that symbol may need to be tagged with the LLVM symbol version, not the Julia symbol version info.
@vtjnash @staticfloat Sure thing. Does that mean we'd also like to change our SONAME format? Presumably something like |
020ea40
to
9893129
Compare
This change adds `DEFAULT_SYMBOL_VERSION` as a Makefile option. If specified, this will configure the linker to assign the specified version string to all Julia-exported symbols. The other half of the mechanism is `#define JL_SYMBOL_VERSION`, which is used by the ccall machinery to look up symbols by their version + name.
This changes the `.expmap` linker script generation to treat the source file as a template and uses `sed` to replace strings in that template. It also does a bit of re-naming, changing the template source to be `julia.expmap.in` and the output to be `julia.expmap` instead of `julia.generated.expmap`
This enables symbol versioning by default, with the version string `JL_LIBJULIA_1.10` (the version suffix is the SOMAJOR in general). As part of this change, the SOMAJOR has also been changed to be MAJOR.MINOR instead of just MAJOR. This is required to allow multiple minor releases of libjulia to live side-by-side in the same process. `SYMBOL_VERSION_SUFFIX` is provided to allow appending an additional unique "salt" to SOMAJOR, which can be helpful for creating template binaries that will be "version-stamped" after distribution.
Also, when `USE_SYSTEM_LLVM=1` compute `LLVM_SHLIB_SYMBOL_VERSION` using `llvm-config`
This change enables symbol versioning by default and also adds
SYMBOL_VERSION_SUFFIX
as a Makefile option to allow appending a "salt" to the SONAME and all symbols' versions.