LLVM bootstarp fails due to a SEGV in DebugInfo/PDB/pdbdump-debug-subsections.test on PPC64le Fedora 28 if configured with -DBUILD_SHARED_LIBS=ON.
This SEGV is caused by make_shared in the C++ standard library because two copies of a hidden function _Sp_make_shared_tag::_S_ti() are created in llvm-pdbutil binary and libLLVMObjectYAML.so. Two copies of a static local variable __tag in this function are also created and this results in the malfunction of make_shared.
_Sp_make_shared_tag::_S_ti() is marked as hidden due to -fvisibility-inlines-hidden option.
This patch makes static local variable in a method marked as hidden by -fvisibility-inlines-hidden visible from linker by setting the visibility default. It avoids creating two instances of the __tag variable. As long as I tested, gcc does not mark __tag hidden.
Alternatively we can remove -fvisibility-inlines-hidden from LLVM build options, but it may increase the binary size more significantly. Also I think that this is not unique to our problem; other programs using -fvisibility-inlines-hidden may hit the same problem. So, removing -fvisibility-inlines-hidden from LLVM build option may not be a good solution.
Is it better to do the check here ? At some condition, not merge the visibility.