On Friday 12 May 2017 20:28:54 Fred van Stappen wrote: > > > accidentally not working -XX, with active smartlinking it was reduced to > > 26072 bytes. > > Do you mean that you have a trick to do smartlinking working for libraries > ? > No, the first time I presented the benchmark results in the meaning I had added -XX to the FPC parameters but actually I had not.
> > Yup, I get 29.9 KB with fpc -k--gc-sections libnude.pas > > So what is the conclusion, what is the trick ? > Compile with " fpc -k--gc-sections libnude.pas " Every FPC program or library contains system.o which is 710KB before strip. It seems that -XX does not work with "library" so the --gc-sections linker command must be supplied to the linker directly. " fpc -XX -s prognude.pas " produces ppas.sh: =============== #!/bin/sh DoExitAsm () { echo "An error occurred while assembling $1"; exit 1; } DoExitLink () { echo "An error occurred while linking $1"; exit 1; } echo Linking prognude OFS=$IFS IFS=" " /usr/bin/ld -b elf32-i386 -m elf_i386 --gc-sections -s -L. -o prognude link.res if [ $? != 0 ]; then DoExitLink prognude; fi IFS=$OFS =============== " fpc -XX -s libnude.pas " produces ppas.sh: =============== #!/bin/sh DoExitAsm () { echo "An error occurred while assembling $1"; exit 1; } DoExitLink () { echo "An error occurred while linking $1"; exit 1; } echo Linking liblibnude.so OFS=$IFS IFS=" " /usr/bin/ld -b elf32-i386 -m elf_i386 -init FPC_SHARED_LIB_START -fini FPC_LIB_EXIT -soname liblibnude.so -shared -L. -o liblibnude.so link.res if [ $? != 0 ]; then DoExitLink liblibnude.so; fi IFS=$OFS echo Linking liblibnude.so OFS=$IFS IFS=" " /usr/bin/strip --discard-all --strip-debug liblibnude.so if [ $? != 0 ]; then DoExitLink liblibnude.so; fi IFS=$OFS =============== Note the missing --gc-sections. Martin ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk