Add option '-fvisibility=<hidden|default>' able to hide symbols not marked as 'export' on non-Windows targets. Resolves #2431 (#2894)

This commit is contained in:
Andrey Penechko 2018-11-09 21:55:57 +02:00 committed by Martin Kinkelin
parent 41e2ed034f
commit 7bcd6d34dd
8 changed files with 90 additions and 0 deletions

View file

@ -574,6 +574,13 @@ void DtoDeclareFunction(FuncDeclaration *fdecl) {
: LLGlobalValue::DLLExportStorageClass);
}
// Hide non-exported symbols
if (opts::defaultToHiddenVisibility &&
!fdecl->isImportedSymbol() &&
!fdecl->isExport()) {
func->setVisibility(LLGlobalValue::HiddenVisibility);
}
IF_LOG Logger::cout() << "func = " << *func << std::endl;
// add func to IRFunc