summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-05-07 16:01:27 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-05-16 12:48:07 +0200
commitb4e9bdcd4daa09e27e112979750d1f85e3c5496e (patch)
treeaeca242511df8eeefc61b2dc76c910e6915cf681
parentda46868e717a246b726d2baeece734d6e28e528c (diff)
downloadmupdf-b4e9bdcd4daa09e27e112979750d1f85e3c5496e.tar.xz
Add script to find unused functions.
-rw-r--r--Makerules2
-rw-r--r--scripts/findunused.sh6
2 files changed, 7 insertions, 1 deletions
diff --git a/Makerules b/Makerules
index 1e93d3e3..344d07cd 100644
--- a/Makerules
+++ b/Makerules
@@ -22,7 +22,7 @@ SANITIZE_FLAGS += -fsanitize=leak
ifeq ($(build),debug)
CFLAGS += -pipe -g
- LDFLAGS += -g
+ LDFLAGS += -g $(LDREMOVEUNREACH)
else ifeq ($(build),release)
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
diff --git a/scripts/findunused.sh b/scripts/findunused.sh
new file mode 100644
index 00000000..e5b2af94
--- /dev/null
+++ b/scripts/findunused.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+make build=debug -j4
+rm -f build/debug/mutool build/debug/mupdf-gl
+make build=debug XLIBS=-Wl,--print-gc-sections build/debug/mutool 2>&1 | grep 'libmupdf\.' | sort > build/debug/mutool.gc
+make build=debug XLIBS=-Wl,--print-gc-sections build/debug/mupdf-gl 2>&1 | grep 'libmupdf\.' | sort >build/debug/mupdf-gl.gc
+comm -12 build/debug/mutool.gc build/debug/mupdf-gl.gc