~ubuntu-branches/ubuntu/quantal/openmotif/quantal

« back to all changes in this revision

Viewing changes to config/util/elistgen.ibm

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bauer
  • Date: 2010-06-23 12:12:31 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100623121231-u89gxdp51sg9wjj2
Tags: 2.3.0-1
* New Maintainer (Closes: #379258) 
* Acknowledge NMU changes
* New upstream release (Closes: #494375)
* Get rid of security patches as they are already part of new upstream
  release (00-xpmvuln.openmotif.patch, 342092-CVE-2005-3964.patch)
* Bump Standards to 3.8.4
* Added {misc:Depends} to make the package lintian cleaner
* Fix weak-library-dev-dependency by adding ${binary:Version}) for the
  -dev Package of openmotif
* Let package depend on autotools-dev to use newer autotools-helper-files
* Work around an autoconf-bug (Gentoo-Bug #1475)
* Added Client-side anti-aliased fonts support via XFT
* Added UTF-8 and UTF8_STRING atom support
* Ability to show text and pixmaps in Label, LabelGadget and all
  derived widgets
* Support of PNG/JPEG image formats in the same way as XPM is supported
* Increase FILE_OFFSET_BITS to 64 to show files >2GB in file-selector
  Idea taken from Magne Oestlyngen (Closes: #288537)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
XCOMM!/bin/sh
 
2
XCOMM $XConsortium: elistgen.ibm /main/2 1996/12/04 10:13:18 swick $
 
3
XCOMM
 
4
XCOMM #########################################################################
 
5
XCOMM Construct shared-library export lists for IBM-AIX based on standardized
 
6
XCOMM export list description file
 
7
XCOMM
 
8
XCOMM Usage: elistgen libfoo.sl libfoo.elist > libfoo.lopt
 
9
XCOMM
 
10
XCOMM   libfoo.a     => shared library of interest
 
11
XCOMM   libfoo.elist => Meta description of necessary export list.
 
12
XCOMM
 
13
XCOMM    The output file, "libfoo.lopt" may then be passed to the IBM linker to 
 
14
XCOMM    reconstruct the shared library, libfoo.sl.
 
15
XCOMM
 
16
XCOMM Author: Yanling Qi 10/03/94, Last updated 10/03/94
 
17
XCOMM (c) Copyright 1996 Digital Equipment Corporation.
 
18
XCOMM (c) Copyright 1996 Hewlett-Packard Company.
 
19
XCOMM (c) Copyright 1994,1996 International Business Machines Corp.
 
20
XCOMM (c) Copyright 1996 Sun Microsystems, Inc.
 
21
XCOMM (c) Copyright 1996 Novell, Inc. 
 
22
XCOMM (c) Copyright 1996 FUJITSU LIMITED.
 
23
XCOMM (c) Copyright 1996 Hitachi.
 
24
XCOMM
 
25
XCOMM #########################################################################
 
26
 
 
27
#define HASH #
 
28
 
 
29
XCOMM Utility programs
 
30
FILTER=CXXFILT                  # C++ symbol demangler
 
31
AWK=awk                         # awk
 
32
 
 
33
XCOMM For dump, cat, pr, expand, awk, c++filt
 
34
PATH=/usr/bin:/bin:/usr/ucb:/usr/lpp/xlC/bin
 
35
 
 
36
XCOMM Temporary files
 
37
EXPORTLIST=/tmp/elistgen1.$$    # export directives from "libfoo.list"
 
38
NMLIST=/tmp/elistgen2.$$        # name list from libfoo.sl
 
39
FILTLIST=/tmp/elistgen3.$$      # demangled (C++) version of above
 
40
 
 
41
XCOMM Print useful information
 
42
echo "*" `date`
 
43
echo "* This linker options list was produced by" $0
 
44
echo "* Input export list description taken from:" $2
 
45
echo "* Target library:" $1
 
46
echo "* Target Operating System:" `uname`
 
47
echo "*"
 
48
 
 
49
XCOMM Extract the globally visible symbols from target library
 
50
dump -g $1 | $AWK  '$1 ~ /[0-9][0-9]/ && $2 !~ /^[\.]/ {print $2}' > $NMLIST
 
51
 
 
52
XCOMM Demangle the global library symbols
 
53
${FILTER:-cat} $NMLIST > $FILTLIST
 
54
 
 
55
XCOMM
 
56
XCOMM Clean up the export-list description file.
 
57
XCOMM Note that C++ symbols may have embedded spaces in them.
 
58
XCOMM
 
59
$AWK '
 
60
    BEGIN {
 
61
        csyms     = 0;          # C   language symbols in libfoo.list
 
62
        cplusplus = 0;          # C++ language symbols in libfoo.list
 
63
        isyms     = 0;          # C   internal symbols in libfoo.list
 
64
        iplusplus = 0;          # C++ internal symbols in libfoo.list
 
65
        count     = 0;          # Running count of symbols
 
66
        implicit  = "";         # Handling of implicit symbols.
 
67
    }
 
68
    $1 == "default" {
 
69
        HASH A default clause suppresses warnings about implicit symbols.
 
70
        if ($2 != "" && $2 != "force" && $2 != "public" && 
 
71
            $2 != "private" && $2 != "internal") {
 
72
            print "# Warning: illegal default clause:", $2 | "cat 1>&2";
 
73
            next;
 
74
        }
 
75
        if (implicit != "")
 
76
            print "# Warning: multiple default clauses." | "cat 1>&2";
 
77
        implicit = $2;
 
78
        next;
 
79
    }
 
80
    $1 == "force" || $1 == "public" || $1 == "private" {
 
81
        csyms ++;
 
82
        symbol[count++] = $1 ";;" $2;
 
83
        next;
 
84
    }
 
85
    $1 == "publicC++" || $1 == "privateC++" {
 
86
        HASH forceC++ is unsupported because we only know how to demangle,
 
87
        HASH not how to mangle symbols, and the final ld input file must
 
88
        HASH be mangled.
 
89
        cplusplus ++;
 
90
        string = $2;
 
91
        for (n = 3; n <= NF; n++)
 
92
            string = string " " $n;
 
93
        symbol[count++] = $1 ";;" string;
 
94
        next;
 
95
    }
 
96
    $1 == "internal" {
 
97
        isyms ++;
 
98
        symbol[count++] = $1 ";;" $2;
 
99
        next;
 
100
    }
 
101
    $1 == "internalC++" {
 
102
        iplusplus ++;
 
103
        string = ";;" $2;
 
104
        for (n = 3; n <= NF; n++)
 
105
            string = string " " $n;
 
106
        symbol[count++] = $1 ";;" string;
 
107
        next;
 
108
    }
 
109
    $1 == "#line" || $1 == "#" {
 
110
        HASH cpp will have removed comments, but may have added other stuff.
 
111
        next;
 
112
    }
 
113
    NF > 0 {
 
114
        print "# Warning: unrecognized directive:", $0 | "cat 1>&2";
 
115
        next;
 
116
    }
 
117
    END  {
 
118
        printf("# Exporting %d C and %d C++ symbols, hiding %d and %d.\n",
 
119
               csyms, cplusplus, isyms, iplusplus) | "cat 1>&2";
 
120
        if (implicit != "") {
 
121
            print "# Unspecified symbols are " implicit "." | "cat 1>&2";
 
122
            print "default;;" implicit;
 
123
        }
 
124
        for (i in symbol)
 
125
            print symbol[i];
 
126
    }
 
127
' $2 > $EXPORTLIST
 
128
 
 
129
XCOMM
 
130
XCOMM Read in the above files and write result to stdout.  Use the
 
131
XCOMM delimiter ";" to identify the entries in the symbol lookup table.
 
132
XCOMM
 
133
(pr -m -s";" -t -w1024 $NMLIST $FILTLIST | expand -t 1; cat $EXPORTLIST) | $AWK '
 
134
    BEGIN {
 
135
        FS = ";";
 
136
        implicit = 0;
 
137
    }
 
138
    NF == 2 {
 
139
        HASH This is "pr" output, i.e., symbol translation table
 
140
        r2=$2
 
141
        gsub(/ /,"",r2);       # Remove spaces because c++filt is unpredictable
 
142
        syms[r2] = $1;
 
143
        r1=$1;
 
144
        gsub(/ /,"",r1);
 
145
        mangled[r1] = 1;       # Save the mangling because the export lists
 
146
                               HASH sometimes use it instead of a prototype.
 
147
        next;
 
148
    }
 
149
    NF == 3 && $1 == "default" {
 
150
        HASH Treatment of unspecified symbols.
 
151
        if ($3 == "internal")
 
152
            implicit = 1;
 
153
        else if ($3 == "private" || $3 == "privateC++")
 
154
            implicit = 2;
 
155
        else if ($3 == "public" || $3 == "publicC++")
 
156
            implicit = 3;
 
157
        else # $3 == "force"
 
158
            implicit = 4;
 
159
        next;
 
160
    }
 
161
    NF == 3 {
 
162
        HASH Generate canonical demangled form as an alternate symbol.
 
163
        alt=$3;
 
164
        gsub(/ \.\.\./,",...",alt); # change " ..." to ",..." to match c++filt
 
165
        gsub(/ /,"",alt);           # remove all spaces
 
166
        gsub(/\(void\)/,"()",alt);  # change "(void)" to "()" to match c++filt
 
167
 
 
168
        HASH Parse our instructions for this symbol.
 
169
        if ($1 == "internal" || $1 == "internalC++")
 
170
            export = 1;
 
171
        else if ($1 == "private" || $1 == "privateC++")
 
172
            export = 2;
 
173
        else if ($1 == "public" || $1 == "publicC++")
 
174
            export = 3;
 
175
        else # $1 == "force"
 
176
            export = 4;
 
177
 
 
178
        HASH Process it.
 
179
        if ((length(syms[alt]) > 0) || mangled[alt]) {
 
180
            HASH This symbol is present in the library.
 
181
            if (donelist[alt])
 
182
                print "# Warning: Duplicate entry for", $3, 
 
183
                    "in export list" | "cat 1>&2";
 
184
            if (donelist[alt] < export) {
 
185
                if (export > 1)
 
186
                    print syms[alt];
 
187
                donelist[alt] = export;
 
188
            }
 
189
        } else { 
 
190
            HASH Print forced-export symbols without complaining.
 
191
            if (export == 4) {
 
192
                print alt;
 
193
                donelist[alt] = export;
 
194
            } else {
 
195
                print "# Warning:", $3,
 
196
                    "was not in the nm list for this library" | "cat 1>&2";
 
197
            }
 
198
        }
 
199
 
 
200
        next;
 
201
    }
 
202
    END { 
 
203
        HASH Process implicit symbols.
 
204
        for (i in syms) {
 
205
            if ((! donelist[i]) && (length(syms[i]) > 0)) {
 
206
                HASH Do not complain about C++ virtual function tables.
 
207
                if (implicit == 0 && syms[i] !~ /^__vft[0-9]*_/)
 
208
                    print "# Warning:", syms[i],
 
209
                        "was not in the export list" | "cat 1>&2";
 
210
                if (implicit > 1)
 
211
                    print syms[i];
 
212
            }
 
213
        }
 
214
    }
 
215
'
 
216
 
 
217
XCOMM Clean up temporary files
 
218
rm $EXPORTLIST
 
219
rm $NMLIST
 
220
rm $FILTLIST