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 30154431FD2
\r
6 for <notmuch@notmuchmail.org>; Sat, 3 Nov 2012 20:24:21 -0700 (PDT)
\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 qRwXGBUsvogE for <notmuch@notmuchmail.org>;
\r
16 Sat, 3 Nov 2012 20:24:20 -0700 (PDT)
\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 171BF431FAF
\r
21 for <notmuch@notmuchmail.org>; Sat, 3 Nov 2012 20:24:20 -0700 (PDT)
\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 qA43GGa3025693;
\r
24 Sat, 3 Nov 2012 20:16:16 -0700 (PDT)
\r
25 Received: (from blakej@localhost)
\r
26 by foo.net (8.14.5+Sun/8.14.5/Submit) id qA43GGQx025692;
\r
27 Sat, 3 Nov 2012 20:16:16 -0700 (PDT)
\r
28 From: Blake Jones <blakej@foo.net>
\r
29 To: notmuch@notmuchmail.org
\r
30 Subject: [PATCH 07/10] gen-version-script: parse Solaris "nm" output (Solaris
\r
32 Date: Sat, 3 Nov 2012 20:15:59 -0700
\r
33 Message-Id: <1351998962-25135-8-git-send-email-blakej@foo.net>
\r
34 X-Mailer: git-send-email 1.7.3.2
\r
35 In-Reply-To: <1351998962-25135-1-git-send-email-blakej@foo.net>
\r
36 References: <1351998962-25135-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]); Sat, 03 Nov 2012 20:16:16 -0700 (PDT)
\r
39 X-Mailman-Approved-At: Sun, 04 Nov 2012 01:30:19 -0800
\r
40 Cc: Blake Jones <blakej@foo.net>
\r
41 X-BeenThere: notmuch@notmuchmail.org
\r
42 X-Mailman-Version: 2.1.13
\r
44 List-Id: "Use and development of the notmuch mail system."
\r
45 <notmuch.notmuchmail.org>
\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
49 List-Post: <mailto:notmuch@notmuchmail.org>
\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
53 X-List-Received-Date: Sun, 04 Nov 2012 03:24:21 -0000
\r
55 The output of "nm" on Solaris is substantially different from that on
\r
56 Linux, and the current version of gen-version-script is tied to the
\r
57 Linux "nm" output. This patch separates the parts of "nm" processing
\r
58 which are dependent on the output format into a couple shell functions,
\r
59 and makes another shell function to use the appropriate version of
\r
60 "c++filt" to demangle symbols. It also modifies lib/Makefile.local
\r
61 to pass the generated symbol table correctly to the Solaris linker.
\r
63 lib/Makefile.local | 4 ++++
\r
64 lib/gen-version-script.sh | 50 ++++++++++++++++++++++++++++++++++++++++-----
\r
65 2 files changed, 49 insertions(+), 5 deletions(-)
\r
67 diff --git a/lib/Makefile.local b/lib/Makefile.local
\r
68 index 0c6b258..2068e4a 100644
\r
69 --- a/lib/Makefile.local
\r
70 +++ b/lib/Makefile.local
\r
71 @@ -30,7 +30,11 @@ LIBRARY_SUFFIX = so
\r
72 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
\r
73 SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
\r
74 LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
\r
75 +ifeq ($(PLATFORM),SOLARIS)
\r
76 +LIBRARY_LINK_FLAG = -shared -Wl,-M notmuch.sym -Wl,-soname=$(SONAME) -Wl,--no-undefined -lc
\r
78 LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) -Wl,--no-undefined
\r
80 ifeq ($(PLATFORM),OPENBSD)
\r
81 LIBRARY_LINK_FLAG += -lc
\r
83 diff --git a/lib/gen-version-script.sh b/lib/gen-version-script.sh
\r
84 index 76670d5..d7d96da 100644
\r
85 --- a/lib/gen-version-script.sh
\r
86 +++ b/lib/gen-version-script.sh
\r
90 # we go through a bit of work to get the unmangled names of the
\r
91 # typeinfo symbols because of
\r
92 @@ -11,10 +12,44 @@ fi
\r
96 +if [ `uname -s` == SunOS ] ; then
\r
98 + # Using Solaris "nm", a defined symbol looks like this:
\r
100 + # [Index] Value Size Type Bind Other Shndx Name
\r
101 + # [15] | 128| 16|FUNC |GLOB |0 |1 |notmuch_tags_get
\r
103 + # and an undefined symbol looks like this:
\r
105 + # [Index] Value Size Type Bind Other Shndx Name
\r
106 + # [35] | 0| 0|NOTY |GLOB |0 |UNDEF |notmuch_tags_get
\r
108 + find_xapian_error() {
\r
109 + nawk -F'\|' '$7 !~ "UNDEF" && $8 ~ "Xapian.*Error" { print $8 }'
\r
111 + find_compat_syms() {
\r
112 + nawk -F'\|' '$7 !~ "UNDEF" && $8 ~ "get(line|delim)" { print $8 ";" }'
\r
118 + find_xapian_error() {
\r
119 + awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $3 ~ "Xapian.*Error" {print $3}'
\r
121 + find_compat_syms() {
\r
122 + awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $2 == "T" && $3 ~ "^get(line|delim)$" {print $3 ";"}'
\r
129 printf '{\nglobal:\n'
\r
130 -nm $* | awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $3 ~ "Xapian.*Error" {print $3}' | sort | uniq | \
\r
131 -while read sym; do
\r
132 - demangled=$(c++filt $sym)
\r
134 +# Find the typeinfo for "Xapian::*Error"s.
\r
135 +nm $* | find_xapian_error | sort | uniq | while read sym; do
\r
136 + demangled=$(demangle $sym)
\r
140 @@ -23,6 +58,11 @@ while read sym; do
\r
144 -nm $* | awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $2 == "T" && $3 ~ "^get(line|delim)$" {print $3 ";"}'
\r
145 -sed -n 's/^[[:space:]]*\(notmuch_[a-z_]*\)[[:space:]]*(.*/ \1;/p' $HEADER
\r
147 +# Find the "compat" syms that we need to export.
\r
148 +nm $* | find_compat_syms
\r
150 +# Finally, get the real notmuch symbols.
\r
151 +sed -n 's/^[ ]*\(notmuch_[a-z_]*\)[ ]*(.*/ \1;/p' $HEADER
\r
153 printf "local: *;\n};\n"
\r