blob: 6ba6ecef4d1f8e737c1e4e26785f65d8a62bf57e [file] [log] [blame]
mostang.com!davidm3640bb42004-05-05 01:58:44 +00001#!/bin/sh
2verbose=false
3if [ "$1" = "-v" ]; then
4 verbose=true
5 shift
6fi
7
8build_plat=@build_arch@
9plat=@arch@
10os=@target_os@
11num_errors=0
12
13LIBUNWIND=../src/.libs/libunwind.so
14LIBUNWIND_GENERIC=../src/.libs/libunwind-${plat}.so
15
16function fetch_symtab {
17 filename=$1
18
19 if [ ! -r $filename ]; then
20 return
21 fi
22
23 if $verbose; then
24 echo "Checking $filename..."
25 fi
26
27 #
28 # Unfortunately, "nm --defined" is a GNU-extension. For portability,
29 # build the list of defined symbols by hand.
30 #
31 symtab=`nm -g $filename`
32 saved_IFS="$IFS"
33 IFS=""
34 undef=`nm -g -u $filename`
35 for line in $undef; do
36 symtab=`echo "$symtab" | grep -v "^${line}"\$`
37 done;
38 IFS="$saved_IFS"
39}
40
41function ignore {
42 sym=$1
43 symtab=`echo "$symtab" | grep -v " ${sym}\$"`
44}
45
46function match {
47 sym=$1
48 if `echo "$symtab" | grep -q " ${sym}\$"`; then
49 symtab=`echo "$symtab" | grep -v " ${sym}\$"`
50 else
51 echo " ERROR: Symbol \"$sym\" missing."
52 num_errors=`expr $num_errors + 1`
53 fi
54}
55
56#
57# Filter out miscellaneous symbols that get defined by the
58# linker for each shared object.
59#
60function filter_misc {
61 ignore _DYNAMIC
62 ignore _GLOBAL_OFFSET_TABLE_
63 ignore __bss_start
64 ignore _edata
65 ignore _end
66 ignore _Uelf32_get_proc_name
67 ignore _Uelf32_valid_object
68 ignore _Uelf64_get_proc_name
69 ignore _Uelf64_valid_object
70 ignore _U.*debug_level
71 ignore ICRT.INTERNAL # ICC 8.x defines this
72}
73
74function check_local_unw_abi {
75 match _UL${plat}_create_addr_space
76 match _UL${plat}_destroy_addr_space
77 match _UL${plat}_get_fpreg
78 match _UL${plat}_get_proc_info
79 match _UL${plat}_get_proc_info_by_ip
80 match _UL${plat}_get_proc_name
81 match _UL${plat}_get_reg
82 match _UL${plat}_get_save_loc
83 match _UL${plat}_init_local
84 match _UL${plat}_init_remote
85 match _UL${plat}_is_signal_frame
86 match _UL${plat}_local_addr_space
87 match _UL${plat}_resume
88 match _UL${plat}_set_caching_policy
89 match _UL${plat}_set_reg
90 match _UL${plat}_set_fpreg
91 match _UL${plat}_step
92
93 match _U${plat}_flush_cache
94 match _U${plat}_get_accessors
95 match _U${plat}_getcontext
96 match _U${plat}_regname
97
98 match _U_dyn_cancel
99 match _U_dyn_info_list_addr
100 match _U_dyn_register
101
102 match backtrace
103
104 case ${plat} in
105 ia64)
106 match _UL${plat}_search_unwind_table
107 match _U${plat}_get_elf_image
108 ;;
109 *)
110 match _UL${plat}_is_fpreg
111 match _UL${plat}_dwarf_search_unwind_table
112 ;;
113 esac
114}
115
116function check_generic_unw_abi {
117 match _U${plat}_create_addr_space
118 match _U${plat}_destroy_addr_space
119 match _U${plat}_flush_cache
120 match _U${plat}_get_accessors
121 match _U${plat}_get_fpreg
122 match _U${plat}_get_proc_info
123 match _U${plat}_get_proc_info_by_ip
124 match _U${plat}_get_proc_name
125 match _U${plat}_get_reg
126 match _U${plat}_get_save_loc
127 match _U${plat}_init_local
128 match _U${plat}_init_remote
129 match _U${plat}_is_signal_frame
130 match _U${plat}_local_addr_space
131 match _U${plat}_regname
132 match _U${plat}_resume
133 match _U${plat}_set_caching_policy
134 match _U${plat}_set_fpreg
135 match _U${plat}_set_reg
136 match _U${plat}_step
137
138 case ${plat} in
139 ia64)
140 match _U${plat}_search_unwind_table
141 match _U${plat}_find_dyn_list
142 match _U${plat}_get_kernel_table
143 match _U${plat}_get_elf_image
144 ;;
145 *)
146 match _U${plat}_is_fpreg
147 match _U${plat}_dwarf_search_unwind_table
148 ;;
149 esac
150}
151
152function check_cxx_abi {
153 match _Unwind_Backtrace
154 match _Unwind_DeleteException
155 match _Unwind_FindEnclosingFunction
156 match _Unwind_ForcedUnwind
157 match _Unwind_GetBSP
158 match _Unwind_GetCFA
159 match _Unwind_GetDataRelBase
160 match _Unwind_GetGR
161 match _Unwind_GetIP
162 match _Unwind_GetLanguageSpecificData
163 match _Unwind_GetRegionStart
164 match _Unwind_GetTextRelBase
165 match _Unwind_RaiseException
166 match _Unwind_Resume
167 match _Unwind_Resume_or_Rethrow
168 match _Unwind_SetGR
169 match _Unwind_SetIP
170 case $os in
171 linux*)
172 # needed only for Intel 8.0 bug-compatibility
173 match _ReadSLEB
174 match _ReadULEB
175 ;;
176 esac
177}
178
179function check_empty {
180 if [ -n "$symtab" ]; then
181 echo -e " ERROR: Extraneous symbols:\n$symtab"
182 num_errors=`expr $num_errors + 1`
183 fi
184}
185
186if [ $plat = $build_plat ]; then
187 fetch_symtab $LIBUNWIND
188 filter_misc
189 check_local_unw_abi
190 check_cxx_abi
191 check_empty
192fi
193
194fetch_symtab $LIBUNWIND_GENERIC
195filter_misc
196check_generic_unw_abi
197check_empty
198
199if [ $num_errors -gt 0 ]; then
200 echo "FAILURE: Detected $num_errors errors"
201 exit -1
202fi
203
204if $verbose; then
205 echo " SUCCESS: all checks passed"
206fi
207exit 0