Relative Content

Tag Archive for c++linker

How to export dynamic symbols only for used functions?

On x86_64 linux, I’m currently using -rdynamic as a linker flag (to gcc) to export used symbols in a program so that I can trace problems when it causes SEGV, or some other places where I output the backtrace using glibc’s backtrace(). This program depends on static libraries, which may contain other unused functions which depend on some more static libraries. The program and libraries are built with -ffunction-sections, and the linker has -Wl,--gc-sections -Wl,--as-needed. This combination of flags allows the program to be built without any reference errors.

How to export dynamic symbols only for used functions?

On x86_64 linux, I’m currently using -rdynamic as a linker flag (to gcc) to export used symbols in a program so that I can trace problems when it causes SEGV, or some other places where I output the backtrace using glibc’s backtrace(). This program depends on static libraries, which may contain other unused functions which depend on some more static libraries. The program and libraries are built with -ffunction-sections, and the linker has -Wl,--gc-sections -Wl,--as-needed. This combination of flags allows the program to be built without any reference errors.

Multiple definition of ‘function’ first defined here

I have read many posts about this problem on stackoverflow and I have tried them but having no luck. I have removed some files which inherit the interface class but still the error multiple definition for functions in the protocol.h file.