[LLVMdev] -O4 -fvisibility=hidden

Jack Howarth howarth at bromo.med.uc.edu
Fri Jan 30 16:41:56 PST 2009


On Mon, Jan 26, 2009 at 09:57:28AM -0800, Devang Patel wrote:
> Hi Jack,
> 
> On Jan 25, 2009, at 10:00 AM, Jack Howarth wrote:
> 
> >    Doing that changes the error messages into a bus
> > error on the darwin linker.
> 
> 
> Pl. file bugzilla report (or radar) with a reproducible test case so  
> that we can investigate this linker crash.
> 
> As you know, one way to control symbol visibility is to use gcc's  
> (inherited by llvm-gcc) visibility support. GCC supports, 1) command  
> line options 2) attributes and 3) pragmas in this regard. Following  
> document provides good summary...
> 
> http://developer.apple.com/documentation/DeveloperTools/Conceptual/CppRuntimeEnv/Articles/SymbolVisibility.html#/ 
> /apple_ref/doc/uid/TP40001670
> 
> Another way to control symbol visibility is to use linker's interface.  
> See ld man page for more info on -exported_symbols_list, - 
> exported_symbols, -unexported_symbols_list etc.. flags. If you're  
> going to try this approach, pl. read ld man page first.
> -
> Devang
> 
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Devang,
   I was surprised to discover that I could build all of
pymol with -fvisibility=hidden using gcc 4.4 or
llvm-gcc-4.2 with only a single header change...

--- pymol-1.1/layer4/Cmd.h.orig 2009-01-30 18:58:58.000000000 -0500
+++ pymol-1.1/layer4/Cmd.h      2009-01-30 19:00:17.000000000 -0500
@@ -18,7 +18,8 @@
 
 #include"os_python.h"
 
-void init_cmd(void);
+void init_cmd(void)
+__attribute__((visibility("default")));
 
 extern PyObject *PM_Globals;
 
One of the advantages of running as a python module I guess. I was
also able to build pymol with -O4 using the llvm 2.5 libLTO.dylib
so that full Link Time Optimizations were performed. Everything
compiled and linked fine. The resulting pymol runs its demos without
regressions. Nice.
             Jack



More information about the llvm-dev mailing list