Imported Upstream version 2.4.2
[platform/upstream/libtool.git] / tests / dumpbin-symbols.at
1 # dumpbin-symbols.at -- libtool "dumpbin -symbols" support    -*- Autotest -*-
2
3 #   Copyright (C) 2010 Free Software Foundation, Inc.
4 #
5 #   This file is part of GNU Libtool.
6 #
7 # GNU Libtool is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2 of
10 # the License, or (at your option) any later version.
11 #
12 # GNU Libtool is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Libtool; see the file COPYING.  If not, a copy
19 # can be downloaded from  http://www.gnu.org/licenses/gpl.html,
20 # or obtained by writing to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 ####
23
24 AT_BANNER([Windows tests.])
25 AT_SETUP([dumpbin -symbols section hiding])
26
27 # I don't know of a stable way to create a pair of objects that
28 # exhibits the potential problem, so this test fakes it by
29 # testing with output from a case that do have the potential
30 # problem.
31
32 # First check if the global_symbol_pipe can handle the below
33 # test case at all, and skip if $NM is not MS dumpbin.
34
35 AT_DATA([variable.c],
36 [[
37 int some_variable = 0;
38 ]])
39
40 AT_CHECK([$CC $CPPFLAGS $CFLAGS -c variable.c], [], [ignore], [ignore])
41 AT_CHECK([$NM variable.$OBJEXT], [], [stdout], [ignore])
42 AT_CHECK([grep 'External.*some_variable' stdout || exit 77], [], [ignore])
43
44 eval `$LIBTOOL --config | $EGREP '^(global_symbol_pipe)='`
45
46 AT_DATA([dumpbin-output],
47 [[
48 Dump of file foo.obj
49
50 File Type: COFF OBJECT
51
52 COFF SYMBOL TABLE
53 000 00AB766F ABS    notype       Static       | @comp.id
54 001 00000001 ABS    notype       Static       | @feat.00
55 002 00000000 SECT1  notype       Static       | .drectve
56     Section length   8F, #relocs    0, #linenums    0, checksum        0
57 004 00000000 SECT2  notype       Static       | .debug$S
58     Section length 44B4, #relocs   1C, #linenums    0, checksum        0
59 006 00000000 SECT3  notype       Static       | .rdata
60     Section length    1, #relocs    0, #linenums    0, checksum        0, selection    2 (pick any)
61 008 00000000 SECT3  notype       External     | ?value@?$integral_constant@_N$0A@@tr1@std@@2_NB (public: static bool const std::tr1::integral_constant<bool,0>::value)
62 009 00000000 SECT4  notype       Static       | .rdata
63     Section length    1, #relocs    0, #linenums    0, checksum 77073096, selection    2 (pick any)
64 *snip lots of uninteresting crap*
65 12A 00000000 SECT5B notype       Static       | .text
66     Section length   4B, #relocs    2, #linenums    0, checksum 22AE8362, selection    2 (pick any)
67 12C 00000000 SECT5C notype       Static       | .debug$S
68     Section length  150, #relocs    B, #linenums    0, checksum        0, selection    5 (pick associative Section 0x5B)
69 12F 00000000 SECT5D notype       Static       | .debug$T
70     Section length   5C, #relocs    0, #linenums    0, checksum        0
71
72 String Table Size = 0x15EF bytes
73
74
75 Dump of file conv.lib
76
77 File Type: LIBRARY
78
79 COFF SYMBOL TABLE
80 000 00AB766F ABS    notype       Static       | @comp.id
81 001 00000001 ABS    notype       Static       | @feat.00
82 002 00000000 SECT1  notype       Static       | .drectve
83     Section length   2F, #relocs    0, #linenums    0, checksum        0
84 004 00000000 SECT2  notype       Static       | .debug$S
85     Section length  70C, #relocs    5, #linenums    0, checksum        0
86 006 00000000 SECT3  notype       Static       | .text
87     Section length    A, #relocs    0, #linenums    0, checksum BAFC81C1
88 008 00000000 SECT3  notype ()    External     | _convenience
89 009 00000000 SECT4  notype       Static       | .debug$T
90     Section length   5C, #relocs    0, #linenums    0, checksum        0
91
92 String Table Size = 0x11 bytes
93
94   Summary
95
96         5B3C .debug$S
97           B8 .debug$T
98           BE .drectve
99          129 .rdata
100            C .sxdata
101          613 .text
102           6C .text$x
103           B8 .xdata$x
104 ]])
105
106 # Check if the _convenience symbol from section SECT3 in conv.lib is
107 # present even if section SECT3 in foo.obj is hidden.
108 AT_CHECK([< dumpbin-output eval "$global_symbol_pipe"], [], [stdout])
109 AT_CHECK([grep convenience stdout], [], [ignore])
110
111 AT_CLEANUP