浏览代码

Use dead_strip to reduce binary size on OS X

This option seems to be supported all the way back to at least 10.4, so
enabling it for OS X in general should be fine. If not, someone will
yell.

With no libs statically linked, that's a 3% win in binary size, with
just libevent linked statically, this gives us an advantage of 5% in
terms of binary size, and with libevent and openssl statically linked,
we gain over 18% or over 500KB.

Implements ticket 2915.
Sebastian Hahn 13 年之前
父节点
当前提交
1f5c5624f4
共有 2 个文件被更改,包括 8 次插入2 次删除
  1. 5 0
      changes/osx_deadstrip
  2. 3 2
      configure.in

+ 5 - 0
changes/osx_deadstrip

@@ -0,0 +1,5 @@
+  o Minor features:
+    - Use the dead_strip option when building Tor on OS X. This reduces binary
+      size by almost 19% when linking openssl and libevent statically, which
+      we do for TBB.
+

+ 3 - 2
configure.in

@@ -1160,12 +1160,13 @@ else
 fi
 fi
 
 
 # OS X Lion started deprecating the system openssl. Let's just disable
 # OS X Lion started deprecating the system openssl. Let's just disable
-# all deprecation warnings on OS X.
+# all deprecation warnings on OS X. Also, to potentially make the binary
+# a little smaller, let's enable dead_strip.
 case "$host_os" in
 case "$host_os" in
 
 
  darwin*)
  darwin*)
     CFLAGS="$CFLAGS -Wno-deprecated-declarations"
     CFLAGS="$CFLAGS -Wno-deprecated-declarations"
-    ;;
+    LDFLAGS="$LDFLAGS -dead_strip" ;;
 esac
 esac
 
 
 # Add some more warnings which we use in development but not in the
 # Add some more warnings which we use in development but not in the