1 Return-Path: <blakej@foo.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 01661431FAF
\r
6 for <notmuch@notmuchmail.org>; Tue, 13 Nov 2012 18:10:15 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id i39UjcEV5msq for <notmuch@notmuchmail.org>;
\r
16 Tue, 13 Nov 2012 18:10:13 -0800 (PST)
\r
17 Received: from foo.net (70-36-235-136.dsl.static.sonic.net [70.36.235.136])
\r
18 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id E4105431FC2
\r
21 for <notmuch@notmuchmail.org>; Tue, 13 Nov 2012 18:10:11 -0800 (PST)
\r
22 Received: from foo.net (localhost [127.0.0.1])
\r
23 by foo.net (8.14.5+Sun/8.14.5) with ESMTP id qAE2A917018925;
\r
24 Tue, 13 Nov 2012 18:10:09 -0800 (PST)
\r
25 Received: (from blakej@localhost)
\r
26 by foo.net (8.14.5+Sun/8.14.5/Submit) id qAE2A911018921;
\r
27 Tue, 13 Nov 2012 18:10:09 -0800 (PST)
\r
28 From: Blake Jones <blakej@foo.net>
\r
29 To: notmuch@notmuchmail.org
\r
30 Subject: [PATCH v3 07/10] gen-version-script: parse Solaris "nm" output
\r
32 Date: Tue, 13 Nov 2012 18:10:02 -0800
\r
33 Message-Id: <1352859005-18631-8-git-send-email-blakej@foo.net>
\r
34 X-Mailer: git-send-email 1.7.3.2
\r
35 In-Reply-To: <1352859005-18631-1-git-send-email-blakej@foo.net>
\r
36 References: <1352859005-18631-1-git-send-email-blakej@foo.net>
\r
37 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2
\r
38 (foo.net [127.0.0.1]); Tue, 13 Nov 2012 18:10:09 -0800 (PST)
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Wed, 14 Nov 2012 02:10:15 -0000
\r
53 The output of "nm" on Solaris is substantially different from that on
\r
54 Linux, and the current version of gen-version-script is tied to the
\r
55 Linux "nm" output. This patch separates the parts of "nm" processing
\r
56 which are dependent on the output format into a couple shell functions,
\r
57 and makes another shell function to use the appropriate version of
\r
58 "c++filt" to demangle symbols. It also modifies lib/Makefile.local
\r
59 to pass the generated symbol table correctly to the Solaris linker.
\r
61 lib/Makefile.local | 4 +++
\r
62 lib/gen-version-script.sh | 50 ++++++++++++++++++++++++++++++++++++++++----
\r
63 2 files changed, 49 insertions(+), 5 deletions(-)
\r
65 diff --git a/lib/Makefile.local b/lib/Makefile.local
\r
66 index 0c6b258..2068e4a 100644
\r
67 --- a/lib/Makefile.local
\r
68 +++ b/lib/Makefile.local
\r
69 @@ -30,7 +30,11 @@ LIBRARY_SUFFIX = so
\r
70 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
\r
71 SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
\r
72 LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
\r
73 +ifeq ($(PLATFORM),SOLARIS)
\r
74 +LIBRARY_LINK_FLAG = -shared -Wl,-M notmuch.sym -Wl,-soname=$(SONAME) -Wl,--no-undefined -lc
\r
76 LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) -Wl,--no-undefined
\r
78 ifeq ($(PLATFORM),OPENBSD)
\r
79 LIBRARY_LINK_FLAG += -lc
\r
81 diff --git a/lib/gen-version-script.sh b/lib/gen-version-script.sh
\r
82 index 76670d5..ecf44f0 100644
\r
83 --- a/lib/gen-version-script.sh
\r
84 +++ b/lib/gen-version-script.sh
\r
86 +# This script is invoked via "sh .../gen-version-script.sh".
\r
88 # we go through a bit of work to get the unmangled names of the
\r
89 # typeinfo symbols because of
\r
90 @@ -11,10 +12,44 @@ fi
\r
94 +if [ `uname -s` = SunOS ] ; then
\r
96 + # Using Solaris "nm", a defined symbol looks like this:
\r
98 + # [Index] Value Size Type Bind Other Shndx Name
\r
99 + # [15] | 128| 16|FUNC |GLOB |0 |1 |notmuch_tags_get
\r
101 + # and an undefined symbol looks like this:
\r
103 + # [Index] Value Size Type Bind Other Shndx Name
\r
104 + # [35] | 0| 0|NOTY |GLOB |0 |UNDEF |notmuch_tags_get
\r
106 + find_xapian_error() {
\r
107 + nawk -F'\|' '$7 !~ "UNDEF" && $8 ~ "Xapian.*Error" { print $8 }'
\r
109 + find_compat_syms() {
\r
110 + nawk -F'\|' '$7 !~ "UNDEF" && $8 ~ "get(line|delim)" { print $8 ";" }'
\r
116 + find_xapian_error() {
\r
117 + awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $3 ~ "Xapian.*Error" {print $3}'
\r
119 + find_compat_syms() {
\r
120 + awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $2 == "T" && $3 ~ "^get(line|delim)$" {print $3 ";"}'
\r
127 printf '{\nglobal:\n'
\r
128 -nm $* | awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $3 ~ "Xapian.*Error" {print $3}' | sort | uniq | \
\r
129 -while read sym; do
\r
130 - demangled=$(c++filt $sym)
\r
132 +# Find the typeinfo for "Xapian::*Error"s.
\r
133 +nm $* | find_xapian_error | sort | uniq | while read sym; do
\r
134 + demangled=`demangle $sym`
\r
138 @@ -23,6 +58,11 @@ while read sym; do
\r
142 -nm $* | awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $2 == "T" && $3 ~ "^get(line|delim)$" {print $3 ";"}'
\r
143 -sed -n 's/^[[:space:]]*\(notmuch_[a-z_]*\)[[:space:]]*(.*/ \1;/p' $HEADER
\r
145 +# Find the "compat" syms that we need to export.
\r
146 +nm $* | find_compat_syms
\r
148 +# Finally, get the real notmuch symbols.
\r
149 +sed -n 's/^[ ]*\(notmuch_[a-z_]*\)[ ]*(.*/ \1;/p' $HEADER
\r
151 printf "local: *;\n};\n"
\r