On Monday, January 4, 2016 at 6:48:12 AM UTC-5, Mouse wrote:
>
> Considering how the library is designed, I'm not sure how much work it
> would be. But it wood be great if we could offer that target.
>
I think this is an easy cut-in. Something like below, which looks for the
'lean' MAKECMDGOALS and adds the appropriate flags.
Below are the results I am seeing on OS X 10.9, but there's nothing
surprising about the results. cryptest.exe does not really have an
opportunity to discard anything because it tries to exercise everything :)
And libcryptopp.{so|dylib} can't really discard much of anything because it
may be needed.
However, when we compile and link a smaller program like:
int main( int, char** ) {
Integer j("100000000000000000000000000000000");
j %= 1999;
cout << "j: " << j << endl;
return 0;
}
Then we get a significant savings:
Lean:
$ ls -l integer.exe
-rwx------ 1 jwalton staff 162012 Jan 4 13:00 integer.exe
Normal:
$ ls -l integer.exe
-rwx------ 1 jwalton staff 2636952 Jan 4 13:02 integer.exe
*****
Lean:
$ ls -l cryptest.exe libcryptopp.dylib
-rwx------ 1 jwalton staff 9023592 Jan 4 12:51 cryptest.exe
-rwx------ 1 jwalton staff 4828076 Jan 4 12:51 libcryptopp.dylib
Normal:
$ ls -l cryptest.exe libcryptopp.dylib
-rwx------ 1 jwalton staff 9580856 Jan 4 12:45 cryptest.exe
-rwx------ 1 jwalton staff 4832404 Jan 4 12:46 libcryptopp.dylib
*****
$ cat git.diff
diff --git a/GNUmakefile b/GNUmakefile
index bf2fa54..af2b557 100755
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -155,6 +155,25 @@ endif
+# Remove dead code for lean target
+ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
+ ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),)
+ CXXFLAGS += -ffunction-sections
+ endif # CXXFLAGS
+ ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),)
+ CXXFLAGS += -fdata-sections
+ endif # CXXFLAGS
+ ifneq ($(IS_DARWIN),0)
+ ifeq ($(findstring -Wl,-dead_strip,$(LDFLAGS)),)
+ LDFLAGS += -Wl,-dead_strip
+ endif
+ else # BSD, Linux and Unix
+ ifeq ($(findstring -Wl,--gc-sections,$(LDFLAGS)),)
+ LDFLAGS += -Wl,--gc-sections
+ endif
+ endif
+endif #
+
@@ -336,6 +355,9 @@ deps GNUmakefile.deps:
.PHONY: asan ubsan align aligned
asan ubsan align aligned: libcryptopp.a cryptest.exe
+.PHONY: lean
+lean: libcryptopp.a cryptest.exe
+
--
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.