[LLVMdev] -O4 -fvisibility=hidden

Jack Howarth howarth at bromo.med.uc.edu
Fri Jan 30 19:42:26 PST 2009


I was able to also build sparky (http://www.cgl.ucsf.edu/home/sparky/)
at -O4 under llvm-gcc-4.2 and llvm-g++-4.2 on darwin with minor patches...

--- sparky/c++/_tkinter.c.orig  2009-01-30 22:14:28.000000000 -0500
+++ sparky/c++/_tkinter.c       2009-01-30 22:16:40.000000000 -0500
@@ -3089,6 +3089,9 @@
        }
 }
 
+PyMODINIT_FUNC
+init_tkinter(void)
+__attribute__((visibility("default")));
 
 PyMODINIT_FUNC
 init_tkinter(void)
--- sparky/c++/python.cc.orig   2009-01-30 22:23:07.000000000 -0500
+++ sparky/c++/python.cc        2009-01-30 22:23:36.000000000 -0500
@@ -3566,6 +3566,9 @@
 // Initialization routine called by python when module is dynamically loaded.
 //
 extern "C" void initspy()
+__attribute__((visibility("default")));
+
+extern "C" void initspy()
 {
   this_module = Py_InitModule("spy", sparky_methods);
   Py_XINCREF(this_module);

Tk/Python driven software appears very friendly to -fvisibility=hidden.
Are there any particular optimization options that one should use besides
-O4 -fvisibility=hidden to enable all of the possible llvm Link Time Optimizations?
Also, I assume that one only needs to compile the object files with
-O4 -fvisibility=hidden and that the actual linkage doesn't need those
flags to enable full LTO, correct? FYI, sparky builds with no errors and
no regressions with -O4 -fvisibility=hidden. 
         Jack



More information about the llvm-dev mailing list