Friday, November 12, 2010

SBR600: To Thumb? or Not to Thumb? (v0.1) continued..

As I expected, my experiments in the previous blog post (To Thumb? or Not to Thumb? v0.1) were incorrect.
The problem was that for whatever reason (which I haven't yet figured out why), the macros were called from somewhere else in the system.

The file where rpmbuild looked for %optflags was /usr/lib/rpm/redhat/rpmrc instead of /usr/lib/rpm/platform/armv5tel-linux/macros.



















And __global_cflags was called from /usr/lib/rpm/redhat/macros.



















The change in __global_cflags macro was necessary because -O# switch would probably effect the file size and the compile speed. Also, I wanted to get rid of -g switch to save time by not including debugging info.

So here is the result of today's benchmark I did for nled-2.52.

nothumb
real 0m13.701s
user 0m12.190s
sys 0m1.020s

real 0m13.664s
user 0m12.140s
sys 0m1.080s

real 0m13.955s
user 0m12.150s
sys 0m1.140s

mthumb
real 0m13.533s
user 0m11.850s
sys 0m1.040s

real 0m14.821s
user 0m11.830s
sys 0m1.060s

real 0m13.292s
user 0m11.740s
sys 0m1.110s

mthumb mthumb-interwork
real 0m15.665s
user 0m11.780s
sys 0m1.050s

real 0m15.651s
user 0m11.970s
sys 0m0.950s

real 0m13.292s
user 0m11.670s
sys 0m1.170s



[thlee3@fedora-arm ~]$ ls -l rpmbuild/BUILD/nled-2.52-none/*.o
-rw-r--r-- 1 thlee3 thlee3 8248 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nledata.o
-rw-r--r-- 1 thlee3 thlee3 10320 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nledio.o
-rw-r--r-- 1 thlee3 thlee3 8712 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nledisp.o
-rw-r--r-- 1 thlee3 thlee3 7536 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nledit.o
-rw-r--r-- 1 thlee3 thlee3 10676 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nledmisc.o
-rw-r--r-- 1 thlee3 thlee3 14988 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nled.o
-rw-r--r-- 1 thlee3 thlee3 4296 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/qkdisp.o
TOTAL BINARY SIZE: 64776



[thlee3@fedora-arm ~]$ ls -l rpmbuild/BUILD/nled-2.52-mthumb/*.o
-rw-r--r-- 1 thlee3 thlee3 6732 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nledata.o
-rw-r--r-- 1 thlee3 thlee3 9240 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nledio.o
-rw-r--r-- 1 thlee3 thlee3 7376 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nledisp.o
-rw-r--r-- 1 thlee3 thlee3 6400 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nledit.o
-rw-r--r-- 1 thlee3 thlee3 9736 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nledmisc.o
-rw-r--r-- 1 thlee3 thlee3 13652 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nled.o
-rw-r--r-- 1 thlee3 thlee3 4220 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/qkdisp.o 
TOTAL BINARY SIZE:  57356


[thlee3@fedora-arm ~]$ ls -l rpmbuild/BUILD/nled-2.52-mthumb-interwork/*.o
-rw-r--r-- 1 thlee3 thlee3 6732 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nledata.o
-rw-r--r-- 1 thlee3 thlee3 9240 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nledio.o
-rw-r--r-- 1 thlee3 thlee3 7376 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nledisp.o
-rw-r--r-- 1 thlee3 thlee3 6400 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nledit.o
-rw-r--r-- 1 thlee3 thlee3 9736 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nledmisc.o
-rw-r--r-- 1 thlee3 thlee3 13652 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nled.o
-rw-r--r-- 1 thlee3 thlee3 4220 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/qkdisp.o
TOTAL BINARY SIZE:  57356

For nled, there was no difference between -mthumb and -mthumb -mthumb-interwork in terms of file size. But Thumb compiled the binary 11.5% smaller than non-Thumb. This was with -O2.

The size of the entire directory including the program, debugging and docs.

[thlee3@fedora-arm ~]$ du -h rpmbuild/BUILD/
368K rpmbuild/BUILD/nled-2.52-mthumb
368K rpmbuild/BUILD/nled-2.52-mthumb-interwork
388K rpmbuild/BUILD/nled-2.52-none
1.2M rpmbuild/BUILD/

And here are some additional detailed compiling info.
NONE THUMB
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.zV0HzL
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.seL1Lr
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o nled.o nled.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o nledisp.o nledisp.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o nledit.o nledit.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o nledio.o nledio.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o nledmisc.o nledmisc.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o nledata.o nledata.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o qkdisp.o qkdisp.c
cc -o nled nled.o nledisp.o nledit.o nledio.o \
         nledmisc.o nledata.o qkdisp.o -lcurses
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.zSV2St
extracting debug info from /home/thlee3/rpmbuild/BUILDROOT/nled-2.52-6.fc12.arm/usr/bin/nled
Processing files: nled-2.52-6.fc12.armv5tel
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: ld-linux.so.3 ld-linux.so.3(GLIBC_2.4) libc.so.6 libc.so.6(GLIBC_2.4) libgcc_s.so.1 libgcc_s.so.1(GCC_3.5) libncurses.so.5 libtinfo.so.5 rtld(GNU_HASH)
Processing files: nled-debuginfo-2.52-6.fc12.armv5tel
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/thlee3/rpmbuild/BUILDROOT/nled-2.52-6.fc12.arm
Wrote: /home/thlee3/rpmbuild/SRPMS/nled-2.52-6.fc12.src.rpm
Wrote: /home/thlee3/rpmbuild/RPMS/armv5tel/nled-2.52-6.fc12.armv5tel.rpm
Wrote: /home/thlee3/rpmbuild/RPMS/armv5tel/nled-debuginfo-2.52-6.fc12.armv5tel.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.B7GI93

-mthumb
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.se1pq7
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.YXHtHe
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o nled.o nled.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o nledisp.o nledisp.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o nledit.o nledit.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o nledio.o nledio.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o nledmisc.o nledmisc.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o nledata.o nledata.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o qkdisp.o qkdisp.c
cc -o nled nled.o nledisp.o nledit.o nledio.o \
         nledmisc.o nledata.o qkdisp.o -lcurses
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.o8GtKj
extracting debug info from /home/thlee3/rpmbuild/BUILDROOT/nled-2.52-6.fc12.mthumb.arm/usr/bin/nled
Processing files: nled-2.52-6.fc12.mthumb.armv5tel
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: ld-linux.so.3 ld-linux.so.3(GLIBC_2.4) libc.so.6 libc.so.6(GLIBC_2.4) libgcc_s.so.1 libgcc_s.so.1(GCC_3.5) libncurses.so.5 libtinfo.so.5 rtld(GNU_HASH)
Processing files: nled-debuginfo-2.52-6.fc12.mthumb.armv5tel
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/thlee3/rpmbuild/BUILDROOT/nled-2.52-6.fc12.mthumb.arm
Wrote: /home/thlee3/rpmbuild/SRPMS/nled-2.52-6.fc12.mthumb.src.rpm
Wrote: /home/thlee3/rpmbuild/RPMS/armv5tel/nled-2.52-6.fc12.mthumb.armv5tel.rpm
Wrote: /home/thlee3/rpmbuild/RPMS/armv5tel/nled-debuginfo-2.52-6.fc12.mthumb.armv5tel.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.0DqX9f


-mthumb -mthumb-interwork
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.oYmHeB
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.YJCHV9
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o nled.o nled.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o nledisp.o nledisp.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o nledit.o nledit.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o nledio.o nledio.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o nledmisc.o nledmisc.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o nledata.o nledata.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o qkdisp.o qkdisp.c
cc -o nled nled.o nledisp.o nledit.o nledio.o \
         nledmisc.o nledata.o qkdisp.o -lcurses
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.3TroEh
extracting debug info from /home/thlee3/rpmbuild/BUILDROOT/nled-2.52-6.fc12.mthumb.arm/usr/bin/nled
Processing files: nled-2.52-6.fc12.mthumb.armv5tel
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: ld-linux.so.3 ld-linux.so.3(GLIBC_2.4) libc.so.6 libc.so.6(GLIBC_2.4) libgcc_s.so.1 libgcc_s.so.1(GCC_3.5) libncurses.so.5 libtinfo.so.5 rtld(GNU_HASH)
Processing files: nled-debuginfo-2.52-6.fc12.mthumb.armv5tel
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/thlee3/rpmbuild/BUILDROOT/nled-2.52-6.fc12.mthumb.arm
Wrote: /home/thlee3/rpmbuild/SRPMS/nled-2.52-6.fc12.mthumb.src.rpm
Wrote: /home/thlee3/rpmbuild/RPMS/armv5tel/nled-2.52-6.fc12.mthumb.armv5tel.rpm
Wrote: /home/thlee3/rpmbuild/RPMS/armv5tel/nled-debuginfo-2.52-6.fc12.mthumb.armv5tel.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.RVsZ5H



* ADDITIONAL INFO ADDED on 11/12/2010
[thlee3@fedora-arm ~]$ ls -la rpmbuild/BUILD/nled-2.52-none/nled
-rwxr-xr-x 1 thlee3 thlee3 50449 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nled

 
[thlee3@fedora-arm ~]$ ls -la rpmbuild/BUILD/nled-2.52-mthumb/nled
-rwxr-xr-x 1 thlee3 thlee3 42676 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nled


[thlee3@fedora-arm ~]$ ls -la rpmbuild/BUILD/nled-2.52-mthumb-interwork/nled
-rwxr-xr-x 1 thlee3 thlee3 42676 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nled

No comments:

Post a Comment