1#! /bin/sh
2# Copyright (C) 2013 Red Hat, Inc.
3# This file is part of elfutils.
4#
5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# elfutils is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18. $srcdir/test-subr.sh
19
20# Tests dwfl_module_{addrsym,getsym,relocate_address}
21# See run-readelf-s.sh for how to generate test binaries.
22# In addition, *_pl files were created from their base file
23# with prelink -N, and *_plr with prelink -r 0x4200000000.
24
25testfiles testfilebaztab
26testfiles testfilebazdbg testfilebazdbg.debug
27testfiles testfilebazdbg_pl
28testfiles testfilebazdbg_plr
29testfiles testfilebazdyn
30testfiles testfilebazmdb
31testfiles testfilebazmin
32testfiles testfilebazmin_pl
33testfiles testfilebazmin_plr
34testfiles testfilebasmin
35testfiles testfilebaxmin
36
37tempfiles testfile.dynsym.in testfile.symtab.in testfile.minsym.in dwflsyms.out
38tempfiles testfile.symtab_pl.in testfile.minsym_pl.in
39
40cat > testfile.symtab.in <<\EOF
41   0: NOTYPE	LOCAL	 (0) 0
42   1: SECTION	LOCAL	 (0) 0x238
43   2: SECTION	LOCAL	 (0) 0x254
44   3: SECTION	LOCAL	 (0) 0x274
45   4: SECTION	LOCAL	 (0) 0x298
46   5: SECTION	LOCAL	 (0) 0x2d8
47   6: SECTION	LOCAL	 (0) 0x428
48   7: SECTION	LOCAL	 (0) 0x4f2
49   8: SECTION	LOCAL	 (0) 0x510
50   9: SECTION	LOCAL	 (0) 0x530
51  10: SECTION	LOCAL	 (0) 0x638
52  11: SECTION	LOCAL	 (0) 0x680
53  12: SECTION	LOCAL	 (0) 0x6a0
54  13: SECTION	LOCAL	 (0) 0x6e0
55  14: SECTION	LOCAL	 (0) 0x8f4
56  15: SECTION	LOCAL	 (0) 0x900
57  16: SECTION	LOCAL	 (0) 0x904
58  17: SECTION	LOCAL	 (0) 0x948
59  18: SECTION	LOCAL	 (0) 0x200dd0
60  19: SECTION	LOCAL	 (0) 0x200dd8
61  20: SECTION	LOCAL	 (0) 0x200de0
62  21: SECTION	LOCAL	 (0) 0x200de8
63  22: SECTION	LOCAL	 (0) 0x200df0
64  23: SECTION	LOCAL	 (0) 0x200fc0
65  24: SECTION	LOCAL	 (0) 0x201000
66  25: SECTION	LOCAL	 (0) 0x201030
67  26: SECTION	LOCAL	 (0) 0x20103c
68  27: SECTION	LOCAL	 (0) 0
69  28: SECTION	LOCAL	 (0) 0
70  29: SECTION	LOCAL	 (0) 0
71  30: SECTION	LOCAL	 (0) 0
72  31: SECTION	LOCAL	 (0) 0
73  32: SECTION	LOCAL	 (0) 0
74  33: FILE	LOCAL	crtstuff.c (0) 0
75  34: OBJECT	LOCAL	__JCR_LIST__ (0) 0x200de0
76  35: FUNC	LOCAL	deregister_tm_clones (0) 0x710, rel: 0x710 (.text)
77  36: FUNC	LOCAL	register_tm_clones (0) 0x740, rel: 0x740 (.text)
78  37: FUNC	LOCAL	__do_global_dtors_aux (0) 0x780, rel: 0x780 (.text)
79  38: OBJECT	LOCAL	completed.6137 (1) 0x20103c
80  39: OBJECT	LOCAL	__do_global_dtors_aux_fini_array_entry (0) 0x200dd8
81  40: FUNC	LOCAL	frame_dummy (0) 0x7c0, rel: 0x7c0 (.text)
82  41: OBJECT	LOCAL	__frame_dummy_init_array_entry (0) 0x200dd0
83  42: FILE	LOCAL	foo.c (0) 0
84  43: FILE	LOCAL	bar.c (0) 0
85  44: OBJECT	LOCAL	b1 (4) 0x201034
86  45: FUNC	LOCAL	foo (20) 0x814, rel: 0x814 (.text)
87  46: FILE	LOCAL	crtstuff.c (0) 0
88  47: OBJECT	LOCAL	__FRAME_END__ (0) 0xa58
89  48: OBJECT	LOCAL	__JCR_END__ (0) 0x200de0
90  49: FILE	LOCAL	 (0) 0
91  50: NOTYPE	LOCAL	__init_array_end (0) 0x200dd8
92  51: OBJECT	LOCAL	_DYNAMIC (0) 0x200df0
93  52: NOTYPE	LOCAL	__init_array_start (0) 0x200dd0
94  53: OBJECT	LOCAL	_GLOBAL_OFFSET_TABLE_ (0) 0x201000
95  54: FUNC	GLOBAL	__libc_csu_fini (2) 0x8f0, rel: 0x8f0 (.text)
96  55: NOTYPE	WEAK	_ITM_deregisterTMCloneTable (0) 0
97  56: NOTYPE	WEAK	data_start (0) 0x201030
98  57: NOTYPE	GLOBAL	_edata (0) 0x20103c
99  58: FUNC	GLOBAL	bar (44) 0x828, rel: 0x828 (.text)
100  59: FUNC	GLOBAL	_fini (0) 0x8f4, rel: 0x8f4 (.fini)
101  60: FUNC	GLOBAL	__libc_start_main@@GLIBC_2.2.5 (0) 0
102  61: NOTYPE	GLOBAL	__data_start (0) 0x201030
103  62: NOTYPE	WEAK	__gmon_start__ (0) 0
104  63: OBJECT	GLOBAL	__dso_handle (0) 0x200de8
105  64: OBJECT	GLOBAL	_IO_stdin_used (4) 0x900
106  65: OBJECT	GLOBAL	b2 (4) 0x201038
107  66: FUNC	GLOBAL	__libc_csu_init (137) 0x860, rel: 0x860 (.text)
108  67: NOTYPE	GLOBAL	_end (0) 0x201040
109  68: FUNC	GLOBAL	_start (0) 0x6e0, rel: 0x6e0 (.text)
110  69: NOTYPE	GLOBAL	__bss_start (0) 0x20103c
111  70: FUNC	GLOBAL	main (35) 0x7f0, rel: 0x7f0 (.text)
112  71: NOTYPE	WEAK	_Jv_RegisterClasses (0) 0
113  72: OBJECT	GLOBAL	__TMC_END__ (0) 0x201040
114  73: NOTYPE	WEAK	_ITM_registerTMCloneTable (0) 0
115  74: FUNC	WEAK	__cxa_finalize@@GLIBC_2.2.5 (0) 0
116  75: FUNC	GLOBAL	_init (0) 0x680, rel: 0x680 (.init)
117EOF
118
119cat > testfile.symtab_pl.in <<\EOF
120   0: NOTYPE	LOCAL	 (0) 0
121   1: SECTION	LOCAL	 (0) 0x3000000238
122   2: SECTION	LOCAL	 (0) 0x3000000254
123   3: SECTION	LOCAL	 (0) 0x3000000274
124   4: SECTION	LOCAL	 (0) 0x3000000298
125   5: SECTION	LOCAL	 (0) 0x30000002d8
126   6: SECTION	LOCAL	 (0) 0x3000000428
127   7: SECTION	LOCAL	 (0) 0x30000004f2
128   8: SECTION	LOCAL	 (0) 0x3000000510
129   9: SECTION	LOCAL	 (0) 0x3000000530
130  10: SECTION	LOCAL	 (0) 0x3000000638
131  11: SECTION	LOCAL	 (0) 0x3000000680
132  12: SECTION	LOCAL	 (0) 0x30000006a0
133  13: SECTION	LOCAL	 (0) 0x30000006e0
134  14: SECTION	LOCAL	 (0) 0x30000008f4
135  15: SECTION	LOCAL	 (0) 0x3000000900
136  16: SECTION	LOCAL	 (0) 0x3000000904
137  17: SECTION	LOCAL	 (0) 0x3000000948
138  18: SECTION	LOCAL	 (0) 0x3000200dd0
139  19: SECTION	LOCAL	 (0) 0x3000200dd8
140  20: SECTION	LOCAL	 (0) 0x3000200de0
141  21: SECTION	LOCAL	 (0) 0x3000200de8
142  22: SECTION	LOCAL	 (0) 0x3000200df0
143  23: SECTION	LOCAL	 (0) 0x3000200fc0
144  24: SECTION	LOCAL	 (0) 0x3000201000
145  25: SECTION	LOCAL	 (0) 0x3000201030
146  26: SECTION	LOCAL	 (0) 0x300020103c
147  27: SECTION	LOCAL	 (0) 0
148  28: SECTION	LOCAL	 (0) 0
149  29: SECTION	LOCAL	 (0) 0
150  30: SECTION	LOCAL	 (0) 0
151  31: SECTION	LOCAL	 (0) 0
152  32: SECTION	LOCAL	 (0) 0
153  33: FILE	LOCAL	crtstuff.c (0) 0
154  34: OBJECT	LOCAL	__JCR_LIST__ (0) 0x3000200de0
155  35: FUNC	LOCAL	deregister_tm_clones (0) 0x3000000710, rel: 0x710 (.text)
156  36: FUNC	LOCAL	register_tm_clones (0) 0x3000000740, rel: 0x740 (.text)
157  37: FUNC	LOCAL	__do_global_dtors_aux (0) 0x3000000780, rel: 0x780 (.text)
158  38: OBJECT	LOCAL	completed.6137 (1) 0x300020103c
159  39: OBJECT	LOCAL	__do_global_dtors_aux_fini_array_entry (0) 0x3000200dd8
160  40: FUNC	LOCAL	frame_dummy (0) 0x30000007c0, rel: 0x7c0 (.text)
161  41: OBJECT	LOCAL	__frame_dummy_init_array_entry (0) 0x3000200dd0
162  42: FILE	LOCAL	foo.c (0) 0
163  43: FILE	LOCAL	bar.c (0) 0
164  44: OBJECT	LOCAL	b1 (4) 0x3000201034
165  45: FUNC	LOCAL	foo (20) 0x3000000814, rel: 0x814 (.text)
166  46: FILE	LOCAL	crtstuff.c (0) 0
167  47: OBJECT	LOCAL	__FRAME_END__ (0) 0x3000000a58
168  48: OBJECT	LOCAL	__JCR_END__ (0) 0x3000200de0
169  49: FILE	LOCAL	 (0) 0
170  50: NOTYPE	LOCAL	__init_array_end (0) 0x3000200dd8
171  51: OBJECT	LOCAL	_DYNAMIC (0) 0x3000200df0
172  52: NOTYPE	LOCAL	__init_array_start (0) 0x3000200dd0
173  53: OBJECT	LOCAL	_GLOBAL_OFFSET_TABLE_ (0) 0x3000201000
174  54: FUNC	GLOBAL	__libc_csu_fini (2) 0x30000008f0, rel: 0x8f0 (.text)
175  55: NOTYPE	WEAK	_ITM_deregisterTMCloneTable (0) 0
176  56: NOTYPE	WEAK	data_start (0) 0x3000201030
177  57: NOTYPE	GLOBAL	_edata (0) 0x300020103c
178  58: FUNC	GLOBAL	bar (44) 0x3000000828, rel: 0x828 (.text)
179  59: FUNC	GLOBAL	_fini (0) 0x30000008f4, rel: 0x8f4 (.fini)
180  60: FUNC	GLOBAL	__libc_start_main@@GLIBC_2.2.5 (0) 0
181  61: NOTYPE	GLOBAL	__data_start (0) 0x3000201030
182  62: NOTYPE	WEAK	__gmon_start__ (0) 0
183  63: OBJECT	GLOBAL	__dso_handle (0) 0x3000200de8
184  64: OBJECT	GLOBAL	_IO_stdin_used (4) 0x3000000900
185  65: OBJECT	GLOBAL	b2 (4) 0x3000201038
186  66: FUNC	GLOBAL	__libc_csu_init (137) 0x3000000860, rel: 0x860 (.text)
187  67: NOTYPE	GLOBAL	_end (0) 0x3000201040
188  68: FUNC	GLOBAL	_start (0) 0x30000006e0, rel: 0x6e0 (.text)
189  69: NOTYPE	GLOBAL	__bss_start (0) 0x300020103c
190  70: FUNC	GLOBAL	main (35) 0x30000007f0, rel: 0x7f0 (.text)
191  71: NOTYPE	WEAK	_Jv_RegisterClasses (0) 0
192  72: OBJECT	GLOBAL	__TMC_END__ (0) 0x3000201040
193  73: NOTYPE	WEAK	_ITM_registerTMCloneTable (0) 0
194  74: FUNC	WEAK	__cxa_finalize@@GLIBC_2.2.5 (0) 0
195  75: FUNC	GLOBAL	_init (0) 0x3000000680, rel: 0x680 (.init)
196EOF
197
198cat > testfile.dynsym.in <<\EOF
199   0: NOTYPE	LOCAL	 (0) 0
200   1: SECTION	LOCAL	 (0) 0x238
201   2: NOTYPE	WEAK	_ITM_deregisterTMCloneTable (0) 0
202   3: FUNC	GLOBAL	__libc_start_main (0) 0
203   4: NOTYPE	WEAK	__gmon_start__ (0) 0
204   5: NOTYPE	WEAK	_Jv_RegisterClasses (0) 0
205   6: NOTYPE	WEAK	_ITM_registerTMCloneTable (0) 0
206   7: FUNC	WEAK	__cxa_finalize (0) 0
207   8: NOTYPE	GLOBAL	_edata (0) 0x20103c
208   9: NOTYPE	GLOBAL	_end (0) 0x201040
209  10: FUNC	GLOBAL	__libc_csu_init (137) 0x860, rel: 0x860 (.text)
210  11: NOTYPE	GLOBAL	__bss_start (0) 0x20103c
211  12: FUNC	GLOBAL	main (35) 0x7f0, rel: 0x7f0 (.text)
212  13: FUNC	GLOBAL	__libc_csu_fini (2) 0x8f0, rel: 0x8f0 (.text)
213EOF
214
215cat > testfile.minsym.in <<\EOF
216   0: NOTYPE	LOCAL	 (0) 0
217   1: SECTION	LOCAL	 (0) 0x238
218   2: FUNC	LOCAL	deregister_tm_clones (0) 0x710, rel: 0x710 (.text)
219   3: FUNC	LOCAL	register_tm_clones (0) 0x740, rel: 0x740 (.text)
220   4: FUNC	LOCAL	__do_global_dtors_aux (0) 0x780, rel: 0x780 (.text)
221   5: OBJECT	LOCAL	__do_global_dtors_aux_fini_array_entry (0) 0x200dd8
222   6: FUNC	LOCAL	frame_dummy (0) 0x7c0, rel: 0x7c0 (.text)
223   7: OBJECT	LOCAL	__frame_dummy_init_array_entry (0) 0x200dd0
224   8: FUNC	LOCAL	foo (20) 0x814, rel: 0x814 (.text)
225   9: NOTYPE	LOCAL	__init_array_end (0) 0x200dd8
226  10: NOTYPE	LOCAL	__init_array_start (0) 0x200dd0
227  11: SECTION	LOCAL	 (0) 0x238
228  12: SECTION	LOCAL	 (0) 0x254
229  13: SECTION	LOCAL	 (0) 0x274
230  14: SECTION	LOCAL	 (0) 0x298
231  15: SECTION	LOCAL	 (0) 0x2d8
232  16: SECTION	LOCAL	 (0) 0x428
233  17: SECTION	LOCAL	 (0) 0x4f2
234  18: SECTION	LOCAL	 (0) 0x510
235  19: SECTION	LOCAL	 (0) 0x530
236  20: SECTION	LOCAL	 (0) 0x638
237  21: SECTION	LOCAL	 (0) 0x680
238  22: SECTION	LOCAL	 (0) 0x6a0
239  23: SECTION	LOCAL	 (0) 0x6e0
240  24: SECTION	LOCAL	 (0) 0x8f4
241  25: SECTION	LOCAL	 (0) 0x900
242  26: SECTION	LOCAL	 (0) 0x904
243  27: SECTION	LOCAL	 (0) 0x948
244  28: SECTION	LOCAL	 (0) 0x200dd0
245  29: SECTION	LOCAL	 (0) 0x200dd8
246  30: SECTION	LOCAL	 (0) 0x200de0
247  31: SECTION	LOCAL	 (0) 0x200de8
248  32: SECTION	LOCAL	 (0) 0x200df0
249  33: SECTION	LOCAL	 (0) 0x200fc0
250  34: SECTION	LOCAL	 (0) 0x201000
251  35: SECTION	LOCAL	 (0) 0x201030
252  36: SECTION	LOCAL	 (0) 0x20103c
253  37: NOTYPE	WEAK	_ITM_deregisterTMCloneTable (0) 0
254  38: FUNC	GLOBAL	__libc_start_main (0) 0
255  39: NOTYPE	WEAK	__gmon_start__ (0) 0
256  40: NOTYPE	WEAK	_Jv_RegisterClasses (0) 0
257  41: NOTYPE	WEAK	_ITM_registerTMCloneTable (0) 0
258  42: FUNC	WEAK	__cxa_finalize (0) 0
259  43: NOTYPE	GLOBAL	_edata (0) 0x20103c
260  44: NOTYPE	GLOBAL	_end (0) 0x201040
261  45: FUNC	GLOBAL	__libc_csu_init (137) 0x860, rel: 0x860 (.text)
262  46: NOTYPE	GLOBAL	__bss_start (0) 0x20103c
263  47: FUNC	GLOBAL	main (35) 0x7f0, rel: 0x7f0 (.text)
264  48: FUNC	GLOBAL	__libc_csu_fini (2) 0x8f0, rel: 0x8f0 (.text)
265  49: FUNC	GLOBAL	bar (44) 0x828, rel: 0x828 (.text)
266  50: FUNC	GLOBAL	_fini (0) 0x8f4, rel: 0x8f4 (.fini)
267  51: FUNC	GLOBAL	_start (0) 0x6e0, rel: 0x6e0 (.text)
268  52: FUNC	GLOBAL	_init (0) 0x680, rel: 0x680 (.init)
269EOF
270
271cat > testfile.minsym_pl.in <<\EOF
272   0: NOTYPE	LOCAL	 (0) 0
273   1: SECTION	LOCAL	 (0) 0x3000000238
274   2: FUNC	LOCAL	deregister_tm_clones (0) 0x3000000710, rel: 0x710 (.text)
275   3: FUNC	LOCAL	register_tm_clones (0) 0x3000000740, rel: 0x740 (.text)
276   4: FUNC	LOCAL	__do_global_dtors_aux (0) 0x3000000780, rel: 0x780 (.text)
277   5: OBJECT	LOCAL	__do_global_dtors_aux_fini_array_entry (0) 0x3000200dd8
278   6: FUNC	LOCAL	frame_dummy (0) 0x30000007c0, rel: 0x7c0 (.text)
279   7: OBJECT	LOCAL	__frame_dummy_init_array_entry (0) 0x3000200dd0
280   8: FUNC	LOCAL	foo (20) 0x3000000814, rel: 0x814 (.text)
281   9: NOTYPE	LOCAL	__init_array_end (0) 0x3000200dd8
282  10: NOTYPE	LOCAL	__init_array_start (0) 0x3000200dd0
283  11: SECTION	LOCAL	 (0) 0x3000000238
284  12: SECTION	LOCAL	 (0) 0x3000000254
285  13: SECTION	LOCAL	 (0) 0x3000000274
286  14: SECTION	LOCAL	 (0) 0x3000000298
287  15: SECTION	LOCAL	 (0) 0x30000002d8
288  16: SECTION	LOCAL	 (0) 0x3000000428
289  17: SECTION	LOCAL	 (0) 0x30000004f2
290  18: SECTION	LOCAL	 (0) 0x3000000510
291  19: SECTION	LOCAL	 (0) 0x3000000530
292  20: SECTION	LOCAL	 (0) 0x3000000638
293  21: SECTION	LOCAL	 (0) 0x3000000680
294  22: SECTION	LOCAL	 (0) 0x30000006a0
295  23: SECTION	LOCAL	 (0) 0x30000006e0
296  24: SECTION	LOCAL	 (0) 0x30000008f4
297  25: SECTION	LOCAL	 (0) 0x3000000900
298  26: SECTION	LOCAL	 (0) 0x3000000904
299  27: SECTION	LOCAL	 (0) 0x3000000948
300  28: SECTION	LOCAL	 (0) 0x3000200dd0
301  29: SECTION	LOCAL	 (0) 0x3000200dd8
302  30: SECTION	LOCAL	 (0) 0x3000200de0
303  31: SECTION	LOCAL	 (0) 0x3000200de8
304  32: SECTION	LOCAL	 (0) 0x3000200df0
305  33: SECTION	LOCAL	 (0) 0x3000200fc0
306  34: SECTION	LOCAL	 (0) 0x3000201000
307  35: SECTION	LOCAL	 (0) 0x3000201030
308  36: SECTION	LOCAL	 (0) 0x300020103c
309  37: NOTYPE	WEAK	_ITM_deregisterTMCloneTable (0) 0
310  38: FUNC	GLOBAL	__libc_start_main (0) 0
311  39: NOTYPE	WEAK	__gmon_start__ (0) 0
312  40: NOTYPE	WEAK	_Jv_RegisterClasses (0) 0
313  41: NOTYPE	WEAK	_ITM_registerTMCloneTable (0) 0
314  42: FUNC	WEAK	__cxa_finalize (0) 0
315  43: NOTYPE	GLOBAL	_edata (0) 0x300020103c
316  44: NOTYPE	GLOBAL	_end (0) 0x3000201040
317  45: FUNC	GLOBAL	__libc_csu_init (137) 0x3000000860, rel: 0x860 (.text)
318  46: NOTYPE	GLOBAL	__bss_start (0) 0x300020103c
319  47: FUNC	GLOBAL	main (35) 0x30000007f0, rel: 0x7f0 (.text)
320  48: FUNC	GLOBAL	__libc_csu_fini (2) 0x30000008f0, rel: 0x8f0 (.text)
321  49: FUNC	GLOBAL	bar (44) 0x3000000828, rel: 0x828 (.text)
322  50: FUNC	GLOBAL	_fini (0) 0x30000008f4, rel: 0x8f4 (.fini)
323  51: FUNC	GLOBAL	_start (0) 0x30000006e0, rel: 0x6e0 (.text)
324  52: FUNC	GLOBAL	_init (0) 0x3000000680, rel: 0x680 (.init)
325EOF
326
327cat testfile.symtab.in \
328  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebaztab
329
330cat testfile.symtab.in \
331  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazdbg
332
333cat testfile.symtab_pl.in \
334  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazdbg_pl
335
336sed s/0x3000/0x4200/g testfile.symtab_pl.in \
337  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazdbg_plr
338
339cat testfile.dynsym.in \
340  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazdyn
341
342cat testfile.symtab.in \
343  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazmdb
344
345cat testfile.minsym.in \
346  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazmin
347
348cat testfile.minsym_pl.in \
349  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazmin_pl
350
351sed s/0x3000/0x4200/g testfile.minsym_pl.in \
352  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazmin_plr
353
354testrun_compare ${abs_builddir}/dwflsyms -e testfilebasmin <<\EOF
355   0: NOTYPE	LOCAL	 (0) 0
356   1: FUNC	LOCAL	foo (18) 0x400168, rel: 0x400168 (.text)
357   2: SECTION	LOCAL	 (0) 0x400120
358   3: SECTION	LOCAL	 (0) 0x400144
359   4: SECTION	LOCAL	 (0) 0x4001c0
360   5: SECTION	LOCAL	 (0) 0x600258
361   6: FUNC	GLOBAL	_start (21) 0x4001a8, rel: 0x4001a8 (.text)
362   7: FUNC	GLOBAL	main (33) 0x400144, rel: 0x400144 (.text)
363   8: FUNC	GLOBAL	bar (44) 0x40017a, rel: 0x40017a (.text)
364EOF
365
366testrun_compare ${abs_builddir}/dwflsyms -e testfilebaxmin <<\EOF
367   0: NOTYPE	LOCAL	 (0) 0
368   1: FUNC	LOCAL	deregister_tm_clones (0) 0x400430, rel: 0x400430 (.text)
369   2: FUNC	LOCAL	register_tm_clones (0) 0x400460, rel: 0x400460 (.text)
370   3: FUNC	LOCAL	__do_global_dtors_aux (0) 0x4004a0, rel: 0x4004a0 (.text)
371   4: OBJECT	LOCAL	__do_global_dtors_aux_fini_array_entry (0) 0x600e18
372   5: FUNC	LOCAL	frame_dummy (0) 0x4004c0, rel: 0x4004c0 (.text)
373   6: OBJECT	LOCAL	__frame_dummy_init_array_entry (0) 0x600e10
374   7: FUNC	LOCAL	foo (20) 0x4004f0, rel: 0x4004f0 (.text)
375   8: NOTYPE	LOCAL	__init_array_end (0) 0x600e18
376   9: NOTYPE	LOCAL	__init_array_start (0) 0x600e10
377  10: SECTION	LOCAL	 (0) 0x400238
378  11: SECTION	LOCAL	 (0) 0x400254
379  12: SECTION	LOCAL	 (0) 0x400274
380  13: SECTION	LOCAL	 (0) 0x400298
381  14: SECTION	LOCAL	 (0) 0x4002b8
382  15: SECTION	LOCAL	 (0) 0x400300
383  16: SECTION	LOCAL	 (0) 0x400338
384  17: SECTION	LOCAL	 (0) 0x400340
385  18: SECTION	LOCAL	 (0) 0x400360
386  19: SECTION	LOCAL	 (0) 0x400378
387  20: SECTION	LOCAL	 (0) 0x4003a8
388  21: SECTION	LOCAL	 (0) 0x4003d0
389  22: SECTION	LOCAL	 (0) 0x400400
390  23: SECTION	LOCAL	 (0) 0x4005c4
391  24: SECTION	LOCAL	 (0) 0x4005d0
392  25: SECTION	LOCAL	 (0) 0x4005e0
393  26: SECTION	LOCAL	 (0) 0x400628
394  27: SECTION	LOCAL	 (0) 0x600e10
395  28: SECTION	LOCAL	 (0) 0x600e18
396  29: SECTION	LOCAL	 (0) 0x600e20
397  30: SECTION	LOCAL	 (0) 0x600e28
398  31: SECTION	LOCAL	 (0) 0x600ff8
399  32: SECTION	LOCAL	 (0) 0x601000
400  33: SECTION	LOCAL	 (0) 0x601028
401  34: SECTION	LOCAL	 (0) 0x601034
402  35: FUNC	GLOBAL	__libc_start_main (0) 0
403  36: NOTYPE	WEAK	__gmon_start__ (0) 0
404  37: FUNC	GLOBAL	__libc_csu_fini (2) 0x4005c0, rel: 0x4005c0 (.text)
405  38: FUNC	GLOBAL	bar (40) 0x400504, rel: 0x400504 (.text)
406  39: FUNC	GLOBAL	_fini (0) 0x4005c4, rel: 0x4005c4 (.fini)
407  40: FUNC	GLOBAL	__libc_csu_init (101) 0x400550, rel: 0x400550 (.text)
408  41: FUNC	GLOBAL	_start (0) 0x400400, rel: 0x400400 (.text)
409  42: FUNC	GLOBAL	main (35) 0x40052c, rel: 0x40052c (.text)
410  43: FUNC	GLOBAL	_init (0) 0x4003a8, rel: 0x4003a8 (.init)
411EOF
412
413testfiles testfile66
414testrun_compare ${abs_builddir}/dwflsyms -e testfile66 <<\EOF
415   0: NOTYPE	LOCAL	 (0) 0
416   1: SECTION	LOCAL	 (0) 0x190
417   2: SECTION	LOCAL	 (0) 0x1a4
418   3: SECTION	LOCAL	 (0) 0x1c8
419   4: SECTION	LOCAL	 (0) 0x1f8
420   5: SECTION	LOCAL	 (0) 0x288
421   6: SECTION	LOCAL	 (0) 0x2a8
422   7: SECTION	LOCAL	 (0) 0x2d8
423   8: SECTION	LOCAL	 (0) 0x102e0
424   9: SECTION	LOCAL	 (0) 0x103d0
425  10: SECTION	LOCAL	 (0) 0x103e8
426  11: SECTION	LOCAL	 (0) 0x103e8
427  12: OBJECT	LOCAL	_DYNAMIC (0) 0x102e0
428  13: FUNC	GLOBAL	_start (4) 0x103d0, rel: 0x103d0 (.opd) [0x2d8, rel: 0 (.text)]
429  14: NOTYPE	GLOBAL	__bss_start (0) 0x103f0
430  15: NOTYPE	GLOBAL	_edata (0) 0x103f0
431  16: NOTYPE	GLOBAL	_end (0) 0x103f0
432EOF
433
434testfiles testfile66.core
435testrun_compare ${abs_builddir}/dwflsyms -e testfile66 --core=testfile66.core <<\EOF
436   0: NOTYPE	LOCAL	 (0) 0
437   1: SECTION	LOCAL	 (0) 0xfffb1af0410
438   2: NOTYPE	GLOBAL	__kernel_datapage_offset (0) 0xfffb1af05dc
439   3: OBJECT	GLOBAL	LINUX_2.6.15 (0) 0
440   4: NOTYPE	GLOBAL	__kernel_clock_getres (64) 0xfffb1af052c
441   5: NOTYPE	GLOBAL	__kernel_get_tbfreq (24) 0xfffb1af0620
442   6: NOTYPE	GLOBAL	__kernel_gettimeofday (84) 0xfffb1af0440
443   7: NOTYPE	GLOBAL	__kernel_sync_dicache (20) 0xfffb1af06c4
444   8: NOTYPE	GLOBAL	__kernel_sync_dicache_p5 (20) 0xfffb1af06c4
445   9: NOTYPE	GLOBAL	__kernel_sigtramp_rt64 (12) 0xfffb1af0418
446  10: NOTYPE	GLOBAL	__kernel_clock_gettime (152) 0xfffb1af0494
447  11: NOTYPE	GLOBAL	__kernel_get_syscall_map (44) 0xfffb1af05f4
448ld64.so.1: Callback returned failure
449   0: NOTYPE	LOCAL	 (0) 0
450   1: SECTION	LOCAL	 (0) 0x461b0190
451   2: SECTION	LOCAL	 (0) 0x461b01a4
452   3: SECTION	LOCAL	 (0) 0x461b01c8
453   4: SECTION	LOCAL	 (0) 0x461b01f8
454   5: SECTION	LOCAL	 (0) 0x461b0288
455   6: SECTION	LOCAL	 (0) 0x461b02a8
456   7: SECTION	LOCAL	 (0) 0x461b02d8
457   8: SECTION	LOCAL	 (0) 0x461c02e0
458   9: SECTION	LOCAL	 (0) 0x461c03d0
459  10: SECTION	LOCAL	 (0) 0x461c03e8
460  11: SECTION	LOCAL	 (0) 0x461c03e8
461  12: OBJECT	LOCAL	_DYNAMIC (0) 0x102e0
462  13: FUNC	GLOBAL	_start (4) 0x461c03d0, rel: 0x103d0 (.opd) [0x461b02d8, rel: 0 (.text)]
463  14: NOTYPE	GLOBAL	__bss_start (0) 0x103f0
464  15: NOTYPE	GLOBAL	_edata (0) 0x103f0
465  16: NOTYPE	GLOBAL	_end (0) 0x103f0
466EOF
467
468# Test the already present dot-prefixed names do not get duplicated.
469testfiles hello_ppc64.ko
470testrun_compare ${abs_builddir}/dwflsyms -e hello_ppc64.ko <<\EOF
471   0: NOTYPE	LOCAL	 (0) 0
472   1: SECTION	LOCAL	 (0) 0
473   2: SECTION	LOCAL	 (0) 0x94
474   3: SECTION	LOCAL	 (0) 0xba
475   4: SECTION	LOCAL	 (0) 0xd0
476   5: SECTION	LOCAL	 (0) 0x13a
477   6: SECTION	LOCAL	 (0) 0x13a
478   7: SECTION	LOCAL	 (0) 0x150
479   8: SECTION	LOCAL	 (0) 0x170
480   9: SECTION	LOCAL	 (0) 0x188
481  10: SECTION	LOCAL	 (0) 0x410
482  11: SECTION	LOCAL	 (0) 0x434
483  12: SECTION	LOCAL	 (0) 0x438
484  13: SECTION	LOCAL	 (0) 0x438
485  14: SECTION	LOCAL	 (0) 0
486  15: SECTION	LOCAL	 (0) 0
487  16: SECTION	LOCAL	 (0) 0
488  17: SECTION	LOCAL	 (0) 0
489  18: SECTION	LOCAL	 (0) 0
490  19: SECTION	LOCAL	 (0) 0
491  20: SECTION	LOCAL	 (0) 0
492  21: SECTION	LOCAL	 (0) 0
493  22: SECTION	LOCAL	 (0) 0
494  23: SECTION	LOCAL	 (0) 0
495  24: FILE	LOCAL	init.c (0) 0
496  25: FILE	LOCAL	exit.c (0) 0
497  26: FILE	LOCAL	hello.mod.c (0) 0
498  27: OBJECT	LOCAL	__mod_srcversion23 (35) 0xd0
499  28: OBJECT	LOCAL	__module_depends (9) 0xf8
500  29: OBJECT	LOCAL	__mod_vermagic5 (50) 0x108
501  30: OBJECT	GLOBAL	__this_module (648) 0x188
502  31: FUNC	GLOBAL	.cleanup_module (72) 0x4c, rel: 0x4c (.text)
503  32: FUNC	GLOBAL	cleanup_module (24) 0x160, rel: 0x10 (.opd)
504  33: NOTYPE	GLOBAL	.printk (0) 0
505  34: FUNC	GLOBAL	init_module (24) 0x150, rel: 0 (.opd)
506  35: NOTYPE	GLOBAL	._mcount (0) 0
507  36: FUNC	GLOBAL	.init_module (76) 0, rel: 0 (.text)
508  37: NOTYPE	GLOBAL	_mcount (0) 0
509EOF
510
511# Same test files as above, but now generated on ppc64.
512# ppc64 uses function descriptors to make things more "interesting".
513
514testfiles testfilebaztabppc64
515testfiles testfilebazdbgppc64 testfilebazdbgppc64.debug
516testfiles testfilebazdbgppc64_pl
517testfiles testfilebazdbgppc64_plr
518testfiles testfilebazdynppc64
519testfiles testfilebazmdbppc64
520testfiles testfilebazminppc64
521testfiles testfilebazminppc64_pl
522testfiles testfilebazminppc64_plr
523
524cat > testfile.symtab.in <<\EOF
525   0: NOTYPE	LOCAL	 (0) 0
526   1: SECTION	LOCAL	 (0) 0x238
527   2: SECTION	LOCAL	 (0) 0x24c
528   3: SECTION	LOCAL	 (0) 0x26c
529   4: SECTION	LOCAL	 (0) 0x290
530   5: SECTION	LOCAL	 (0) 0x2c0
531   6: SECTION	LOCAL	 (0) 0x3e0
532   7: SECTION	LOCAL	 (0) 0x488
533   8: SECTION	LOCAL	 (0) 0x4a0
534   9: SECTION	LOCAL	 (0) 0x4c0
535  10: SECTION	LOCAL	 (0) 0x820
536  11: SECTION	LOCAL	 (0) 0x850
537  12: SECTION	LOCAL	 (0) 0x8a0
538  13: SECTION	LOCAL	 (0) 0xd30
539  14: SECTION	LOCAL	 (0) 0xd4c
540  15: SECTION	LOCAL	 (0) 0xd50
541  16: SECTION	LOCAL	 (0) 0xd70
542  17: SECTION	LOCAL	 (0) 0x1fde0
543  18: SECTION	LOCAL	 (0) 0x1fde8
544  19: SECTION	LOCAL	 (0) 0x1fdf0
545  20: SECTION	LOCAL	 (0) 0x1fdf8
546  21: SECTION	LOCAL	 (0) 0x1fe20
547  22: SECTION	LOCAL	 (0) 0x20000
548  23: SECTION	LOCAL	 (0) 0x20010
549  24: SECTION	LOCAL	 (0) 0x200d8
550  25: SECTION	LOCAL	 (0) 0x20110
551  26: SECTION	LOCAL	 (0) 0x20158
552  27: SECTION	LOCAL	 (0) 0
553  28: SECTION	LOCAL	 (0) 0
554  29: SECTION	LOCAL	 (0) 0
555  30: SECTION	LOCAL	 (0) 0
556  31: SECTION	LOCAL	 (0) 0
557  32: SECTION	LOCAL	 (0) 0
558  33: SECTION	LOCAL	 (0) 0
559  34: FILE	LOCAL	crtstuff.c (0) 0
560  35: OBJECT	LOCAL	__JCR_LIST__ (0) 0x1fdf0
561  36: FUNC	LOCAL	deregister_tm_clones (0) 0x20040, rel: 0x20040 (.opd) [0x910, rel: 0x70 (.text)]
562  37: FUNC	LOCAL	register_tm_clones (0) 0x20050, rel: 0x20050 (.opd) [0x980, rel: 0xe0 (.text)]
563  38: FUNC	LOCAL	__do_global_dtors_aux (0) 0x20060, rel: 0x20060 (.opd) [0x9f0, rel: 0x150 (.text)]
564  39: OBJECT	LOCAL	completed.7711 (1) 0x20158
565  40: OBJECT	LOCAL	__do_global_dtors_aux_fini_array_entry (0) 0x1fde8
566  41: FUNC	LOCAL	frame_dummy (0) 0x20070, rel: 0x20070 (.opd) [0xa50, rel: 0x1b0 (.text)]
567  42: OBJECT	LOCAL	__frame_dummy_init_array_entry (0) 0x1fde0
568  43: FILE	LOCAL	foo.c (0) 0
569  44: FILE	LOCAL	bar.c (0) 0
570  45: OBJECT	LOCAL	b1 (4) 0x20004
571  46: FUNC	LOCAL	foo (76) 0x20090, rel: 0x20090 (.opd) [0xb34, rel: 0x294 (.text)]
572  47: FILE	LOCAL	crtstuff.c (0) 0
573  48: OBJECT	LOCAL	__FRAME_END__ (0) 0xe18
574  49: OBJECT	LOCAL	__JCR_END__ (0) 0x1fdf0
575  50: FILE	LOCAL	 (0) 0
576  51: NOTYPE	LOCAL	__glink_PLTresolve (0) 0xce8
577  52: NOTYPE	LOCAL	00000011.plt_call.__libc_start_main@@GLIBC_2.3 (0) 0x8a0
578  53: NOTYPE	LOCAL	00000011.plt_call.__cxa_finalize@@GLIBC_2.3 (0) 0x8b4
579  54: NOTYPE	LOCAL	__init_array_end (0) 0x1fde8
580  55: OBJECT	LOCAL	_DYNAMIC (0) 0x1fe20
581  56: NOTYPE	LOCAL	__init_array_start (0) 0x1fde0
582  57: FUNC	GLOBAL	__libc_csu_fini (16) 0x200c0, rel: 0x200c0 (.opd) [0xcd0, rel: 0x430 (.text)]
583  58: FUNC	GLOBAL	__libc_start_main@@GLIBC_2.3 (0) 0
584  59: NOTYPE	WEAK	_ITM_deregisterTMCloneTable (0) 0
585  60: NOTYPE	WEAK	data_start (0) 0x20000
586  61: NOTYPE	GLOBAL	_edata (0) 0x20110
587  62: FUNC	GLOBAL	bar (116) 0x200a0, rel: 0x200a0 (.opd) [0xb80, rel: 0x2e0 (.text)]
588  63: FUNC	GLOBAL	_fini (0) 0x20030, rel: 0x20030 (.opd) [0xd30, rel: 0 (.fini)]
589  64: NOTYPE	GLOBAL	__data_start (0) 0x20000
590  65: NOTYPE	WEAK	__gmon_start__ (0) 0
591  66: OBJECT	GLOBAL	__dso_handle (0) 0x1fe18
592  67: OBJECT	GLOBAL	_IO_stdin_used (4) 0xd4c
593  68: OBJECT	GLOBAL	b2 (4) 0x20008
594  69: FUNC	WEAK	__cxa_finalize@@GLIBC_2.3 (0) 0
595  70: FUNC	GLOBAL	__libc_csu_init (204) 0x200b0, rel: 0x200b0 (.opd) [0xc00, rel: 0x360 (.text)]
596  71: NOTYPE	GLOBAL	_end (0) 0x20160
597  72: FUNC	GLOBAL	_start (60) 0x20010, rel: 0x20010 (.opd) [0x8c8, rel: 0x28 (.text)]
598  73: NOTYPE	GLOBAL	__bss_start (0) 0x20110
599  74: FUNC	GLOBAL	main (128) 0x20080, rel: 0x20080 (.opd) [0xab4, rel: 0x214 (.text)]
600  75: NOTYPE	WEAK	_Jv_RegisterClasses (0) 0
601  76: OBJECT	GLOBAL	__TMC_END__ (0) 0x20010
602  77: NOTYPE	WEAK	_ITM_registerTMCloneTable (0) 0
603  78: FUNC	GLOBAL	_init (0) 0x20020, rel: 0x20020 (.opd) [0x850, rel: 0 (.init)]
604EOF
605
606cat > testfile.symtab_pl.in <<\EOF
607   0: NOTYPE	LOCAL	 (0) 0
608   1: SECTION	LOCAL	 (0) 0x8001000238
609   2: SECTION	LOCAL	 (0) 0x800100024c
610   3: SECTION	LOCAL	 (0) 0x800100026c
611   4: SECTION	LOCAL	 (0) 0x8001000290
612   5: SECTION	LOCAL	 (0) 0x80010002c0
613   6: SECTION	LOCAL	 (0) 0x80010003e0
614   7: SECTION	LOCAL	 (0) 0x8001000488
615   8: SECTION	LOCAL	 (0) 0x80010004a0
616   9: SECTION	LOCAL	 (0) 0x80010004c0
617  10: SECTION	LOCAL	 (0) 0x8001000820
618  11: SECTION	LOCAL	 (0) 0x8001000850
619  12: SECTION	LOCAL	 (0) 0x80010008a0
620  13: SECTION	LOCAL	 (0) 0x8001000d30
621  14: SECTION	LOCAL	 (0) 0x8001000d4c
622  15: SECTION	LOCAL	 (0) 0x8001000d50
623  16: SECTION	LOCAL	 (0) 0x8001000d70
624  17: SECTION	LOCAL	 (0) 0x800101fde0
625  18: SECTION	LOCAL	 (0) 0x800101fde8
626  19: SECTION	LOCAL	 (0) 0x800101fdf0
627  20: SECTION	LOCAL	 (0) 0x800101fdf8
628  21: SECTION	LOCAL	 (0) 0x800101fe20
629  22: SECTION	LOCAL	 (0) 0x8001020000
630  23: SECTION	LOCAL	 (0) 0x8001020010
631  24: SECTION	LOCAL	 (0) 0x80010200d8
632  25: SECTION	LOCAL	 (0) 0x8001020110
633  26: SECTION	LOCAL	 (0) 0x8001020158
634  27: SECTION	LOCAL	 (0) 0
635  28: SECTION	LOCAL	 (0) 0
636  29: SECTION	LOCAL	 (0) 0
637  30: SECTION	LOCAL	 (0) 0
638  31: SECTION	LOCAL	 (0) 0
639  32: SECTION	LOCAL	 (0) 0
640  33: SECTION	LOCAL	 (0) 0
641  34: FILE	LOCAL	crtstuff.c (0) 0
642  35: OBJECT	LOCAL	__JCR_LIST__ (0) 0x800101fdf0
643  36: FUNC	LOCAL	deregister_tm_clones (0) 0x8001020040, rel: 0x20040 (.opd) [0x8001000910, rel: 0x70 (.text)]
644  37: FUNC	LOCAL	register_tm_clones (0) 0x8001020050, rel: 0x20050 (.opd) [0x8001000980, rel: 0xe0 (.text)]
645  38: FUNC	LOCAL	__do_global_dtors_aux (0) 0x8001020060, rel: 0x20060 (.opd) [0x80010009f0, rel: 0x150 (.text)]
646  39: OBJECT	LOCAL	completed.7711 (1) 0x8001020158
647  40: OBJECT	LOCAL	__do_global_dtors_aux_fini_array_entry (0) 0x800101fde8
648  41: FUNC	LOCAL	frame_dummy (0) 0x8001020070, rel: 0x20070 (.opd) [0x8001000a50, rel: 0x1b0 (.text)]
649  42: OBJECT	LOCAL	__frame_dummy_init_array_entry (0) 0x800101fde0
650  43: FILE	LOCAL	foo.c (0) 0
651  44: FILE	LOCAL	bar.c (0) 0
652  45: OBJECT	LOCAL	b1 (4) 0x8001020004
653  46: FUNC	LOCAL	foo (76) 0x8001020090, rel: 0x20090 (.opd) [0x8001000b34, rel: 0x294 (.text)]
654  47: FILE	LOCAL	crtstuff.c (0) 0
655  48: OBJECT	LOCAL	__FRAME_END__ (0) 0x8001000e18
656  49: OBJECT	LOCAL	__JCR_END__ (0) 0x800101fdf0
657  50: FILE	LOCAL	 (0) 0
658  51: NOTYPE	LOCAL	__glink_PLTresolve (0) 0x8001000ce8
659  52: NOTYPE	LOCAL	00000011.plt_call.__libc_start_main@@GLIBC_2.3 (0) 0x80010008a0
660  53: NOTYPE	LOCAL	00000011.plt_call.__cxa_finalize@@GLIBC_2.3 (0) 0x80010008b4
661  54: NOTYPE	LOCAL	__init_array_end (0) 0x800101fde8
662  55: OBJECT	LOCAL	_DYNAMIC (0) 0x800101fe20
663  56: NOTYPE	LOCAL	__init_array_start (0) 0x800101fde0
664  57: FUNC	GLOBAL	__libc_csu_fini (16) 0x80010200c0, rel: 0x200c0 (.opd) [0x8001000cd0, rel: 0x430 (.text)]
665  58: FUNC	GLOBAL	__libc_start_main@@GLIBC_2.3 (0) 0
666  59: NOTYPE	WEAK	_ITM_deregisterTMCloneTable (0) 0
667  60: NOTYPE	WEAK	data_start (0) 0x8001020000
668  61: NOTYPE	GLOBAL	_edata (0) 0x8001020110
669  62: FUNC	GLOBAL	bar (116) 0x80010200a0, rel: 0x200a0 (.opd) [0x8001000b80, rel: 0x2e0 (.text)]
670  63: FUNC	GLOBAL	_fini (0) 0x8001020030, rel: 0x20030 (.opd) [0x8001000d30, rel: 0 (.fini)]
671  64: NOTYPE	GLOBAL	__data_start (0) 0x8001020000
672  65: NOTYPE	WEAK	__gmon_start__ (0) 0
673  66: OBJECT	GLOBAL	__dso_handle (0) 0x800101fe18
674  67: OBJECT	GLOBAL	_IO_stdin_used (4) 0x8001000d4c
675  68: OBJECT	GLOBAL	b2 (4) 0x8001020008
676  69: FUNC	WEAK	__cxa_finalize@@GLIBC_2.3 (0) 0
677  70: FUNC	GLOBAL	__libc_csu_init (204) 0x80010200b0, rel: 0x200b0 (.opd) [0x8001000c00, rel: 0x360 (.text)]
678  71: NOTYPE	GLOBAL	_end (0) 0x8001020160
679  72: FUNC	GLOBAL	_start (60) 0x8001020010, rel: 0x20010 (.opd) [0x80010008c8, rel: 0x28 (.text)]
680  73: NOTYPE	GLOBAL	__bss_start (0) 0x8001020110
681  74: FUNC	GLOBAL	main (128) 0x8001020080, rel: 0x20080 (.opd) [0x8001000ab4, rel: 0x214 (.text)]
682  75: NOTYPE	WEAK	_Jv_RegisterClasses (0) 0
683  76: OBJECT	GLOBAL	__TMC_END__ (0) 0x8001020010
684  77: NOTYPE	WEAK	_ITM_registerTMCloneTable (0) 0
685  78: FUNC	GLOBAL	_init (0) 0x8001020020, rel: 0x20020 (.opd) [0x8001000850, rel: 0 (.init)]
686EOF
687
688cat > testfile.dynsym.in <<\EOF
689   0: NOTYPE	LOCAL	 (0) 0
690   1: SECTION	LOCAL	 (0) 0x238
691   2: SECTION	LOCAL	 (0) 0x1fdf0
692   3: FUNC	GLOBAL	__libc_start_main (0) 0
693   4: NOTYPE	WEAK	_ITM_deregisterTMCloneTable (0) 0
694   5: NOTYPE	WEAK	__gmon_start__ (0) 0
695   6: FUNC	WEAK	__cxa_finalize (0) 0
696   7: NOTYPE	WEAK	_Jv_RegisterClasses (0) 0
697   8: NOTYPE	WEAK	_ITM_registerTMCloneTable (0) 0
698   9: NOTYPE	GLOBAL	_edata (0) 0x20110
699  10: NOTYPE	GLOBAL	_end (0) 0x20160
700  11: NOTYPE	GLOBAL	__bss_start (0) 0x20110
701EOF
702
703cat > testfile.minsym.in <<\EOF
704   0: NOTYPE	LOCAL	 (0) 0
705   1: SECTION	LOCAL	 (0) 0x238
706   2: SECTION	LOCAL	 (0) 0x1fdf0
707   3: OBJECT	LOCAL	__do_global_dtors_aux_fini_array_entry (0) 0x1fde8
708   4: OBJECT	LOCAL	__frame_dummy_init_array_entry (0) 0x1fde0
709   5: NOTYPE	LOCAL	__glink_PLTresolve (0) 0xce8
710   6: NOTYPE	LOCAL	00000011.plt_call.__libc_start_main@@GLIBC_2.3 (0) 0x8a0
711   7: NOTYPE	LOCAL	00000011.plt_call.__cxa_finalize@@GLIBC_2.3 (0) 0x8b4
712   8: NOTYPE	LOCAL	__init_array_end (0) 0x1fde8
713   9: NOTYPE	LOCAL	__init_array_start (0) 0x1fde0
714  10: SECTION	LOCAL	 (0) 0x238
715  11: SECTION	LOCAL	 (0) 0x24c
716  12: SECTION	LOCAL	 (0) 0x26c
717  13: SECTION	LOCAL	 (0) 0x290
718  14: SECTION	LOCAL	 (0) 0x2c0
719  15: SECTION	LOCAL	 (0) 0x3e0
720  16: SECTION	LOCAL	 (0) 0x488
721  17: SECTION	LOCAL	 (0) 0x4a0
722  18: SECTION	LOCAL	 (0) 0x4c0
723  19: SECTION	LOCAL	 (0) 0x820
724  20: SECTION	LOCAL	 (0) 0x850
725  21: SECTION	LOCAL	 (0) 0x8a0
726  22: SECTION	LOCAL	 (0) 0xd30
727  23: SECTION	LOCAL	 (0) 0xd4c
728  24: SECTION	LOCAL	 (0) 0xd50
729  25: SECTION	LOCAL	 (0) 0xd70
730  26: SECTION	LOCAL	 (0) 0x1fde0
731  27: SECTION	LOCAL	 (0) 0x1fde8
732  28: SECTION	LOCAL	 (0) 0x1fdf0
733  29: SECTION	LOCAL	 (0) 0x1fdf8
734  30: SECTION	LOCAL	 (0) 0x1fe20
735  31: SECTION	LOCAL	 (0) 0x20000
736  32: SECTION	LOCAL	 (0) 0x20010
737  33: SECTION	LOCAL	 (0) 0x200d8
738  34: SECTION	LOCAL	 (0) 0x20110
739  35: SECTION	LOCAL	 (0) 0x20158
740  36: FUNC	GLOBAL	__libc_start_main (0) 0
741  37: NOTYPE	WEAK	_ITM_deregisterTMCloneTable (0) 0
742  38: NOTYPE	WEAK	__gmon_start__ (0) 0
743  39: FUNC	WEAK	__cxa_finalize (0) 0
744  40: NOTYPE	WEAK	_Jv_RegisterClasses (0) 0
745  41: NOTYPE	WEAK	_ITM_registerTMCloneTable (0) 0
746  42: NOTYPE	GLOBAL	_edata (0) 0x20110
747  43: NOTYPE	GLOBAL	_end (0) 0x20160
748  44: NOTYPE	GLOBAL	__bss_start (0) 0x20110
749EOF
750
751cat > testfile.minsym_pl.in <<\EOF
752   0: NOTYPE	LOCAL	 (0) 0
753   1: SECTION	LOCAL	 (0) 0x8001000238
754   2: SECTION	LOCAL	 (0) 0x800101fdf0
755   3: OBJECT	LOCAL	__do_global_dtors_aux_fini_array_entry (0) 0x800101fde8
756   4: OBJECT	LOCAL	__frame_dummy_init_array_entry (0) 0x800101fde0
757   5: NOTYPE	LOCAL	__glink_PLTresolve (0) 0x8001000ce8
758   6: NOTYPE	LOCAL	00000011.plt_call.__libc_start_main@@GLIBC_2.3 (0) 0x80010008a0
759   7: NOTYPE	LOCAL	00000011.plt_call.__cxa_finalize@@GLIBC_2.3 (0) 0x80010008b4
760   8: NOTYPE	LOCAL	__init_array_end (0) 0x800101fde8
761   9: NOTYPE	LOCAL	__init_array_start (0) 0x800101fde0
762  10: SECTION	LOCAL	 (0) 0x8001000238
763  11: SECTION	LOCAL	 (0) 0x800100024c
764  12: SECTION	LOCAL	 (0) 0x800100026c
765  13: SECTION	LOCAL	 (0) 0x8001000290
766  14: SECTION	LOCAL	 (0) 0x80010002c0
767  15: SECTION	LOCAL	 (0) 0x80010003e0
768  16: SECTION	LOCAL	 (0) 0x8001000488
769  17: SECTION	LOCAL	 (0) 0x80010004a0
770  18: SECTION	LOCAL	 (0) 0x80010004c0
771  19: SECTION	LOCAL	 (0) 0x8001000820
772  20: SECTION	LOCAL	 (0) 0x8001000850
773  21: SECTION	LOCAL	 (0) 0x80010008a0
774  22: SECTION	LOCAL	 (0) 0x8001000d30
775  23: SECTION	LOCAL	 (0) 0x8001000d4c
776  24: SECTION	LOCAL	 (0) 0x8001000d50
777  25: SECTION	LOCAL	 (0) 0x8001000d70
778  26: SECTION	LOCAL	 (0) 0x800101fde0
779  27: SECTION	LOCAL	 (0) 0x800101fde8
780  28: SECTION	LOCAL	 (0) 0x800101fdf0
781  29: SECTION	LOCAL	 (0) 0x800101fdf8
782  30: SECTION	LOCAL	 (0) 0x800101fe20
783  31: SECTION	LOCAL	 (0) 0x8001020000
784  32: SECTION	LOCAL	 (0) 0x8001020010
785  33: SECTION	LOCAL	 (0) 0x80010200d8
786  34: SECTION	LOCAL	 (0) 0x8001020110
787  35: SECTION	LOCAL	 (0) 0x8001020158
788  36: FUNC	GLOBAL	__libc_start_main (0) 0
789  37: NOTYPE	WEAK	_ITM_deregisterTMCloneTable (0) 0
790  38: NOTYPE	WEAK	__gmon_start__ (0) 0
791  39: FUNC	WEAK	__cxa_finalize (0) 0
792  40: NOTYPE	WEAK	_Jv_RegisterClasses (0) 0
793  41: NOTYPE	WEAK	_ITM_registerTMCloneTable (0) 0
794  42: NOTYPE	GLOBAL	_edata (0) 0x8001020110
795  43: NOTYPE	GLOBAL	_end (0) 0x8001020160
796  44: NOTYPE	GLOBAL	__bss_start (0) 0x8001020110
797EOF
798
799cat testfile.symtab.in \
800  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebaztabppc64
801
802cat testfile.symtab.in \
803  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazdbgppc64
804
805cat testfile.symtab_pl.in \
806  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazdbgppc64_pl
807
808sed s/0x8001/0x4200/g testfile.symtab_pl.in \
809  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazdbgppc64_plr
810
811cat testfile.dynsym.in \
812  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazdynppc64
813
814cat testfile.symtab.in \
815  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazmdbppc64
816
817cat testfile.minsym.in \
818  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazminppc64
819
820cat testfile.minsym_pl.in \
821  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazminppc64_pl
822
823sed s/0x8001/0x4200/g testfile.minsym_pl.in \
824  | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazminppc64_plr
825
826exit 0
827