Hi, I'm interested in the new -fwhole-program -combine functionality offered in GCC 4.1 but am having trouble applying it to this particular scenario.
Is -fwhole-program supposed to cover situations like this? Should I be doing this another way? Is this a bug? I am building a .so library from several .c files. Several functions and variables are shared between these files. Currently, these files are built into individual .o files then linked together at the end into a .so object. The public interface to this library is only 2 functions (this is a Python module). Currently, all of the shared functions/variables in these files are accessible to the outside world. I want to avoid this - these functions are internal only. I only want 2 specific functions available to the outside. So, after reading about -fwhole-program -combine I added __attribute__((externally_visible)) to the 2 functions I'm looking to provide to library users. I also modified the compliation system to compile all the files in the same command, and ended up with: gcc -shared -fwhole-program -combine file1.c file2.c file3.c -o mylib.so Now, when I try and run a program against this library, it fails to load due to undefined symbols in mylib.so. The symbols it claims about are internal functions/variables shared between the various .c files but *not* intended for use by the outside world (hence they shouldn't be in the external symbol table or however it works). What am I missing? Thanks, Daniel