Andrew wrote: > Try -ffunction-sections . > > Andrew. that did not help, I stil can see the dead code in the final executable. I tried it together with some of the -O options but that did not help as well.. any other ideas? thanks, jirka ps please keep me in CC as I'm not subscribed to the list, thanks On Fri, Apr 01, 2011 at 05:08:33PM +0200, Jiri Olsa wrote: > hi, > > I'd like to ask if there's a way to compile/link out the weak > symbol's code that has been overloaded. > > Having following objects: > > > 1st object: > --- > int __attribute__((weak)) krava(void) > { > printf("weak krava\n"); > return 0; > } > > int main(int argc, char **argv) > { > krava(); > return 0; > } > --- > > > 2nd object: > --- > int krava(void) > { > printf("krava\n"); > return 0; > } > --- > > > ..the final executable will call krava function from 2nd object file, > so far so good.. :) > > However, the function krava from the 1st object still stays in the > final executable with no symbol assigned.. as a dead code I'd say. > > I guess it's probably not easy to get rid of that code during the > linking time.. and I haven't found any way to do that. > Is there any? Or what did I miss.. :) > > > thanks, > jirka