From cb25b8db7131a48be0411a4ce6898f09c530687c Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 3 Jan 2023 12:58:22 +0200 Subject: [PATCH] Make symbols hidden by default on Linux This will encourage me to add the visibility decorations where necessary and reduce work needed for porting to Windows. --- plugins/gnu/gnucompiler.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/gnu/gnucompiler.cpp b/plugins/gnu/gnucompiler.cpp index ba74409..e4c050f 100644 --- a/plugins/gnu/gnucompiler.cpp +++ b/plugins/gnu/gnucompiler.cpp @@ -302,7 +302,10 @@ ExternalTask::Arguments GnuCompiler::_run(const ObjectFile &object, FS::Path &wo if(binfo.threads && arch.get_system()!="windows" && arch.get_system()!="darwin") argv.push_back("-pthread"); if(object.is_used_in_shared_library() && arch.get_system()!="windows") + { + argv.push_back("-fvisibility=hidden"); argv.push_back("-fPIC"); + } if((arch.get_type()=="x86" || arch.get_type()=="ppc") && !arch.is_native()) argv.push_back(format("-m%d", arch.get_bits())); -- 2.43.0