FloofLeBo <bluswedshooz@xxxxxxxx> writes: > And now I'll go to the dead-stripping. How can I be sure that unused code > from the external and internal static libraries is not shipped with the > shared object ? > > I tried naively to add the "-Wl,-dead-strip" to the gcc -shared command, but > this gave me the warning: > > /usr/bin/ld: warning: cannot find entry symbol ad-strip; defaulting to > 0000000000071f00 > > What would gcc need to only pull needed code for the static libs ? Neither the GNU linker nor gold support an option -dead-strip. That is two options: -d, and -e ad-strip. Hence the warning. They both support an option --gc-sections, which tells them to discard sections that are not needed. To use that to full effect, you need to compile with -ffunction-sections -fdata-sections. So this will look like gcc -ffunction-sections -fdata-sections -c file.cc gcc -o file file.o -Wl,--gc-sections Ian