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
RecoTracker/TkDetLayers: resolve link issue with Clang #7259
RecoTracker/TkDetLayers: resolve link issue with Clang #7259
Conversation
The following fix is required due to a behavior difference between Clang and GCC. Clan does not correctly emulate GCC visibility pragma. See PR22254: http://llvm.org/bugs/show_bug.cgi?id=22254 The link error involved the following two symbols: - `Plane::tangentPlane(Point3DBase<float, LocalTag> const&) const` - `Plane::tangentPlane(Point3DBase<float, GlobalTag> const&) const` On link command we have `libTrackingToolsDetLayers.so` and `libTrackingToolsGeomPropagators.so`, which have undefined references for above two symbols. These are usually resolved on dynamic loading. On Clang `TECLayer.o` marked these particular symbols as HIDDEN. Clang: 182: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND _ZNK5Plane12tangentPlaneERK11Point3DBaseIf8LocalTagE 183: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND _ZNK5Plane12tangentPlaneERK11Point3DBaseIf9GlobalTagE GCC: 261: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _ZNK5Plane12tangentPlaneERK11Point3DBaseIf9GlobalTagE 262: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _ZNK5Plane12tangentPlaneERK11Point3DBaseIf8LocalTagE `TkDetUtil.h` inside visibility pragma section has forward declaration of class `Plane`. Thus Clang marked it as HIDDEN. Then linker was complaining that two libraries mentioned above reference a HIDDEN symbols, which is not allowed as these sybmols are not public API. In GCC `Plane` is with DEFAULT visbility, because the first declaration wins, thus the DEFAULT visibility. You cannot modify it later on. Lesson here: do not add forward declaration for publicly available classes in pragma visibility hidden section. Signed-off-by: David Abdurachmanov <David.Abdurachmanov@cern.ch>
A new Pull Request was created by @davidlt for CMSSW_7_4_X. RecoTracker/TkDetLayers: resolve link issue with Clang It involves the following packages: RecoTracker/TkDetLayers @cmsbuild, @cvuosalo, @nclopezo, @slava77 can you please review it and eventually sign? Thanks. |
It might be good to give a look at all headers in this package, but that's not the scope of this PR. |
+1 |
@ktf @nclopezo How is the decision to select the baseline for comparisons made? |
The decision is done based on the availability of the baseline (which is different from the availability of the release, since tests need to be run). The alternative is to postpone the tests until a baseline for the release used for the test is there. I'll see what we can do once @nclopezo is back. |
Merging since I take slava meant to +1 this and simply forgot. |
…tLayers-v2 RecoTracker/TkDetLayers: resolve link issue with Clang
+1 This PR includes a very small code change for a pragma directive that should have no effect in running programs. The matrix tests on the correct baseline, CMSSW_7_4_X_2015-01-18-0200, show no discrepancies from the reference. |
The following fix is required due to a behavior difference between Clang
and GCC. Clan does not correctly emulate GCC visibility pragma.
See PR22254: http://llvm.org/bugs/show_bug.cgi?id=22254
The link error involved the following two symbols:
Plane::tangentPlane(Point3DBase<float, LocalTag> const&) const
Plane::tangentPlane(Point3DBase<float, GlobalTag> const&) const
On link command we have
libTrackingToolsDetLayers.so
andlibTrackingToolsGeomPropagators.so
, which have undefined referencesfor above two symbols. These are usually resolved on dynamic loading.
On Clang
TECLayer.o
marked these particular symbols as HIDDEN.Clang:
GCC:
TkDetUtil.h
inside visibility pragma section has forward declarationof class
Plane
. Thus Clang marked it as HIDDEN. Then linker wascomplaining that two libraries mentioned above reference a HIDDEN
symbols, which is not allowed as these sybmols are not public API.
In GCC
Plane
is with DEFAULT visbility, because the first declarationwins, thus the DEFAULT visibility. You cannot modify it later on.
Lesson here: do not add forward declaration for publicly available
classes in pragma visibility hidden section.
Signed-off-by: David Abdurachmanov David.Abdurachmanov@cern.ch