]> git.tdb.fi Git - builder.git/commitdiff
Make symbols hidden by default on Linux
authorMikko Rasa <tdb@tdb.fi>
Tue, 3 Jan 2023 10:58:22 +0000 (12:58 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 3 Jan 2023 10:58:22 +0000 (12:58 +0200)
This will encourage me to add the visibility decorations where necessary
and reduce work needed for porting to Windows.

plugins/gnu/gnucompiler.cpp

index ba74409a289e969953cc69f156358ca8c4bf3a2d..e4c050f7329a43ddc04a06e6b908c17c9ce60850 100644 (file)
@@ -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()));