[flang-commits] [clang] [mlir] [lld] [flang] [llvm] [ELF] Merge exportDynamic into versionId (PR #71272)

Fangrui Song via flang-commits flang-commits at lists.llvm.org
Mon Nov 6 09:38:41 PST 2023


MaskRay wrote:

> I think it makes sense to reuse the field if we can save a flag. The potential for someone to use the versionId as an index, or otherwise misuse it in the future makes me a bit nervous.
>
> A possible alternative is to use a different name for the versionId, say dynamicVersion and make this private. This could have a getVersionId(), setVersionId() hasVersionId() exportDynamic() and isExportDynamic(). Essentially make all uses of the previous variables into functions that use the same underlying variable dynamicVersion but don't use it 

Thanks for the comments. The way we use `versionId` does not make the `exportDynamic` virtual bit and the rest bits orthogonal.
If we add a function like `exportDynamic() { versionId = VER_NDX_GLOBAL; }`, it should not be used with version indexes larger than 1.
I think in a lot of places the new methods won't help much. I do add `exportDynamicIfNonexported()` when it could be misused.

I've added more symbol versioning tests to `symver-non-default.s`, `version-script-symver.s`, and `obj-preempt-dso.s`.
I am not that worried about breaking the implicit contract.


https://github.com/llvm/llvm-project/pull/71272


More information about the flang-commits mailing list