On Thursday 27 November 2014 13:42:27 Gustavo Sverzut Barbieri wrote: > I'm asking because from Peter Wu's email we're 26384 - 26380 = 4Kb > heavier in the whole installed set of binaries. If this is correct I > doubt the gc-sections is making any difference in the linkage of > static libraries (src/shared). In this case my *assumption* (as I have > no deep knowledge about the linker) is that it's selectively picking > the symbols it uses and leaving the other stuff out of it. > > Peter, could you provide more in-depth information, for instance you > could see: > - what binaries are bigger; > - what -Wl,--gc-sections -Wl,--print-gc-section says
OK, here is a description of the test setup such you can reproduce it. Environment: - Arch Linux x86_64 in a QEMU VM (live iso with systemd makedepends installed). - with systemd git in /tmp/systemd. - master is at 9a20fcbcd1b010ad88bfbb8b7f0417bec7327fb4 - gcc 4.9.2 - binutils 2.24-8 (the broken one) Commands to build two versions: cd /tmp/systemd # Currently at 9a20fcbcd1b010ad88bfbb8b7f0417bec7327fb4 + patch to # remove --gc-sections and -f{data,function}-sections git clean -xfd && ./autogen.sh && mkdir build && cd $_ && ../configure && make -j6 && make install DESTDIR=$PWD/fs && (cd fs && find * -type f -printf '%h/%f\t%s\n') > /tmp/0.txt # Now let's see what happens with --gc-sections git checkout HEAD~ && git clean -xfd && ./autogen.sh && mkdir build && cd $_ && ../configure && make -j6 && make install DESTDIR=$PWD/fs && (cd fs && find * -type f -printf '%h/%f\t%s\n') > /tmp/1.txt Now build a table to compare the sizes: join {0,1}.txt | awk '$2!=$3{print $2,$3,$2-$3,$2/$3,$1}' | sort -k4n | column -t > results.txt The columns explained: 1. Size of binaries built without --gc-sections and -f... 2. Size of binaries built with --gc-sections and -f... 3. Absolute "saved" bytes when built with --gc-sections. 4. Ratio between the sizes, numbers smaller than 1 indicate a saving, numbers larger than 1 show that --gc-sections increase the sizes. These results are strange, it suggests that --gc-sections make the binaries larger overall! I have repeated it three times just to make sure that I did not made a mistake. Reran the --gc-section one again with --print-gc-sections and confirmed that the installed files did not grow in size (in case there is another bug...). Full configure, make and make install log (6.7 MiB): https://lekensteyn.nl/junk/systemd-buildlog.txt (the system time is one hour behind due to a misconfiguration.) Hope it helps. David, what toolchain and options are you using? -- Kind regards, Peter https://lekensteyn.nl _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel