]> git.pld-linux.org Git - packages/glibc.git/blob - glibc-gcc3.patch
- updated man-pages section 3 sources to use:
[packages/glibc.git] / glibc-gcc3.patch
1 #! /bin/sh -e
2
3 # DP: Patch to allow glibc to interact with gcc3 correctly. Patch provided
4 # DP: by Jakub Jelinek.
5
6 if [ $# -ne 2 ]; then
7     echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
8     exit 1
9 fi
10 case "$1" in
11     -patch)
12         patch -d "$2" -f --no-backup-if-mismatch -p1 < $0
13         cd $2 && autoconf
14         ;;
15     -unpatch)
16         patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0
17         cd $2 && autoconf
18         ;;
19     *)
20         echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
21         exit 1
22 esac
23 exit 0
24
25 2001-10-02  Jakub Jelinek  <jakub@redhat.com>
26             H.J. Lu  <hjl@gnu.org>
27
28         * Versions.def (libc): Add GCC_3.0.
29         * configure.in (libc_cv_gcc_static_libgcc): Set to -static-libgcc
30         if gcc supports this flag.
31         (EXPORT_UNWIND_FIND_FDE): Define unless target configure
32         disables it.
33         (gcc3): Allow glibc to be compiled with gcc 3.x.
34         * configure: Rebuilt.
35         * config.h.in (EXPORT_UNWIND_FIND_FDE): Add.
36         * config.make.in (static-libgcc): Add.
37         * Makerules (build-shlib-helper, build-module-helper): Use it.
38         * scripts/versions.awk: Make sure GLIBC_ versions come first.
39         * elf/soinit.c (__libc_global_ctors): Set tbases and dbases if
40         necessary.
41         (_fini): Call __deregister_frame_info_bases if
42         __register_frame_info_bases was used to register.
43         * elf/Versions (__register_frame_info, __deregister_frame_info): Add
44         at GLIBC_2.0.
45         (__register_frame_info_bases, __register_frame_info_table_bases,
46         __deregister_frame_info_bases, _Unwind_Find_FDE): Add at GCC_3.0.
47         * elf/Makefile (routines): Add unwind-dw2-fde.
48         (shared-only-routines): Add unwind-dw2-fde.
49         * sysdeps/alpha/gccframe.h: New.
50         * sysdeps/arm/gccframe.h: New.
51         * sysdeps/generic/framestate.c: New.
52         * sysdeps/generic/dwarf2.h: New.
53         * sysdeps/generic/gccframe.h (struct object): Update from gcc 3.0.
54         * sysdeps/generic/unwind-dw2-fde.c: New.
55         * sysdeps/unix/sysv/linux/ia64/unwind-dw2-fde.c: New.
56         * sysdeps/generic/unwind-dw2-fde.h: New.
57         * sysdeps/generic/unwind-dw2.c: New.
58         * sysdeps/generic/unwind-pe.h: New.
59         * sysdeps/generic/unwind.h: New.
60         * sysdeps/hppa/gccframe.h: New.
61         * sysdeps/i386/gccframe.h: New.
62         * sysdeps/m68k/gccframe.h: New.
63         * sysdeps/mips/gccframe.h: New.
64         * sysdeps/powerpc/gccframe.h: New.
65         * sysdeps/s390/gccframe.h: New.
66         * sysdeps/sh/gccframe.h: New.
67         * sysdeps/sparc/gccframe.h: New.
68         * sysdeps/vax/gccframe.h: New.
69         * sysdeps/unix/sysv/linux/configure.in (libc_cv_gcc_unwind_find_fde):
70         Set to no on ia64.
71         * sysdeps/unix/sysv/linux/configure: Rebuilt.
72         * sysdeps/mach/hurd/i386/Versions (__register_frame_info,
73         __deregister_frame_info): Move to elf/Versions.
74         * sysdeps/unix/sysv/linux/m68k/Versions: Likewise.
75         * sysdeps/unix/sysv/linux/arm/Versions: Likewise.
76         * sysdeps/unix/sysv/linux/alpha/Versions: Likewise.
77         * sysdeps/unix/sysv/linux/i386/Versions: Likewise.
78         * sysdeps/unix/sysv/linux/mips/Versions: Likewise.
79         * sysdeps/unix/sysv/linux/powerpc/Versions: Likewise.
80         * sysdeps/unix/sysv/linux/s390/s390-32/Versions: Likewise.
81         * sysdeps/unix/sysv/linux/sparc/sparc32/Versions: Likewise.
82         * sysdeps/unix/sysv/linux/sparc/sparc64/Versions: Likewise.
83         * sysdeps/mach/hurd/i386/Makefile (sysdep-routines): Add
84         framestate.
85         * sysdeps/unix/sysv/linux/arm/Makefile: Likewise.
86         * sysdeps/unix/sysv/linux/alpha/Makefile: Likewise.
87         * sysdeps/unix/sysv/linux/i386/Makefile: Likewise.
88         * sysdeps/unix/sysv/linux/m68k/Makefile: Likewise.
89         * sysdeps/unix/sysv/linux/mips/Makefile: Likewise.
90         * sysdeps/unix/sysv/linux/powerpc/Makefile: Likewise.
91         * sysdeps/unix/sysv/linux/s390/s390-32/Makefile: Likewise.
92         * sysdeps/unix/sysv/linux/sparc/Makefile: Likewise.
93
94 --- libc/elf/soinit.c.jj        Wed May 23 09:21:41 2001
95 +++ libc/elf/soinit.c   Tue Oct  2 17:46:23 2001
96 @@ -4,6 +4,7 @@
97     calling those lists of functions.  */
98  
99  #include <libc-internal.h>
100 +#include <stdlib.h>
101  
102  #ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
103  # include <gccframe.h>
104 @@ -29,7 +30,10 @@ static char __EH_FRAME_BEGIN__[]
105       = { };
106  # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
107  extern void __register_frame_info (const void *, struct object *);
108 +extern void __register_frame_info_bases (const void *, struct object *,
109 +                                        void *, void *);
110  extern void __deregister_frame_info (const void *);
111 +extern void __deregister_frame_info_bases (const void *);
112  # else
113  extern void __register_frame (const void *);
114  extern void __deregister_frame (const void *);
115 @@ -47,7 +51,23 @@ __libc_global_ctors (void)
116  # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
117    {
118      static struct object ob;
119 +#  if defined(CRT_GET_RFIB_TEXT) || defined(CRT_GET_RFIB_DATA)
120 +    void *tbase, *dbase;
121 +
122 +#   ifdef CRT_GET_RFIB_TEXT
123 +    CRT_GET_RFIB_TEXT (tbase);
124 +#   else
125 +    tbase = NULL;
126 +#   endif
127 +#   ifdef CRT_GET_RFIB_DATA
128 +    CRT_GET_RFIB_DATA (dbase);
129 +#   else
130 +    dbase = NULL;
131 +#   endif
132 +    __register_frame_info_bases (__EH_FRAME_BEGIN__, &ob, tbase, dbase);
133 +#  else
134      __register_frame_info (__EH_FRAME_BEGIN__, &ob);
135 +#  endif
136    }
137  # else
138    __register_frame (__EH_FRAME_BEGIN__);
139 @@ -66,7 +86,11 @@ _fini (void)
140    run_hooks (__DTOR_LIST__);
141  #ifdef HAVE_DWARF2_UNWIND_INFO
142  # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
143 +#  if defined(CRT_GET_RFIB_TEXT) || defined(CRT_GET_RFIB_DATA)
144 +  __deregister_frame_info_bases (__EH_FRAME_BEGIN__);
145 +#  else
146    __deregister_frame_info (__EH_FRAME_BEGIN__);
147 +#  endif
148  # else
149    __deregister_frame (__EH_FRAME_BEGIN__);
150  # endif
151 --- libc/elf/Versions.jj        Thu Aug 23 18:47:05 2001
152 +++ libc/elf/Versions   Tue Oct  2 17:30:51 2001
153 @@ -2,6 +2,9 @@ libc {
154    GLIBC_2.0 {
155      # functions used in other libraries
156      _dl_open; _dl_close; _dl_addr;
157 +%ifdef EXPORT_UNWIND_FIND_FDE
158 +    __register_frame_info; __deregister_frame_info;
159 +%endif
160    }
161    GLIBC_2.1 {
162      # functions used in other libraries
163 @@ -17,6 +20,12 @@ libc {
164    GLIBC_2.2.4 {
165      dl_iterate_phdr;
166    }
167 +%ifdef EXPORT_UNWIND_FIND_FDE
168 +  GCC_3.0 {
169 +    __register_frame_info_bases; __deregister_frame_info_bases;
170 +    __register_frame_info_table_bases; _Unwind_Find_FDE;
171 +  }
172 +%endif
173  }
174  
175  ld {
176 --- libc/elf/Makefile.jj        Mon Oct  1 12:24:38 2001
177 +++ libc/elf/Makefile   Tue Oct  2 17:30:51 2001
178 @@ -23,7 +23,8 @@ subdir                := elf
179  headers                = elf.h bits/elfclass.h link.h
180  routines       = $(dl-routines) dl-open dl-close dl-support dl-iteratephdr \
181                   dl-iteratephdr-static dl-addr enbl-secure dl-profstub \
182 -                 dl-origin dl-libc dl-sym
183 +                 dl-origin dl-libc dl-sym unwind-dw2-fde
184 +shared-only-routines = unwind-dw2-fde
185  
186  # The core dynamic linking functions are in libc for the static and
187  # profiled libraries.
188 --- libc/scripts/versions.awk.jj        Tue Mar 21 11:58:25 2000
189 +++ libc/scripts/versions.awk   Tue Oct  2 17:30:51 2001
190 @@ -61,7 +61,10 @@ BEGIN {
191  # current library.  This is the only place where we print something to
192  # the intermediate file.
193  /^   / {
194 -  printf("%s %s %s\n", actlib, actver, $0) | sort;
195 +  sortver=actver
196 +  # Ensure GLIBC_ versions come always first
197 +  sub(/^GLIBC_/," GLIBC_",sortver)
198 +  printf("%s %s %s\n", actlib, sortver, $0) | sort;
199  }
200  
201  
202 --- libc/sysdeps/alpha/gccframe.h.jj    Tue Oct  2 17:30:51 2001
203 +++ libc/sysdeps/alpha/gccframe.h       Tue Oct  2 17:30:51 2001
204 @@ -0,0 +1,22 @@
205 +/* Definition of object in frame unwind info.  alpha version.
206 +   Copyright (C) 2001 Free Software Foundation, Inc.
207 +   This file is part of the GNU C Library.
208 +
209 +   The GNU C Library is free software; you can redistribute it and/or
210 +   modify it under the terms of the GNU Lesser General Public
211 +   License as published by the Free Software Foundation; either
212 +   version 2.1 of the License, or (at your option) any later version.
213 +
214 +   The GNU C Library is distributed in the hope that it will be useful,
215 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
216 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
217 +   Lesser General Public License for more details.
218 +
219 +   You should have received a copy of the GNU Lesser General Public
220 +   License along with the GNU C Library; if not, write to the Free
221 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
222 +   02111-1307 USA.  */
223 +
224 +#define FIRST_PSEUDO_REGISTER 64
225 +
226 +#include <sysdeps/generic/gccframe.h>
227 --- libc/sysdeps/arm/gccframe.h.jj      Tue Oct  2 17:30:51 2001
228 +++ libc/sysdeps/arm/gccframe.h Tue Oct  2 17:30:51 2001
229 @@ -0,0 +1,22 @@
230 +/* Definition of object in frame unwind info.  arm version.
231 +   Copyright (C) 2001 Free Software Foundation, Inc.
232 +   This file is part of the GNU C Library.
233 +
234 +   The GNU C Library is free software; you can redistribute it and/or
235 +   modify it under the terms of the GNU Lesser General Public
236 +   License as published by the Free Software Foundation; either
237 +   version 2.1 of the License, or (at your option) any later version.
238 +
239 +   The GNU C Library is distributed in the hope that it will be useful,
240 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
241 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
242 +   Lesser General Public License for more details.
243 +
244 +   You should have received a copy of the GNU Lesser General Public
245 +   License along with the GNU C Library; if not, write to the Free
246 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
247 +   02111-1307 USA.  */
248 +
249 +#define FIRST_PSEUDO_REGISTER 27
250 +
251 +#include <sysdeps/generic/gccframe.h>
252 --- libc/sysdeps/generic/dwarf2.h.jj    Tue Oct  2 17:30:51 2001
253 +++ libc/sysdeps/generic/dwarf2.h       Tue Oct  2 17:30:51 2001
254 @@ -0,0 +1,585 @@
255 +/* Declarations and definitions of codes relating to the DWARF2 symbolic
256 +   debugging information format.
257 +   Copyright (C) 1992, 1993, 1995, 1996, 1997, 2000 
258 +   Free Software Foundation, Inc.
259 +   Contributed by Gary Funck (gary@intrepid.com).  Derived from the
260 +   DWARF 1 implementation written by Ron Guilmette (rfg@monkeys.com).
261 +
262 +This file is part of GNU CC.
263 +
264 +GNU CC is free software; you can redistribute it and/or modify
265 +it under the terms of the GNU General Public License as published by
266 +the Free Software Foundation; either version 2, or (at your option)
267 +any later version.
268 +
269 +GNU CC is distributed in the hope that it will be useful,
270 +but WITHOUT ANY WARRANTY; without even the implied warranty of
271 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
272 +GNU General Public License for more details.
273 +
274 +You should have received a copy of the GNU General Public License
275 +along with GNU CC; see the file COPYING.  If not, write to
276 +the Free Software Foundation, 59 Temple Place - Suite 330,
277 +Boston, MA 02111-1307, USA.  */
278 +
279 +/* This file is derived from the DWARF specification (a public document)
280 +   Revision 2.0.0 (July 27, 1993) developed by the UNIX International
281 +   Programming Languages Special Interest Group (UI/PLSIG) and distributed
282 +   by UNIX International.  Copies of this specification are available from
283 +   UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.  */
284 +
285 +/* This file is shared between GCC and GDB, and should not contain
286 +   prototypes.  */
287 +
288 +/* Tag names and codes.  */
289 +
290 +enum dwarf_tag
291 +  {
292 +    DW_TAG_padding = 0x00,
293 +    DW_TAG_array_type = 0x01,
294 +    DW_TAG_class_type = 0x02,
295 +    DW_TAG_entry_point = 0x03,
296 +    DW_TAG_enumeration_type = 0x04,
297 +    DW_TAG_formal_parameter = 0x05,
298 +    DW_TAG_imported_declaration = 0x08,
299 +    DW_TAG_label = 0x0a,
300 +    DW_TAG_lexical_block = 0x0b,
301 +    DW_TAG_member = 0x0d,
302 +    DW_TAG_pointer_type = 0x0f,
303 +    DW_TAG_reference_type = 0x10,
304 +    DW_TAG_compile_unit = 0x11,
305 +    DW_TAG_string_type = 0x12,
306 +    DW_TAG_structure_type = 0x13,
307 +    DW_TAG_subroutine_type = 0x15,
308 +    DW_TAG_typedef = 0x16,
309 +    DW_TAG_union_type = 0x17,
310 +    DW_TAG_unspecified_parameters = 0x18,
311 +    DW_TAG_variant = 0x19,
312 +    DW_TAG_common_block = 0x1a,
313 +    DW_TAG_common_inclusion = 0x1b,
314 +    DW_TAG_inheritance = 0x1c,
315 +    DW_TAG_inlined_subroutine = 0x1d,
316 +    DW_TAG_module = 0x1e,
317 +    DW_TAG_ptr_to_member_type = 0x1f,
318 +    DW_TAG_set_type = 0x20,
319 +    DW_TAG_subrange_type = 0x21,
320 +    DW_TAG_with_stmt = 0x22,
321 +    DW_TAG_access_declaration = 0x23,
322 +    DW_TAG_base_type = 0x24,
323 +    DW_TAG_catch_block = 0x25,
324 +    DW_TAG_const_type = 0x26,
325 +    DW_TAG_constant = 0x27,
326 +    DW_TAG_enumerator = 0x28,
327 +    DW_TAG_file_type = 0x29,
328 +    DW_TAG_friend = 0x2a,
329 +    DW_TAG_namelist = 0x2b,
330 +    DW_TAG_namelist_item = 0x2c,
331 +    DW_TAG_packed_type = 0x2d,
332 +    DW_TAG_subprogram = 0x2e,
333 +    DW_TAG_template_type_param = 0x2f,
334 +    DW_TAG_template_value_param = 0x30,
335 +    DW_TAG_thrown_type = 0x31,
336 +    DW_TAG_try_block = 0x32,
337 +    DW_TAG_variant_part = 0x33,
338 +    DW_TAG_variable = 0x34,
339 +    DW_TAG_volatile_type = 0x35,
340 +    /* SGI/MIPS Extensions */
341 +    DW_TAG_MIPS_loop = 0x4081,
342 +    /* GNU extensions */
343 +    DW_TAG_format_label = 0x4101,      /* for FORTRAN 77 and Fortran 90 */
344 +    DW_TAG_function_template = 0x4102, /* for C++ */
345 +    DW_TAG_class_template = 0x4103,    /* for C++ */
346 +    DW_TAG_GNU_BINCL = 0x4104,
347 +    DW_TAG_GNU_EINCL = 0x4105
348 +  };
349 +
350 +#define DW_TAG_lo_user 0x4080
351 +#define DW_TAG_hi_user 0xffff
352 +
353 +/* flag that tells whether entry has a child or not */
354 +#define DW_children_no   0
355 +#define        DW_children_yes  1
356 +
357 +/* Form names and codes.  */
358 +enum dwarf_form
359 +  {
360 +    DW_FORM_addr = 0x01,
361 +    DW_FORM_block2 = 0x03,
362 +    DW_FORM_block4 = 0x04,
363 +    DW_FORM_data2 = 0x05,
364 +    DW_FORM_data4 = 0x06,
365 +    DW_FORM_data8 = 0x07,
366 +    DW_FORM_string = 0x08,
367 +    DW_FORM_block = 0x09,
368 +    DW_FORM_block1 = 0x0a,
369 +    DW_FORM_data1 = 0x0b,
370 +    DW_FORM_flag = 0x0c,
371 +    DW_FORM_sdata = 0x0d,
372 +    DW_FORM_strp = 0x0e,
373 +    DW_FORM_udata = 0x0f,
374 +    DW_FORM_ref_addr = 0x10,
375 +    DW_FORM_ref1 = 0x11,
376 +    DW_FORM_ref2 = 0x12,
377 +    DW_FORM_ref4 = 0x13,
378 +    DW_FORM_ref8 = 0x14,
379 +    DW_FORM_ref_udata = 0x15,
380 +    DW_FORM_indirect = 0x16
381 +  };
382 +
383 +/* Attribute names and codes.  */
384 +
385 +enum dwarf_attribute
386 +  {
387 +    DW_AT_sibling = 0x01,
388 +    DW_AT_location = 0x02,
389 +    DW_AT_name = 0x03,
390 +    DW_AT_ordering = 0x09,
391 +    DW_AT_subscr_data = 0x0a,
392 +    DW_AT_byte_size = 0x0b,
393 +    DW_AT_bit_offset = 0x0c,
394 +    DW_AT_bit_size = 0x0d,
395 +    DW_AT_element_list = 0x0f,
396 +    DW_AT_stmt_list = 0x10,
397 +    DW_AT_low_pc = 0x11,
398 +    DW_AT_high_pc = 0x12,
399 +    DW_AT_language = 0x13,
400 +    DW_AT_member = 0x14,
401 +    DW_AT_discr = 0x15,
402 +    DW_AT_discr_value = 0x16,
403 +    DW_AT_visibility = 0x17,
404 +    DW_AT_import = 0x18,
405 +    DW_AT_string_length = 0x19,
406 +    DW_AT_common_reference = 0x1a,
407 +    DW_AT_comp_dir = 0x1b,
408 +    DW_AT_const_value = 0x1c,
409 +    DW_AT_containing_type = 0x1d,
410 +    DW_AT_default_value = 0x1e,
411 +    DW_AT_inline = 0x20,
412 +    DW_AT_is_optional = 0x21,
413 +    DW_AT_lower_bound = 0x22,
414 +    DW_AT_producer = 0x25,
415 +    DW_AT_prototyped = 0x27,
416 +    DW_AT_return_addr = 0x2a,
417 +    DW_AT_start_scope = 0x2c,
418 +    DW_AT_stride_size = 0x2e,
419 +    DW_AT_upper_bound = 0x2f,
420 +    DW_AT_abstract_origin = 0x31,
421 +    DW_AT_accessibility = 0x32,
422 +    DW_AT_address_class = 0x33,
423 +    DW_AT_artificial = 0x34,
424 +    DW_AT_base_types = 0x35,
425 +    DW_AT_calling_convention = 0x36,
426 +    DW_AT_count = 0x37,
427 +    DW_AT_data_member_location = 0x38,
428 +    DW_AT_decl_column = 0x39,
429 +    DW_AT_decl_file = 0x3a,
430 +    DW_AT_decl_line = 0x3b,
431 +    DW_AT_declaration = 0x3c,
432 +    DW_AT_discr_list = 0x3d,
433 +    DW_AT_encoding = 0x3e,
434 +    DW_AT_external = 0x3f,
435 +    DW_AT_frame_base = 0x40,
436 +    DW_AT_friend = 0x41,
437 +    DW_AT_identifier_case = 0x42,
438 +    DW_AT_macro_info = 0x43,
439 +    DW_AT_namelist_items = 0x44,
440 +    DW_AT_priority = 0x45,
441 +    DW_AT_segment = 0x46,
442 +    DW_AT_specification = 0x47,
443 +    DW_AT_static_link = 0x48,
444 +    DW_AT_type = 0x49,
445 +    DW_AT_use_location = 0x4a,
446 +    DW_AT_variable_parameter = 0x4b,
447 +    DW_AT_virtuality = 0x4c,
448 +    DW_AT_vtable_elem_location = 0x4d,
449 +    /* SGI/MIPS Extensions */
450 +    DW_AT_MIPS_fde = 0x2001,
451 +    DW_AT_MIPS_loop_begin = 0x2002,
452 +    DW_AT_MIPS_tail_loop_begin = 0x2003,
453 +    DW_AT_MIPS_epilog_begin = 0x2004,
454 +    DW_AT_MIPS_loop_unroll_factor = 0x2005,
455 +    DW_AT_MIPS_software_pipeline_depth = 0x2006,
456 +    DW_AT_MIPS_linkage_name = 0x2007,
457 +    DW_AT_MIPS_stride = 0x2008,
458 +    DW_AT_MIPS_abstract_name = 0x2009,
459 +    DW_AT_MIPS_clone_origin = 0x200a,
460 +    DW_AT_MIPS_has_inlines = 0x200b,
461 +    /* GNU extensions.  */
462 +    DW_AT_sf_names = 0x2101,
463 +    DW_AT_src_info = 0x2102,
464 +    DW_AT_mac_info = 0x2103,
465 +    DW_AT_src_coords = 0x2104,
466 +    DW_AT_body_begin = 0x2105,
467 +    DW_AT_body_end = 0x2106
468 +  };
469 +
470 +#define DW_AT_lo_user  0x2000  /* implementation-defined range start */
471 +#define DW_AT_hi_user  0x3ff0  /* implementation-defined range end */
472 +
473 +/* Location atom names and codes.  */
474 +
475 +enum dwarf_location_atom
476 +  {
477 +    DW_OP_addr = 0x03,
478 +    DW_OP_deref = 0x06,
479 +    DW_OP_const1u = 0x08,
480 +    DW_OP_const1s = 0x09,
481 +    DW_OP_const2u = 0x0a,
482 +    DW_OP_const2s = 0x0b,
483 +    DW_OP_const4u = 0x0c,
484 +    DW_OP_const4s = 0x0d,
485 +    DW_OP_const8u = 0x0e,
486 +    DW_OP_const8s = 0x0f,
487 +    DW_OP_constu = 0x10,
488 +    DW_OP_consts = 0x11,
489 +    DW_OP_dup = 0x12,
490 +    DW_OP_drop = 0x13,
491 +    DW_OP_over = 0x14,
492 +    DW_OP_pick = 0x15,
493 +    DW_OP_swap = 0x16,
494 +    DW_OP_rot = 0x17,
495 +    DW_OP_xderef = 0x18,
496 +    DW_OP_abs = 0x19,
497 +    DW_OP_and = 0x1a,
498 +    DW_OP_div = 0x1b,
499 +    DW_OP_minus = 0x1c,
500 +    DW_OP_mod = 0x1d,
501 +    DW_OP_mul = 0x1e,
502 +    DW_OP_neg = 0x1f,
503 +    DW_OP_not = 0x20,
504 +    DW_OP_or = 0x21,
505 +    DW_OP_plus = 0x22,
506 +    DW_OP_plus_uconst = 0x23,
507 +    DW_OP_shl = 0x24,
508 +    DW_OP_shr = 0x25,
509 +    DW_OP_shra = 0x26,
510 +    DW_OP_xor = 0x27,
511 +    DW_OP_bra = 0x28,
512 +    DW_OP_eq = 0x29,
513 +    DW_OP_ge = 0x2a,
514 +    DW_OP_gt = 0x2b,
515 +    DW_OP_le = 0x2c,
516 +    DW_OP_lt = 0x2d,
517 +    DW_OP_ne = 0x2e,
518 +    DW_OP_skip = 0x2f,
519 +    DW_OP_lit0 = 0x30,
520 +    DW_OP_lit1 = 0x31,
521 +    DW_OP_lit2 = 0x32,
522 +    DW_OP_lit3 = 0x33,
523 +    DW_OP_lit4 = 0x34,
524 +    DW_OP_lit5 = 0x35,
525 +    DW_OP_lit6 = 0x36,
526 +    DW_OP_lit7 = 0x37,
527 +    DW_OP_lit8 = 0x38,
528 +    DW_OP_lit9 = 0x39,
529 +    DW_OP_lit10 = 0x3a,
530 +    DW_OP_lit11 = 0x3b,
531 +    DW_OP_lit12 = 0x3c,
532 +    DW_OP_lit13 = 0x3d,
533 +    DW_OP_lit14 = 0x3e,
534 +    DW_OP_lit15 = 0x3f,
535 +    DW_OP_lit16 = 0x40,
536 +    DW_OP_lit17 = 0x41,
537 +    DW_OP_lit18 = 0x42,
538 +    DW_OP_lit19 = 0x43,
539 +    DW_OP_lit20 = 0x44,
540 +    DW_OP_lit21 = 0x45,
541 +    DW_OP_lit22 = 0x46,
542 +    DW_OP_lit23 = 0x47,
543 +    DW_OP_lit24 = 0x48,
544 +    DW_OP_lit25 = 0x49,
545 +    DW_OP_lit26 = 0x4a,
546 +    DW_OP_lit27 = 0x4b,
547 +    DW_OP_lit28 = 0x4c,
548 +    DW_OP_lit29 = 0x4d,
549 +    DW_OP_lit30 = 0x4e,
550 +    DW_OP_lit31 = 0x4f,
551 +    DW_OP_reg0 = 0x50,
552 +    DW_OP_reg1 = 0x51,
553 +    DW_OP_reg2 = 0x52,
554 +    DW_OP_reg3 = 0x53,
555 +    DW_OP_reg4 = 0x54,
556 +    DW_OP_reg5 = 0x55,
557 +    DW_OP_reg6 = 0x56,
558 +    DW_OP_reg7 = 0x57,
559 +    DW_OP_reg8 = 0x58,
560 +    DW_OP_reg9 = 0x59,
561 +    DW_OP_reg10 = 0x5a,
562 +    DW_OP_reg11 = 0x5b,
563 +    DW_OP_reg12 = 0x5c,
564 +    DW_OP_reg13 = 0x5d,
565 +    DW_OP_reg14 = 0x5e,
566 +    DW_OP_reg15 = 0x5f,
567 +    DW_OP_reg16 = 0x60,
568 +    DW_OP_reg17 = 0x61,
569 +    DW_OP_reg18 = 0x62,
570 +    DW_OP_reg19 = 0x63,
571 +    DW_OP_reg20 = 0x64,
572 +    DW_OP_reg21 = 0x65,
573 +    DW_OP_reg22 = 0x66,
574 +    DW_OP_reg23 = 0x67,
575 +    DW_OP_reg24 = 0x68,
576 +    DW_OP_reg25 = 0x69,
577 +    DW_OP_reg26 = 0x6a,
578 +    DW_OP_reg27 = 0x6b,
579 +    DW_OP_reg28 = 0x6c,
580 +    DW_OP_reg29 = 0x6d,
581 +    DW_OP_reg30 = 0x6e,
582 +    DW_OP_reg31 = 0x6f,
583 +    DW_OP_breg0 = 0x70,
584 +    DW_OP_breg1 = 0x71,
585 +    DW_OP_breg2 = 0x72,
586 +    DW_OP_breg3 = 0x73,
587 +    DW_OP_breg4 = 0x74,
588 +    DW_OP_breg5 = 0x75,
589 +    DW_OP_breg6 = 0x76,
590 +    DW_OP_breg7 = 0x77,
591 +    DW_OP_breg8 = 0x78,
592 +    DW_OP_breg9 = 0x79,
593 +    DW_OP_breg10 = 0x7a,
594 +    DW_OP_breg11 = 0x7b,
595 +    DW_OP_breg12 = 0x7c,
596 +    DW_OP_breg13 = 0x7d,
597 +    DW_OP_breg14 = 0x7e,
598 +    DW_OP_breg15 = 0x7f,
599 +    DW_OP_breg16 = 0x80,
600 +    DW_OP_breg17 = 0x81,
601 +    DW_OP_breg18 = 0x82,
602 +    DW_OP_breg19 = 0x83,
603 +    DW_OP_breg20 = 0x84,
604 +    DW_OP_breg21 = 0x85,
605 +    DW_OP_breg22 = 0x86,
606 +    DW_OP_breg23 = 0x87,
607 +    DW_OP_breg24 = 0x88,
608 +    DW_OP_breg25 = 0x89,
609 +    DW_OP_breg26 = 0x8a,
610 +    DW_OP_breg27 = 0x8b,
611 +    DW_OP_breg28 = 0x8c,
612 +    DW_OP_breg29 = 0x8d,
613 +    DW_OP_breg30 = 0x8e,
614 +    DW_OP_breg31 = 0x8f,
615 +    DW_OP_regx = 0x90,
616 +    DW_OP_fbreg = 0x91,
617 +    DW_OP_bregx = 0x92,
618 +    DW_OP_piece = 0x93,
619 +    DW_OP_deref_size = 0x94,
620 +    DW_OP_xderef_size = 0x95,
621 +    DW_OP_nop = 0x96
622 +  };
623 +
624 +#define DW_OP_lo_user  0x80    /* implementation-defined range start */
625 +#define DW_OP_hi_user  0xff    /* implementation-defined range end */
626 +
627 +/* Type encodings.  */
628 +
629 +enum dwarf_type
630 +  {
631 +    DW_ATE_void = 0x0,
632 +    DW_ATE_address = 0x1,
633 +    DW_ATE_boolean = 0x2,
634 +    DW_ATE_complex_float = 0x3,
635 +    DW_ATE_float = 0x4,
636 +    DW_ATE_signed = 0x5,
637 +    DW_ATE_signed_char = 0x6,
638 +    DW_ATE_unsigned = 0x7,
639 +    DW_ATE_unsigned_char = 0x8
640 +  };
641 +
642 +#define        DW_ATE_lo_user 0x80
643 +#define        DW_ATE_hi_user 0xff
644 +
645 +/* Array ordering names and codes.  */
646 +enum dwarf_array_dim_ordering
647 +  {
648 +    DW_ORD_row_major = 0,
649 +    DW_ORD_col_major = 1
650 +  };
651 +
652 +/* access attribute */
653 +enum dwarf_access_attribute
654 +  {
655 +    DW_ACCESS_public = 1,
656 +    DW_ACCESS_protected = 2,
657 +    DW_ACCESS_private = 3
658 +  };
659 +
660 +/* visibility */
661 +enum dwarf_visibility_attribute
662 +  {
663 +    DW_VIS_local = 1,
664 +    DW_VIS_exported = 2,
665 +    DW_VIS_qualified = 3
666 +  };
667 +
668 +/* virtuality */
669 +enum dwarf_virtuality_attribute
670 +  {
671 +    DW_VIRTUALITY_none = 0,
672 +    DW_VIRTUALITY_virtual = 1,
673 +    DW_VIRTUALITY_pure_virtual = 2
674 +  };
675 +
676 +/* case sensitivity */
677 +enum dwarf_id_case
678 +  {
679 +    DW_ID_case_sensitive = 0,
680 +    DW_ID_up_case = 1,
681 +    DW_ID_down_case = 2,
682 +    DW_ID_case_insensitive = 3
683 +  };
684 +
685 +/* calling convention */
686 +enum dwarf_calling_convention
687 +  {
688 +    DW_CC_normal = 0x1,
689 +    DW_CC_program = 0x2,
690 +    DW_CC_nocall = 0x3
691 +  };
692 +
693 +#define DW_CC_lo_user 0x40
694 +#define DW_CC_hi_user 0xff
695 +
696 +/* inline attribute */
697 +enum dwarf_inline_attribute
698 +  {
699 +    DW_INL_not_inlined = 0,
700 +    DW_INL_inlined = 1,
701 +    DW_INL_declared_not_inlined = 2,
702 +    DW_INL_declared_inlined = 3
703 +  };
704 +
705 +/* discriminant lists */
706 +enum dwarf_discrim_list
707 +  {
708 +    DW_DSC_label = 0,
709 +    DW_DSC_range = 1
710 +  };
711 +
712 +/* line number opcodes */
713 +enum dwarf_line_number_ops
714 +  {
715 +    DW_LNS_extended_op = 0,
716 +    DW_LNS_copy = 1,
717 +    DW_LNS_advance_pc = 2,
718 +    DW_LNS_advance_line = 3,
719 +    DW_LNS_set_file = 4,
720 +    DW_LNS_set_column = 5,
721 +    DW_LNS_negate_stmt = 6,
722 +    DW_LNS_set_basic_block = 7,
723 +    DW_LNS_const_add_pc = 8,
724 +    DW_LNS_fixed_advance_pc = 9
725 +  };
726 +
727 +/* line number extended opcodes */
728 +enum dwarf_line_number_x_ops
729 +  {
730 +    DW_LNE_end_sequence = 1,
731 +    DW_LNE_set_address = 2,
732 +    DW_LNE_define_file = 3
733 +  };
734 +
735 +/* call frame information */
736 +enum dwarf_call_frame_info
737 +  {
738 +    DW_CFA_advance_loc = 0x40,
739 +    DW_CFA_offset = 0x80,
740 +    DW_CFA_restore = 0xc0,
741 +    DW_CFA_nop = 0x00,
742 +    DW_CFA_set_loc = 0x01,
743 +    DW_CFA_advance_loc1 = 0x02,
744 +    DW_CFA_advance_loc2 = 0x03,
745 +    DW_CFA_advance_loc4 = 0x04,
746 +    DW_CFA_offset_extended = 0x05,
747 +    DW_CFA_restore_extended = 0x06,
748 +    DW_CFA_undefined = 0x07,
749 +    DW_CFA_same_value = 0x08,
750 +    DW_CFA_register = 0x09,
751 +    DW_CFA_remember_state = 0x0a,
752 +    DW_CFA_restore_state = 0x0b,
753 +    DW_CFA_def_cfa = 0x0c,
754 +    DW_CFA_def_cfa_register = 0x0d,
755 +    DW_CFA_def_cfa_offset = 0x0e,
756 +    DW_CFA_def_cfa_expression = 0x0f,
757 +    DW_CFA_expression = 0x10,
758 +    /* Dwarf 2.1 */
759 +    DW_CFA_offset_extended_sf = 0x11,
760 +    DW_CFA_def_cfa_sf = 0x12,
761 +    DW_CFA_def_cfa_offset_sf = 0x13,
762 +
763 +    /* SGI/MIPS specific */
764 +    DW_CFA_MIPS_advance_loc8 = 0x1d,
765 +    
766 +    /* GNU extensions */
767 +    DW_CFA_GNU_window_save = 0x2d,
768 +    DW_CFA_GNU_args_size = 0x2e,
769 +    DW_CFA_GNU_negative_offset_extended = 0x2f
770 +  };
771 +
772 +#define DW_CIE_ID        0xffffffff
773 +#define DW_CIE_VERSION   1
774 +
775 +#define DW_CFA_extended   0
776 +#define DW_CFA_low_user   0x1c
777 +#define DW_CFA_high_user  0x3f
778 +
779 +#define DW_CHILDREN_no              0x00
780 +#define DW_CHILDREN_yes                     0x01
781 +
782 +#define DW_ADDR_none           0
783 +
784 +/* Source language names and codes.  */
785 +
786 +enum dwarf_source_language
787 +  {
788 +    DW_LANG_C89 = 0x0001,
789 +    DW_LANG_C = 0x0002,
790 +    DW_LANG_Ada83 = 0x0003,
791 +    DW_LANG_C_plus_plus = 0x0004,
792 +    DW_LANG_Cobol74 = 0x0005,
793 +    DW_LANG_Cobol85 = 0x0006,
794 +    DW_LANG_Fortran77 = 0x0007,
795 +    DW_LANG_Fortran90 = 0x0008,
796 +    DW_LANG_Pascal83 = 0x0009,
797 +    DW_LANG_Modula2 = 0x000a,
798 +    DW_LANG_Java = 0x000b,
799 +    DW_LANG_Mips_Assembler = 0x8001
800 +  };
801 +
802 +
803 +#define DW_LANG_lo_user 0x8000 /* implementation-defined range start */
804 +#define DW_LANG_hi_user 0xffff /* implementation-defined range start */
805 +
806 +/* Names and codes for macro information.  */
807 +
808 +enum dwarf_macinfo_record_type
809 +  {
810 +    DW_MACINFO_define = 1,
811 +    DW_MACINFO_undef = 2,
812 +    DW_MACINFO_start_file = 3,
813 +    DW_MACINFO_end_file = 4,
814 +    DW_MACINFO_vendor_ext = 255
815 +  };
816 +
817 +\f
818 +/* @@@ For use with GNU frame unwind information.  */
819 +
820 +#define DW_EH_PE_absptr                0x00
821 +#define DW_EH_PE_omit          0xff
822 +
823 +#define DW_EH_PE_uleb128       0x01
824 +#define DW_EH_PE_udata2                0x02
825 +#define DW_EH_PE_udata4                0x03
826 +#define DW_EH_PE_udata8                0x04
827 +#define DW_EH_PE_sleb128       0x09
828 +#define DW_EH_PE_sdata2                0x0A
829 +#define DW_EH_PE_sdata4                0x0B
830 +#define DW_EH_PE_sdata8                0x0C
831 +#define DW_EH_PE_signed                0x08
832 +
833 +#define DW_EH_PE_pcrel         0x10
834 +#define DW_EH_PE_textrel       0x20
835 +#define DW_EH_PE_datarel       0x30
836 +#define DW_EH_PE_funcrel       0x40
837 +#define DW_EH_PE_aligned       0x50
838 +
839 +#define DW_EH_PE_indirect      0x80
840 --- libc/sysdeps/generic/gccframe.h.jj  Thu Aug 23 18:49:29 2001
841 +++ libc/sysdeps/generic/gccframe.h     Tue Oct  2 17:30:51 2001
842 @@ -1,5 +1,5 @@
843  /* Definition of object in frame unwind info.  Generic version.
844 -   Copyright (C) 2000 Free Software Foundation, Inc.
845 +   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
846     This file is part of the GNU C Library.
847  
848     The GNU C Library is free software; you can redistribute it and/or
849 @@ -17,14 +17,34 @@
850     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
851     02111-1307 USA.  */
852  
853 -/* This must match what's in frame.h in gcc. */
854 +#include <sys/types.h>
855 +
856 +struct dwarf_fde;
857 +struct fde_vector;
858  
859  struct object
860  {
861    void *pc_begin;
862 -  void *pc_end;
863 -  void *fde_begin;
864 -  void *fde_array;
865 -  __SIZE_TYPE__ count;
866 +  void *tbase;
867 +  void *dbase;
868 +  union {
869 +    struct dwarf_fde *single;
870 +    struct dwarf_fde **array;
871 +    struct fde_vector *sort;
872 +  } u;
873 +
874 +  union {
875 +    struct {
876 +      unsigned long sorted : 1;
877 +      unsigned long from_array : 1;
878 +      unsigned long mixed_encoding : 1;
879 +      unsigned long encoding : 8;
880 +      /* ??? Wish there was an easy way to detect a 64-bit host here;
881 +        we've got 32 bits left to play with... */
882 +      unsigned long count : 21;
883 +    } b;
884 +    size_t i;
885 +  } s;
886 +
887    struct object *next;
888  };
889 --- libc/sysdeps/generic/unwind-dw2-fde.c.jj    Tue Oct  2 17:30:51 2001
890 +++ libc/sysdeps/generic/unwind-dw2-fde.c       Tue Oct  2 17:30:51 2001
891 @@ -0,0 +1,1013 @@
892 +/* Subroutines needed for unwinding stack frames for exception handling.  */
893 +/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
894 +   Contributed by Jason Merrill <jason@cygnus.com>.
895 +
896 +This file is part of GNU CC.
897 +
898 +GNU CC is free software; you can redistribute it and/or modify
899 +it under the terms of the GNU General Public License as published by
900 +the Free Software Foundation; either version 2, or (at your option)
901 +any later version.
902 +
903 +In addition to the permissions in the GNU General Public License, the
904 +Free Software Foundation gives you unlimited permission to link the
905 +compiled version of this file into combinations with other programs,
906 +and to distribute those combinations without any restriction coming
907 +from the use of this file.  (The General Public License restrictions
908 +do apply in other respects; for example, they cover modification of
909 +the file, and distribution when not linked into a combine
910 +executable.)
911 +
912 +GNU CC is distributed in the hope that it will be useful,
913 +but WITHOUT ANY WARRANTY; without even the implied warranty of
914 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
915 +GNU General Public License for more details.
916 +
917 +You should have received a copy of the GNU General Public License
918 +along with GNU CC; see the file COPYING.  If not, write to
919 +the Free Software Foundation, 59 Temple Place - Suite 330,
920 +Boston, MA 02111-1307, USA.  */
921 +
922 +#ifdef _LIBC
923 +#include <stdlib.h>
924 +#include <string.h>
925 +#include <bits/libc-lock.h>
926 +#include <dwarf2.h>
927 +#include <unwind.h>
928 +#define NO_BASE_OF_ENCODED_VALUE
929 +#include <unwind-pe.h>
930 +#include <unwind-dw2-fde.h>
931 +#else
932 +#include "tconfig.h"
933 +#include "tsystem.h"
934 +#include "dwarf2.h"
935 +#include "unwind.h"
936 +#define NO_BASE_OF_ENCODED_VALUE
937 +#include "unwind-pe.h"
938 +#include "unwind-dw2-fde.h"
939 +#include "gthr.h"
940 +#endif
941 +
942 +/* The unseen_objects list contains objects that have been registered
943 +   but not yet categorized in any way.  The seen_objects list has had
944 +   it's pc_begin and count fields initialized at minimum, and is sorted
945 +   by decreasing value of pc_begin.  */
946 +static struct object *unseen_objects;
947 +static struct object *seen_objects;
948 +
949 +#ifdef _LIBC
950 +
951 +__libc_lock_define_initialized_recursive (static, object_mutex)
952 +#define init_object_mutex_once()
953 +#define __gthread_mutex_lock(m) __libc_lock_lock_recursive (*(m))
954 +#define __gthread_mutex_unlock(m) __libc_lock_unlock_recursive (*(m))
955 +
956 +#else
957 +
958 +#ifdef __GTHREAD_MUTEX_INIT
959 +static __gthread_mutex_t object_mutex = __GTHREAD_MUTEX_INIT;
960 +#else
961 +static __gthread_mutex_t object_mutex;
962 +#endif
963 +
964 +#ifdef __GTHREAD_MUTEX_INIT_FUNCTION
965 +static void 
966 +init_object_mutex (void)
967 +{
968 +  __GTHREAD_MUTEX_INIT_FUNCTION (&object_mutex);
969 +}
970 +
971 +static void
972 +init_object_mutex_once (void)
973 +{
974 +  static __gthread_once_t once = __GTHREAD_ONCE_INIT;
975 +  __gthread_once (&once, init_object_mutex);
976 +}
977 +#else
978 +#define init_object_mutex_once()
979 +#endif
980 +
981 +#endif /* _LIBC */
982 +
983 +/* Called from crtbegin.o to register the unwind info for an object.  */
984 +
985 +void
986 +__register_frame_info_bases (void *begin, struct object *ob,
987 +                            void *tbase, void *dbase)
988 +{
989 +  ob->pc_begin = (void *)-1;
990 +  ob->tbase = tbase;
991 +  ob->dbase = dbase;
992 +  ob->u.single = begin;
993 +  ob->s.i = 0;
994 +  ob->s.b.encoding = DW_EH_PE_omit;
995 +
996 +  init_object_mutex_once ();
997 +  __gthread_mutex_lock (&object_mutex);
998 +
999 +  ob->next = unseen_objects;
1000 +  unseen_objects = ob;
1001 +
1002 +  __gthread_mutex_unlock (&object_mutex);
1003 +}
1004 +
1005 +void
1006 +__register_frame_info (void *begin, struct object *ob)
1007 +{
1008 +  __register_frame_info_bases (begin, ob, 0, 0);
1009 +}
1010 +
1011 +void
1012 +__register_frame (void *begin)
1013 +{
1014 +  struct object *ob = (struct object *) malloc (sizeof (struct object));
1015 +  __register_frame_info (begin, ob);                       
1016 +}
1017 +
1018 +/* Similar, but BEGIN is actually a pointer to a table of unwind entries
1019 +   for different translation units.  Called from the file generated by
1020 +   collect2.  */
1021 +
1022 +void
1023 +__register_frame_info_table_bases (void *begin, struct object *ob,
1024 +                                  void *tbase, void *dbase)
1025 +{
1026 +  ob->pc_begin = (void *)-1;
1027 +  ob->tbase = tbase;
1028 +  ob->dbase = dbase;
1029 +  ob->u.array = begin;
1030 +  ob->s.i = 0;
1031 +  ob->s.b.from_array = 1;
1032 +  ob->s.b.encoding = DW_EH_PE_omit;
1033 +
1034 +  init_object_mutex_once ();
1035 +  __gthread_mutex_lock (&object_mutex);
1036 +
1037 +  ob->next = unseen_objects;
1038 +  unseen_objects = ob;
1039 +
1040 +  __gthread_mutex_unlock (&object_mutex);
1041 +}
1042 +
1043 +void
1044 +__register_frame_info_table (void *begin, struct object *ob)
1045 +{
1046 +  __register_frame_info_table_bases (begin, ob, 0, 0);
1047 +}
1048 +
1049 +void
1050 +__register_frame_table (void *begin)
1051 +{
1052 +  struct object *ob = (struct object *) malloc (sizeof (struct object));
1053 +  __register_frame_info_table (begin, ob);
1054 +}
1055 +
1056 +/* Called from crtbegin.o to deregister the unwind info for an object.  */
1057 +/* ??? Glibc has for a while now exported __register_frame_info and
1058 +   __deregister_frame_info.  If we call __register_frame_info_bases
1059 +   from crtbegin (wherein it is declared weak), and this object does
1060 +   not get pulled from libgcc.a for other reasons, then the
1061 +   invocation of __deregister_frame_info will be resolved from glibc.
1062 +   Since the registration did not happen there, we'll abort.
1063 +
1064 +   Therefore, declare a new deregistration entry point that does the
1065 +   exact same thing, but will resolve to the same library as 
1066 +   implements __register_frame_info_bases.  */
1067 +
1068 +void *
1069 +__deregister_frame_info_bases (void *begin)
1070 +{
1071 +  struct object **p;
1072 +  struct object *ob = 0;
1073 +
1074 +  init_object_mutex_once ();
1075 +  __gthread_mutex_lock (&object_mutex);
1076 +
1077 +  for (p = &unseen_objects; *p ; p = &(*p)->next)
1078 +    if ((*p)->u.single == begin)
1079 +      {
1080 +       ob = *p;
1081 +       *p = ob->next;
1082 +       goto out;
1083 +      }
1084 +
1085 +  for (p = &seen_objects; *p ; p = &(*p)->next)
1086 +    if ((*p)->s.b.sorted)
1087 +      {
1088 +       if ((*p)->u.sort->orig_data == begin)
1089 +         {
1090 +           ob = *p;
1091 +           *p = ob->next;
1092 +           free (ob->u.sort);
1093 +           goto out;
1094 +         }
1095 +      }
1096 +    else
1097 +      {
1098 +       if ((*p)->u.single == begin)
1099 +         {
1100 +           ob = *p;
1101 +           *p = ob->next;
1102 +           goto out;
1103 +         }
1104 +      }
1105 +
1106 +  __gthread_mutex_unlock (&object_mutex);
1107 +  abort ();
1108 +
1109 + out:
1110 +  __gthread_mutex_unlock (&object_mutex);
1111 +  return (void *) ob;
1112 +}
1113 +
1114 +void *
1115 +__deregister_frame_info (void *begin)
1116 +{
1117 +  return __deregister_frame_info_bases (begin);
1118 +}
1119 +
1120 +void
1121 +__deregister_frame (void *begin)
1122 +{
1123 +  free (__deregister_frame_info (begin));
1124 +}
1125 +
1126 +\f
1127 +/* Like base_of_encoded_value, but take the base from a struct object
1128 +   instead of an _Unwind_Context.  */
1129 +
1130 +static _Unwind_Ptr
1131 +base_from_object (unsigned char encoding, struct object *ob)
1132 +{
1133 +  if (encoding == DW_EH_PE_omit)
1134 +    return 0;
1135 +
1136 +  switch (encoding & 0x70)
1137 +    {
1138 +    case DW_EH_PE_absptr:
1139 +    case DW_EH_PE_pcrel:
1140 +    case DW_EH_PE_aligned:
1141 +      return 0;
1142 +
1143 +    case DW_EH_PE_textrel:
1144 +      return (_Unwind_Ptr) ob->tbase;
1145 +    case DW_EH_PE_datarel:
1146 +      return (_Unwind_Ptr) ob->dbase;
1147 +    }
1148 +  abort ();
1149 +}
1150 +
1151 +/* Return the FDE pointer encoding from the CIE.  */
1152 +/* ??? This is a subset of extract_cie_info from unwind-dw2.c.  */
1153 +
1154 +static int
1155 +get_cie_encoding (struct dwarf_cie *cie)
1156 +{
1157 +  const unsigned char *aug, *p;
1158 +  _Unwind_Ptr dummy;
1159 +
1160 +  aug = cie->augmentation;
1161 +  if (aug[0] != 'z')
1162 +    return DW_EH_PE_absptr;
1163 +
1164 +  p = aug + strlen (aug) + 1;          /* Skip the augmentation string.  */
1165 +  p = read_uleb128 (p, &dummy);                /* Skip code alignment.  */
1166 +  p = read_sleb128 (p, &dummy);                /* Skip data alignment.  */
1167 +  p++;                                 /* Skip return address column.  */
1168 +
1169 +  aug++;                               /* Skip 'z' */
1170 +  p = read_uleb128 (p, &dummy);                /* Skip augmentation length.  */
1171 +  while (1)
1172 +    {
1173 +      /* This is what we're looking for.  */
1174 +      if (*aug == 'R')
1175 +       return *p;
1176 +      /* Personality encoding and pointer.  */
1177 +      else if (*aug == 'P')
1178 +       {
1179 +         /* ??? Avoid dereferencing indirect pointers, since we're
1180 +            faking the base address.  Gotta keep DW_EH_PE_aligned
1181 +            intact, however.  */
1182 +         p = read_encoded_value_with_base (*p & 0x7F, 0, p + 1, &dummy);
1183 +       }
1184 +      /* LSDA encoding.  */
1185 +      else if (*aug == 'L')
1186 +       p++;
1187 +      /* Otherwise end of string, or unknown augmentation.  */
1188 +      else
1189 +       return DW_EH_PE_absptr;
1190 +      aug++;
1191 +    }
1192 +}
1193 +
1194 +static inline int
1195 +get_fde_encoding (struct dwarf_fde *f)
1196 +{
1197 +  return get_cie_encoding (get_cie (f));
1198 +}
1199 +
1200 +\f
1201 +/* Sorting an array of FDEs by address.
1202 +   (Ideally we would have the linker sort the FDEs so we don't have to do
1203 +   it at run time. But the linkers are not yet prepared for this.)  */
1204 +
1205 +/* Comparison routines.  Three variants of increasing complexity.  */
1206 +
1207 +static saddr
1208 +fde_unencoded_compare (struct object *ob __attribute__((unused)),
1209 +                      fde *x, fde *y)
1210 +{
1211 +  return *(saddr *)x->pc_begin - *(saddr *)y->pc_begin;
1212 +}
1213 +
1214 +static saddr
1215 +fde_single_encoding_compare (struct object *ob, fde *x, fde *y)
1216 +{
1217 +  _Unwind_Ptr base, x_ptr, y_ptr;
1218 +
1219 +  base = base_from_object (ob->s.b.encoding, ob);
1220 +  read_encoded_value_with_base (ob->s.b.encoding, base, x->pc_begin, &x_ptr);
1221 +  read_encoded_value_with_base (ob->s.b.encoding, base, y->pc_begin, &y_ptr);
1222 +
1223 +  return x_ptr - y_ptr;
1224 +}
1225 +
1226 +static saddr
1227 +fde_mixed_encoding_compare (struct object *ob, fde *x, fde *y)
1228 +{
1229 +  int x_encoding, y_encoding;
1230 +  _Unwind_Ptr x_ptr, y_ptr;
1231 +
1232 +  x_encoding = get_fde_encoding (x);
1233 +  read_encoded_value_with_base (x_encoding, base_from_object (x_encoding, ob),
1234 +                               x->pc_begin, &x_ptr);
1235 +
1236 +  y_encoding = get_fde_encoding (y);
1237 +  read_encoded_value_with_base (y_encoding, base_from_object (y_encoding, ob),
1238 +                               y->pc_begin, &y_ptr);
1239 +
1240 +  return x_ptr - y_ptr;
1241 +}
1242 +
1243 +typedef saddr (*fde_compare_t) (struct object *, fde *, fde *);
1244 +
1245 +
1246 +/* This is a special mix of insertion sort and heap sort, optimized for
1247 +   the data sets that actually occur. They look like
1248 +   101 102 103 127 128 105 108 110 190 111 115 119 125 160 126 129 130.
1249 +   I.e. a linearly increasing sequence (coming from functions in the text
1250 +   section), with additionally a few unordered elements (coming from functions
1251 +   in gnu_linkonce sections) whose values are higher than the values in the
1252 +   surrounding linear sequence (but not necessarily higher than the values
1253 +   at the end of the linear sequence!).
1254 +   The worst-case total run time is O(N) + O(n log (n)), where N is the
1255 +   total number of FDEs and n is the number of erratic ones.  */
1256 +
1257 +struct fde_accumulator
1258 +{
1259 +  struct fde_vector *linear;
1260 +  struct fde_vector *erratic;
1261 +};
1262 +
1263 +static inline int
1264 +start_fde_sort (struct fde_accumulator *accu, size_t count)
1265 +{
1266 +  size_t size;
1267 +  if (! count)
1268 +    return 0;
1269 +
1270 +  size = sizeof (struct fde_vector) + sizeof (fde *) * count;
1271 +  if ((accu->linear = (struct fde_vector *) malloc (size)))
1272 +    {
1273 +      accu->linear->count = 0;
1274 +      if ((accu->erratic = (struct fde_vector *) malloc (size)))
1275 +       accu->erratic->count = 0;
1276 +      return 1;
1277 +    }
1278 +  else
1279 +    return 0;  
1280 +}
1281 +
1282 +static inline void
1283 +fde_insert (struct fde_accumulator *accu, fde *this_fde)
1284 +{
1285 +  if (accu->linear)
1286 +    accu->linear->array[accu->linear->count++] = this_fde;
1287 +}
1288 +
1289 +/* Split LINEAR into a linear sequence with low values and an erratic
1290 +   sequence with high values, put the linear one (of longest possible
1291 +   length) into LINEAR and the erratic one into ERRATIC. This is O(N).
1292 +   
1293 +   Because the longest linear sequence we are trying to locate within the
1294 +   incoming LINEAR array can be interspersed with (high valued) erratic
1295 +   entries.  We construct a chain indicating the sequenced entries.
1296 +   To avoid having to allocate this chain, we overlay it onto the space of
1297 +   the ERRATIC array during construction.  A final pass iterates over the
1298 +   chain to determine what should be placed in the ERRATIC array, and
1299 +   what is the linear sequence.  This overlay is safe from aliasing.  */
1300 +
1301 +static inline void
1302 +fde_split (struct object *ob, fde_compare_t fde_compare,
1303 +          struct fde_vector *linear, struct fde_vector *erratic)
1304 +{
1305 +  static fde *marker;
1306 +  size_t count = linear->count;
1307 +  fde **chain_end = &marker;
1308 +  size_t i, j, k;
1309 +
1310 +  /* This should optimize out, but it is wise to make sure this assumption
1311 +     is correct. Should these have different sizes, we cannot cast between
1312 +     them and the overlaying onto ERRATIC will not work.  */
1313 +  if (sizeof (fde *) != sizeof (fde **))
1314 +    abort ();
1315 +  
1316 +  for (i = 0; i < count; i++)
1317 +    {
1318 +      fde **probe;
1319 +      
1320 +      for (probe = chain_end;
1321 +           probe != &marker && fde_compare (ob, linear->array[i], *probe) < 0;
1322 +           probe = chain_end)
1323 +        {
1324 +          chain_end = (fde **)erratic->array[probe - linear->array];
1325 +          erratic->array[probe - linear->array] = NULL;
1326 +        }
1327 +      erratic->array[i] = (fde *)chain_end;
1328 +      chain_end = &linear->array[i];
1329 +    }
1330 +
1331 +  /* Each entry in LINEAR which is part of the linear sequence we have
1332 +     discovered will correspond to a non-NULL entry in the chain we built in
1333 +     the ERRATIC array.  */
1334 +  for (i = j = k = 0; i < count; i++)
1335 +    if (erratic->array[i])
1336 +      linear->array[j++] = linear->array[i];
1337 +    else
1338 +      erratic->array[k++] = linear->array[i];
1339 +  linear->count = j;
1340 +  erratic->count = k;
1341 +}
1342 +
1343 +/* This is O(n log(n)).  BSD/OS defines heapsort in stdlib.h, so we must
1344 +   use a name that does not conflict.  */
1345 +
1346 +static void
1347 +frame_heapsort (struct object *ob, fde_compare_t fde_compare,
1348 +               struct fde_vector *erratic)
1349 +{
1350 +  /* For a description of this algorithm, see:
1351 +     Samuel P. Harbison, Guy L. Steele Jr.: C, a reference manual, 2nd ed.,
1352 +     p. 60-61. */
1353 +  fde ** a = erratic->array;
1354 +  /* A portion of the array is called a "heap" if for all i>=0:
1355 +     If i and 2i+1 are valid indices, then a[i] >= a[2i+1].
1356 +     If i and 2i+2 are valid indices, then a[i] >= a[2i+2]. */
1357 +#define SWAP(x,y) do { fde * tmp = x; x = y; y = tmp; } while (0)
1358 +  size_t n = erratic->count;
1359 +  size_t m = n;
1360 +  size_t i;
1361 +
1362 +  while (m > 0)
1363 +    {
1364 +      /* Invariant: a[m..n-1] is a heap. */
1365 +      m--;
1366 +      for (i = m; 2*i+1 < n; )
1367 +        {
1368 +          if (2*i+2 < n
1369 +              && fde_compare (ob, a[2*i+2], a[2*i+1]) > 0
1370 +              && fde_compare (ob, a[2*i+2], a[i]) > 0)
1371 +            {
1372 +              SWAP (a[i], a[2*i+2]);
1373 +              i = 2*i+2;
1374 +            }
1375 +          else if (fde_compare (ob, a[2*i+1], a[i]) > 0)
1376 +            {
1377 +              SWAP (a[i], a[2*i+1]);
1378 +              i = 2*i+1;
1379 +            }
1380 +          else
1381 +            break;
1382 +        }
1383 +    }
1384 +  while (n > 1)
1385 +    {
1386 +      /* Invariant: a[0..n-1] is a heap. */
1387 +      n--;
1388 +      SWAP (a[0], a[n]);
1389 +      for (i = 0; 2*i+1 < n; )
1390 +        {
1391 +          if (2*i+2 < n
1392 +              && fde_compare (ob, a[2*i+2], a[2*i+1]) > 0
1393 +              && fde_compare (ob, a[2*i+2], a[i]) > 0)
1394 +            {
1395 +              SWAP (a[i], a[2*i+2]);
1396 +              i = 2*i+2;
1397 +            }
1398 +          else if (fde_compare (ob, a[2*i+1], a[i]) > 0)
1399 +            {
1400 +              SWAP (a[i], a[2*i+1]);
1401 +              i = 2*i+1;
1402 +            }
1403 +          else
1404 +            break;
1405 +        }
1406 +    }
1407 +#undef SWAP
1408 +}
1409 +
1410 +/* Merge V1 and V2, both sorted, and put the result into V1. */
1411 +static inline void
1412 +fde_merge (struct object *ob, fde_compare_t fde_compare,
1413 +          struct fde_vector *v1, struct fde_vector *v2)
1414 +{
1415 +  size_t i1, i2;
1416 +  fde * fde2;
1417 +
1418 +  i2 = v2->count;
1419 +  if (i2 > 0)
1420 +    {
1421 +      i1 = v1->count;
1422 +      do {
1423 +        i2--;
1424 +        fde2 = v2->array[i2];
1425 +        while (i1 > 0 && fde_compare (ob, v1->array[i1-1], fde2) > 0)
1426 +          {
1427 +            v1->array[i1+i2] = v1->array[i1-1];
1428 +            i1--;
1429 +          }
1430 +        v1->array[i1+i2] = fde2;
1431 +      } while (i2 > 0);
1432 +      v1->count += v2->count;
1433 +    }
1434 +}
1435 +
1436 +static inline void
1437 +end_fde_sort (struct object *ob, struct fde_accumulator *accu, size_t count)
1438 +{
1439 +  fde_compare_t fde_compare;
1440 +
1441 +  if (accu->linear && accu->linear->count != count)
1442 +    abort ();
1443 +
1444 +  if (ob->s.b.mixed_encoding)
1445 +    fde_compare = fde_mixed_encoding_compare;
1446 +  else if (ob->s.b.encoding == DW_EH_PE_absptr)
1447 +    fde_compare = fde_unencoded_compare;
1448 +  else
1449 +    fde_compare = fde_single_encoding_compare;
1450 +
1451 +  if (accu->erratic)
1452 +    {
1453 +      fde_split (ob, fde_compare, accu->linear, accu->erratic);
1454 +      if (accu->linear->count + accu->erratic->count != count)
1455 +       abort ();
1456 +      frame_heapsort (ob, fde_compare, accu->erratic);
1457 +      fde_merge (ob, fde_compare, accu->linear, accu->erratic);
1458 +      free (accu->erratic);
1459 +    }
1460 +  else
1461 +    {
1462 +      /* We've not managed to malloc an erratic array,
1463 +        so heap sort in the linear one.  */
1464 +      frame_heapsort (ob, fde_compare, accu->linear);
1465 +    }
1466 +}
1467 +
1468 +\f
1469 +/* Update encoding, mixed_encoding, and pc_begin for OB for the 
1470 +   fde array beginning at THIS_FDE.  Return the number of fdes
1471 +   encountered along the way.  */
1472 +
1473 +static size_t
1474 +classify_object_over_fdes (struct object *ob, fde *this_fde)
1475 +{
1476 +  struct dwarf_cie *last_cie = 0;
1477 +  size_t count = 0;
1478 +  int encoding = DW_EH_PE_absptr;
1479 +  _Unwind_Ptr base = 0;
1480 +
1481 +  for (; this_fde->length != 0; this_fde = next_fde (this_fde))
1482 +    {
1483 +      struct dwarf_cie *this_cie;
1484 +      _Unwind_Ptr mask, pc_begin;
1485 +
1486 +      /* Skip CIEs.  */
1487 +      if (this_fde->CIE_delta == 0)
1488 +       continue;
1489 +
1490 +      /* Determine the encoding for this FDE.  Note mixed encoded
1491 +        objects for later.  */
1492 +      this_cie = get_cie (this_fde);
1493 +      if (this_cie != last_cie)
1494 +       {
1495 +         last_cie = this_cie;
1496 +         encoding = get_cie_encoding (this_cie);
1497 +         base = base_from_object (encoding, ob);
1498 +         if (ob->s.b.encoding == DW_EH_PE_omit)
1499 +           ob->s.b.encoding = encoding;
1500 +         else if (ob->s.b.encoding != encoding)
1501 +           ob->s.b.mixed_encoding = 1;
1502 +       }
1503 +
1504 +      read_encoded_value_with_base (encoding, base, this_fde->pc_begin,
1505 +                                   &pc_begin);
1506 +
1507 +      /* Take care to ignore link-once functions that were removed.
1508 +        In these cases, the function address will be NULL, but if
1509 +        the encoding is smaller than a pointer a true NULL may not
1510 +        be representable.  Assume 0 in the representable bits is NULL.  */
1511 +      mask = size_of_encoded_value (encoding);
1512 +      if (mask < sizeof (void *))
1513 +       mask = (1L << (mask << 3)) - 1;
1514 +      else
1515 +       mask = -1;
1516 +
1517 +      if ((pc_begin & mask) == 0)
1518 +       continue;
1519 +
1520 +      count += 1;
1521 +      if ((void *)pc_begin < ob->pc_begin)
1522 +       ob->pc_begin = (void *)pc_begin;
1523 +    }
1524 +
1525 +  return count;
1526 +}
1527 +
1528 +static void
1529 +add_fdes (struct object *ob, struct fde_accumulator *accu, fde *this_fde)
1530 +{
1531 +  struct dwarf_cie *last_cie = 0;
1532 +  int encoding = ob->s.b.encoding;
1533 +  _Unwind_Ptr base = base_from_object (ob->s.b.encoding, ob);
1534 +
1535 +  for (; this_fde->length != 0; this_fde = next_fde (this_fde))
1536 +    {
1537 +      struct dwarf_cie *this_cie;
1538 +
1539 +      /* Skip CIEs.  */
1540 +      if (this_fde->CIE_delta == 0)
1541 +       continue;
1542 +
1543 +      if (ob->s.b.mixed_encoding)
1544 +       {
1545 +         /* Determine the encoding for this FDE.  Note mixed encoded
1546 +            objects for later.  */
1547 +         this_cie = get_cie (this_fde);
1548 +         if (this_cie != last_cie)
1549 +           {
1550 +             last_cie = this_cie;
1551 +             encoding = get_cie_encoding (this_cie);
1552 +             base = base_from_object (encoding, ob);
1553 +           }
1554 +       }
1555 +
1556 +      if (encoding == DW_EH_PE_absptr)
1557 +       {
1558 +         if (*(_Unwind_Ptr *)this_fde->pc_begin == 0)
1559 +           continue;
1560 +       }
1561 +      else
1562 +       {
1563 +         _Unwind_Ptr pc_begin, mask;
1564 +
1565 +         read_encoded_value_with_base (encoding, base, this_fde->pc_begin,
1566 +                                       &pc_begin);
1567 +
1568 +         /* Take care to ignore link-once functions that were removed.
1569 +            In these cases, the function address will be NULL, but if
1570 +            the encoding is smaller than a pointer a true NULL may not
1571 +            be representable.  Assume 0 in the representable bits is NULL.  */
1572 +         mask = size_of_encoded_value (encoding);
1573 +         if (mask < sizeof (void *))
1574 +           mask = (1L << (mask << 3)) - 1;
1575 +         else
1576 +           mask = -1;
1577 +
1578 +         if ((pc_begin & mask) == 0)
1579 +           continue;
1580 +       }
1581 +
1582 +      fde_insert (accu, this_fde);
1583 +    }
1584 +}
1585 +
1586 +/* Set up a sorted array of pointers to FDEs for a loaded object.  We
1587 +   count up the entries before allocating the array because it's likely to
1588 +   be faster.  We can be called multiple times, should we have failed to
1589 +   allocate a sorted fde array on a previous occasion.  */
1590 +
1591 +static inline void
1592 +init_object (struct object* ob)
1593 +{
1594 +  struct fde_accumulator accu;
1595 +  size_t count;
1596 +
1597 +  count = ob->s.b.count;
1598 +  if (count == 0)
1599 +    {
1600 +      if (ob->s.b.from_array)
1601 +       {
1602 +         fde **p = ob->u.array;
1603 +         for (count = 0; *p; ++p)
1604 +           count += classify_object_over_fdes (ob, *p);
1605 +       }
1606 +      else
1607 +       count = classify_object_over_fdes (ob, ob->u.single);
1608 +
1609 +      /* The count field we have in the main struct object is somewhat
1610 +        limited, but should suffice for virtually all cases.  If the
1611 +        counted value doesn't fit, re-write a zero.  The worst that
1612 +        happens is that we re-count next time -- admittedly non-trivial
1613 +        in that this implies some 2M fdes, but at least we function.  */
1614 +      ob->s.b.count = count;
1615 +      if (ob->s.b.count != count)
1616 +       ob->s.b.count = 0;
1617 +    }
1618 +
1619 +  if (!start_fde_sort (&accu, count))
1620 +    return;
1621 +
1622 +  if (ob->s.b.from_array)
1623 +    {
1624 +      fde **p;
1625 +      for (p = ob->u.array; *p; ++p)
1626 +        add_fdes (ob, &accu, *p);
1627 +    }
1628 +  else
1629 +    add_fdes (ob, &accu, ob->u.single);
1630 +
1631 +  end_fde_sort (ob, &accu, count);
1632 +
1633 +  /* Save the original fde pointer, since this is the key by which the
1634 +     DSO will deregister the object.  */
1635 +  accu.linear->orig_data = ob->u.single;
1636 +  ob->u.sort = accu.linear;
1637 +
1638 +  ob->s.b.sorted = 1;
1639 +}
1640 +
1641 +/* A linear search through a set of FDEs for the given PC.  This is
1642 +   used when there was insufficient memory to allocate and sort an
1643 +   array.  */
1644 +
1645 +static fde *
1646 +linear_search_fdes (struct object *ob, fde *this_fde, void *pc)
1647 +{
1648 +  struct dwarf_cie *last_cie = 0;
1649 +  int encoding = ob->s.b.encoding;
1650 +  _Unwind_Ptr base = base_from_object (ob->s.b.encoding, ob);
1651 +
1652 +  for (; this_fde->length != 0; this_fde = next_fde (this_fde))
1653 +    {
1654 +      struct dwarf_cie *this_cie;
1655 +      _Unwind_Ptr pc_begin, pc_range;
1656 +
1657 +      /* Skip CIEs.  */
1658 +      if (this_fde->CIE_delta == 0)
1659 +       continue;
1660 +
1661 +      if (ob->s.b.mixed_encoding)
1662 +       {
1663 +         /* Determine the encoding for this FDE.  Note mixed encoded
1664 +            objects for later.  */
1665 +         this_cie = get_cie (this_fde);
1666 +         if (this_cie != last_cie)
1667 +           {
1668 +             last_cie = this_cie;
1669 +             encoding = get_cie_encoding (this_cie);
1670 +             base = base_from_object (encoding, ob);
1671 +           }
1672 +       }
1673 +
1674 +      if (encoding == DW_EH_PE_absptr)
1675 +       {
1676 +         pc_begin = ((_Unwind_Ptr *)this_fde->pc_begin)[0];
1677 +         pc_range = ((_Unwind_Ptr *)this_fde->pc_begin)[1];
1678 +         if (pc_begin == 0)
1679 +           continue;
1680 +       }
1681 +      else
1682 +       {
1683 +         _Unwind_Ptr mask;
1684 +         const char *p;
1685 +
1686 +         p = read_encoded_value_with_base (encoding, base,
1687 +                                           this_fde->pc_begin, &pc_begin);
1688 +         read_encoded_value_with_base (encoding & 0x0F, 0, p, &pc_range);
1689 +
1690 +         /* Take care to ignore link-once functions that were removed.
1691 +            In these cases, the function address will be NULL, but if
1692 +            the encoding is smaller than a pointer a true NULL may not
1693 +            be representable.  Assume 0 in the representable bits is NULL.  */
1694 +         mask = size_of_encoded_value (encoding);
1695 +         if (mask < sizeof (void *))
1696 +           mask = (1L << (mask << 3)) - 1;
1697 +         else
1698 +           mask = -1;
1699 +
1700 +         if ((pc_begin & mask) == 0)
1701 +           continue;
1702 +       }
1703 +
1704 +      if ((_Unwind_Ptr)pc - pc_begin < pc_range)
1705 +        return this_fde;
1706 +    }
1707 +
1708 +  return NULL;
1709 +}
1710 +
1711 +/* Binary search for an FDE containing the given PC.  Here are three
1712 +   implementations of increasing complexity.  */
1713 +
1714 +static inline fde *
1715 +binary_search_unencoded_fdes (struct object *ob, void *pc)
1716 +{
1717 +  struct fde_vector *vec = ob->u.sort;
1718 +  size_t lo, hi;
1719 +      
1720 +  for (lo = 0, hi = vec->count; lo < hi; )
1721 +    {
1722 +      size_t i = (lo + hi) / 2;
1723 +      fde *f = vec->array[i];
1724 +      void *pc_begin;
1725 +      uaddr pc_range;
1726 +
1727 +      pc_begin = ((void **)f->pc_begin)[0];
1728 +      pc_range = ((uaddr *)f->pc_begin)[1];
1729 +
1730 +      if (pc < pc_begin)
1731 +       hi = i;
1732 +      else if (pc >= pc_begin + pc_range)
1733 +       lo = i + 1;
1734 +      else
1735 +       return f;
1736 +    }
1737 +
1738 +  return NULL;
1739 +}
1740 +
1741 +static inline fde *
1742 +binary_search_single_encoding_fdes (struct object *ob, void *pc)
1743 +{
1744 +  struct fde_vector *vec = ob->u.sort;
1745 +  int encoding = ob->s.b.encoding;
1746 +  _Unwind_Ptr base = base_from_object (encoding, ob);
1747 +  size_t lo, hi;
1748 +      
1749 +  for (lo = 0, hi = vec->count; lo < hi; )
1750 +    {
1751 +      size_t i = (lo + hi) / 2;
1752 +      fde *f = vec->array[i];
1753 +      _Unwind_Ptr pc_begin, pc_range;
1754 +      const char *p;
1755 +
1756 +      p = read_encoded_value_with_base (encoding, base, f->pc_begin,
1757 +                                       &pc_begin);
1758 +      read_encoded_value_with_base (encoding & 0x0F, 0, p, &pc_range);
1759 +
1760 +      if ((_Unwind_Ptr)pc < pc_begin)
1761 +       hi = i;
1762 +      else if ((_Unwind_Ptr)pc >= pc_begin + pc_range)
1763 +       lo = i + 1;
1764 +      else
1765 +       return f;
1766 +    }
1767 +
1768 +  return NULL;
1769 +}
1770 +
1771 +static inline fde *
1772 +binary_search_mixed_encoding_fdes (struct object *ob, void *pc)
1773 +{
1774 +  struct fde_vector *vec = ob->u.sort;
1775 +  size_t lo, hi;
1776 +      
1777 +  for (lo = 0, hi = vec->count; lo < hi; )
1778 +    {
1779 +      size_t i = (lo + hi) / 2;
1780 +      fde *f = vec->array[i];
1781 +      _Unwind_Ptr pc_begin, pc_range;
1782 +      const char *p;
1783 +      int encoding;
1784 +
1785 +      encoding = get_fde_encoding (f);
1786 +      p = read_encoded_value_with_base (encoding,
1787 +                                       base_from_object (encoding, ob),
1788 +                                       f->pc_begin, &pc_begin);
1789 +      read_encoded_value_with_base (encoding & 0x0F, 0, p, &pc_range);
1790 +
1791 +      if ((_Unwind_Ptr)pc < pc_begin)
1792 +       hi = i;
1793 +      else if ((_Unwind_Ptr)pc >= pc_begin + pc_range)
1794 +       lo = i + 1;
1795 +      else
1796 +       return f;
1797 +    }
1798 +
1799 +  return NULL;
1800 +}
1801 +
1802 +static fde *
1803 +search_object (struct object* ob, void *pc)
1804 +{
1805 +  /* If the data hasn't been sorted, try to do this now.  We may have
1806 +     more memory available than last time we tried.  */
1807 +  if (! ob->s.b.sorted)
1808 +    {
1809 +      init_object (ob);
1810 +
1811 +      /* Despite the above comment, the normal reason to get here is
1812 +        that we've not processed this object before.  A quick range
1813 +        check is in order.  */
1814 +      if (pc < ob->pc_begin)
1815 +       return NULL;
1816 +    }
1817 +
1818 +  if (ob->s.b.sorted)
1819 +    {
1820 +      if (ob->s.b.mixed_encoding)
1821 +       return binary_search_mixed_encoding_fdes (ob, pc);
1822 +      else if (ob->s.b.encoding == DW_EH_PE_absptr)
1823 +       return binary_search_unencoded_fdes (ob, pc);
1824 +      else
1825 +       return binary_search_single_encoding_fdes (ob, pc);
1826 +    }
1827 +  else
1828 +    {
1829 +      /* Long slow labourious linear search, cos we've no memory.  */
1830 +      if (ob->s.b.from_array)
1831 +        {
1832 +          fde **p;
1833 +         for (p = ob->u.array; *p ; p++)
1834 +           {
1835 +             fde *f = linear_search_fdes (ob, *p, pc);
1836 +              if (f)
1837 +               return f;
1838 +            }
1839 +         return NULL;
1840 +       }
1841 +      else
1842 +       return linear_search_fdes (ob, ob->u.single, pc);
1843 +    }
1844 +}
1845 +
1846 +fde *
1847 +_Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases)
1848 +{
1849 +  struct object *ob;
1850 +  fde *f = NULL;
1851 +
1852 +  init_object_mutex_once ();
1853 +  __gthread_mutex_lock (&object_mutex);
1854 +
1855 +  /* Linear search through the classified objects, to find the one
1856 +     containing the pc.  Note that pc_begin is sorted decending, and
1857 +     we expect objects to be non-overlapping.  */
1858 +  for (ob = seen_objects; ob; ob = ob->next)
1859 +    if (pc >= ob->pc_begin)
1860 +      {
1861 +       f = search_object (ob, pc);
1862 +       if (f)
1863 +         goto fini;
1864 +       break;
1865 +      }
1866 +
1867 +  /* Classify and search the objects we've not yet processed.  */
1868 +  while ((ob = unseen_objects))
1869 +    {
1870 +      struct object **p;
1871 +
1872 +      unseen_objects = ob->next;
1873 +      f = search_object (ob, pc);
1874 +
1875 +      /* Insert the object into the classified list.  */
1876 +      for (p = &seen_objects; *p ; p = &(*p)->next)
1877 +       if ((*p)->pc_begin < ob->pc_begin)
1878 +         break;
1879 +      ob->next = *p;
1880 +      *p = ob;
1881 +
1882 +      if (f)
1883 +       goto fini;
1884 +    }
1885 +
1886 + fini:
1887 +  __gthread_mutex_unlock (&object_mutex);
1888 +
1889 +  if (f)
1890 +    {
1891 +      int encoding;
1892 +
1893 +      bases->tbase = ob->tbase;
1894 +      bases->dbase = ob->dbase;
1895 +
1896 +      encoding = ob->s.b.encoding;
1897 +      if (ob->s.b.mixed_encoding)
1898 +       encoding = get_fde_encoding (f);
1899 +      read_encoded_value_with_base (encoding, base_from_object (encoding, ob),
1900 +                                   f->pc_begin, (_Unwind_Ptr *)&bases->func);
1901 +    }
1902 +
1903 +  return f;
1904 +}
1905 --- libc/sysdeps/generic/unwind-dw2-fde.h.jj    Tue Oct  2 17:30:51 2001
1906 +++ libc/sysdeps/generic/unwind-dw2-fde.h       Tue Oct  2 17:30:51 2001
1907 @@ -0,0 +1,165 @@
1908 +/* Subroutines needed for unwinding stack frames for exception handling.  */
1909 +/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
1910 +   Contributed by Jason Merrill <jason@cygnus.com>.
1911 +
1912 +This file is part of GNU CC.
1913 +
1914 +GNU CC is free software; you can redistribute it and/or modify
1915 +it under the terms of the GNU General Public License as published by
1916 +the Free Software Foundation; either version 2, or (at your option)
1917 +any later version.
1918 +
1919 +In addition to the permissions in the GNU General Public License, the
1920 +Free Software Foundation gives you unlimited permission to link the
1921 +compiled version of this file into combinations with other programs,
1922 +and to distribute those combinations without any restriction coming
1923 +from the use of this file.  (The General Public License restrictions
1924 +do apply in other respects; for example, they cover modification of
1925 +the file, and distribution when not linked into a combine
1926 +executable.)
1927 +
1928 +GNU CC is distributed in the hope that it will be useful,
1929 +but WITHOUT ANY WARRANTY; without even the implied warranty of
1930 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1931 +GNU General Public License for more details.
1932 +
1933 +You should have received a copy of the GNU General Public License
1934 +along with GNU CC; see the file COPYING.  If not, write to
1935 +the Free Software Foundation, 59 Temple Place - Suite 330,
1936 +Boston, MA 02111-1307, USA.  */
1937 +
1938 +
1939 +struct fde_vector
1940 +{
1941 +  void *orig_data;
1942 +  size_t count;
1943 +  struct dwarf_fde *array __flexarr;
1944 +};
1945 +
1946 +#ifdef _LIBC
1947 +#include <gccframe.h>
1948 +#else
1949 +struct object
1950 +{
1951 +  void *pc_begin;
1952 +  void *tbase;
1953 +  void *dbase;
1954 +  union {
1955 +    struct dwarf_fde *single;
1956 +    struct dwarf_fde **array;
1957 +    struct fde_vector *sort;
1958 +  } u;
1959 +
1960 +  union {
1961 +    struct {
1962 +      unsigned long sorted : 1;
1963 +      unsigned long from_array : 1;
1964 +      unsigned long mixed_encoding : 1;
1965 +      unsigned long encoding : 8;
1966 +      /* ??? Wish there was an easy way to detect a 64-bit host here;
1967 +        we've got 32 bits left to play with... */
1968 +      unsigned long count : 21;
1969 +    } b;
1970 +    size_t i;
1971 +  } s;
1972 +
1973 +  struct object *next;
1974 +};
1975 +#endif
1976 +
1977 +/* This is the original definition of struct object.  While the struct
1978 +   itself was opaque to users, they did know how large it was, and
1979 +   allocate one statically in crtbegin for each DSO.  Keep this around
1980 +   so that we're aware of the static size limitations for the new struct.  */
1981 +struct old_object
1982 +{
1983 +  void *pc_begin;
1984 +  void *pc_end;
1985 +  struct dwarf_fde *fde_begin;
1986 +  struct dwarf_fde **fde_array;
1987 +  size_t count;
1988 +  struct old_object *next;
1989 +};
1990 +
1991 +struct dwarf_eh_bases
1992 +{
1993 +  void *tbase;
1994 +  void *dbase;
1995 +  void *func;
1996 +};
1997 +
1998 +
1999 +extern void __register_frame_info_bases (void *, struct object *,
2000 +                                        void *, void *);
2001 +extern void __register_frame_info (void *, struct object *);
2002 +extern void __register_frame (void *);
2003 +extern void __register_frame_info_table_bases (void *, struct object *,
2004 +                                              void *, void *);
2005 +extern void __register_frame_info_table (void *, struct object *);
2006 +extern void __register_frame_table (void *);
2007 +extern void *__deregister_frame_info (void *);
2008 +extern void *__deregister_frame_info_bases (void *);
2009 +extern void __deregister_frame (void *);
2010 +
2011 +\f
2012 +typedef          int  sword __attribute__ ((mode (SI)));
2013 +typedef unsigned int  uword __attribute__ ((mode (SI)));
2014 +typedef unsigned int  uaddr __attribute__ ((mode (pointer)));
2015 +typedef          int  saddr __attribute__ ((mode (pointer)));
2016 +typedef unsigned char ubyte;
2017 +
2018 +/* Terminology:
2019 +   CIE - Common Information Element
2020 +   FDE - Frame Descriptor Element
2021 +
2022 +   There is one per function, and it describes where the function code
2023 +   is located, and what the register lifetimes and stack layout are
2024 +   within the function.
2025 +
2026 +   The data structures are defined in the DWARF specfication, although
2027 +   not in a very readable way (see LITERATURE).
2028 +
2029 +   Every time an exception is thrown, the code needs to locate the FDE
2030 +   for the current function, and starts to look for exception regions
2031 +   from that FDE. This works in a two-level search:
2032 +   a) in a linear search, find the shared image (i.e. DLL) containing
2033 +      the PC
2034 +   b) using the FDE table for that shared object, locate the FDE using
2035 +      binary search (which requires the sorting).  */   
2036 +
2037 +/* The first few fields of a CIE.  The CIE_id field is 0 for a CIE,
2038 +   to distinguish it from a valid FDE.  FDEs are aligned to an addressing
2039 +   unit boundary, but the fields within are unaligned.  */
2040 +struct dwarf_cie
2041 +{
2042 +  uword length;
2043 +  sword CIE_id;
2044 +  ubyte version;
2045 +  unsigned char augmentation __flexarr;
2046 +} __attribute__ ((packed, aligned (__alignof__ (void *))));
2047 +
2048 +/* The first few fields of an FDE.  */
2049 +struct dwarf_fde
2050 +{
2051 +  uword length;
2052 +  sword CIE_delta;
2053 +  unsigned char pc_begin __flexarr;
2054 +} __attribute__ ((packed, aligned (__alignof__ (void *))));
2055 +
2056 +typedef struct dwarf_fde fde;
2057 +
2058 +/* Locate the CIE for a given FDE.  */
2059 +
2060 +static inline struct dwarf_cie *
2061 +get_cie (struct dwarf_fde *f)
2062 +{
2063 +  return (void *)&f->CIE_delta - f->CIE_delta;
2064 +}
2065 +
2066 +static inline fde *
2067 +next_fde (fde *f)
2068 +{
2069 +  return (fde *)((char *)f + f->length + sizeof (f->length));
2070 +}
2071 +
2072 +extern fde * _Unwind_Find_FDE (void *, struct dwarf_eh_bases *);
2073 --- libc/sysdeps/generic/unwind-dw2.c.jj        Tue Oct  2 17:30:51 2001
2074 +++ libc/sysdeps/generic/unwind-dw2.c   Tue Oct  2 17:30:51 2001
2075 @@ -0,0 +1,1207 @@
2076 +/* DWARF2 exception handling and frame unwind runtime interface routines.
2077 +   Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
2078 +
2079 +   This file is part of GNU CC.
2080 +
2081 +   GNU CC is free software; you can redistribute it and/or modify
2082 +   it under the terms of the GNU General Public License as published by
2083 +   the Free Software Foundation; either version 2, or (at your option)
2084 +   any later version.
2085 +
2086 +   GNU CC is distributed in the hope that it will be useful,
2087 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2088 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2089 +   GNU General Public License for more details.
2090 +
2091 +   You should have received a copy of the GNU General Public License
2092 +   along with GNU CC; see the file COPYING.  If not, write to
2093 +   the Free Software Foundation, 59 Temple Place - Suite 330,
2094 +   Boston, MA 02111-1307, USA.  */
2095 +
2096 +#ifdef _LIBC
2097 +#include <stdlib.h>
2098 +#include <string.h>
2099 +#include <error.h>
2100 +#include <libintl.h>
2101 +#include <dwarf2.h>
2102 +#include <unwind.h>
2103 +#include <unwind-pe.h>
2104 +#include <unwind-dw2-fde.h>
2105 +#else
2106 +#include "tconfig.h"
2107 +#include "tsystem.h"
2108 +#include "dwarf2.h"
2109 +#include "unwind.h"
2110 +#include "unwind-pe.h"
2111 +#include "unwind-dw2-fde.h"
2112 +#include "gthr.h"
2113 +#endif
2114 +
2115 +#if !USING_SJLJ_EXCEPTIONS
2116 +
2117 +#ifndef STACK_GROWS_DOWNWARD
2118 +#define STACK_GROWS_DOWNWARD 0
2119 +#else
2120 +#undef STACK_GROWS_DOWNWARD
2121 +#define STACK_GROWS_DOWNWARD 1
2122 +#endif
2123 +
2124 +/* A target can override (perhaps for backward compatibility) how
2125 +   many dwarf2 columns are unwound.  */
2126 +#ifndef DWARF_FRAME_REGISTERS
2127 +#define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER
2128 +#endif
2129 +
2130 +/* This is the register and unwind state for a particular frame.  */
2131 +struct _Unwind_Context
2132 +{
2133 +  void *reg[DWARF_FRAME_REGISTERS+1];
2134 +  void *cfa;
2135 +  void *ra;
2136 +  void *lsda;
2137 +  struct dwarf_eh_bases bases;
2138 +  _Unwind_Word args_size;
2139 +};
2140 +
2141 +#ifndef _LIBC
2142 +/* Byte size of every register managed by these routines.  */
2143 +static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS];
2144 +#endif
2145 +
2146 +\f
2147 +/* The result of interpreting the frame unwind info for a frame.
2148 +   This is all symbolic at this point, as none of the values can
2149 +   be resolved until the target pc is located.  */
2150 +typedef struct
2151 +{
2152 +  /* Each register save state can be described in terms of a CFA slot,
2153 +     another register, or a location expression.  */
2154 +  struct frame_state_reg_info
2155 +  {
2156 +    struct {
2157 +      union {
2158 +       unsigned int reg;
2159 +       _Unwind_Sword offset;
2160 +       const unsigned char *exp;
2161 +      } loc;
2162 +      enum {
2163 +       REG_UNSAVED,
2164 +       REG_SAVED_OFFSET,
2165 +       REG_SAVED_REG,
2166 +       REG_SAVED_EXP,
2167 +      } how;
2168 +    } reg[DWARF_FRAME_REGISTERS+1];
2169 +
2170 +    /* Used to implement DW_CFA_remember_state.  */
2171 +    struct frame_state_reg_info *prev;
2172 +  } regs;
2173 +
2174 +  /* The CFA can be described in terms of a reg+offset or a
2175 +     location expression.  */
2176 +  _Unwind_Sword cfa_offset;
2177 +  _Unwind_Word cfa_reg;
2178 +  const unsigned char *cfa_exp;
2179 +  enum {
2180 +    CFA_UNSET,
2181 +    CFA_REG_OFFSET,
2182 +    CFA_EXP,
2183 +  } cfa_how;
2184 +
2185 +  /* The PC described by the current frame state.  */
2186 +  void *pc;
2187 +
2188 +  /* The information we care about from the CIE/FDE.  */
2189 +  _Unwind_Personality_Fn personality;
2190 +  signed int data_align;
2191 +  unsigned int code_align;
2192 +  unsigned char retaddr_column;
2193 +  unsigned char fde_encoding;
2194 +  unsigned char lsda_encoding;
2195 +  unsigned char saw_z;
2196 +  void *eh_ptr;
2197 +} _Unwind_FrameState;
2198 +\f
2199 +/* Read unaligned data from the instruction buffer.  */
2200 +
2201 +union unaligned
2202 +{
2203 +  void *p;
2204 +  unsigned u2 __attribute__ ((mode (HI)));
2205 +  unsigned u4 __attribute__ ((mode (SI)));
2206 +  unsigned u8 __attribute__ ((mode (DI)));
2207 +  signed s2 __attribute__ ((mode (HI)));
2208 +  signed s4 __attribute__ ((mode (SI)));
2209 +  signed s8 __attribute__ ((mode (DI)));
2210 +} __attribute__ ((packed));
2211 +
2212 +static inline void *
2213 +read_pointer (const void *p) { const union unaligned *up = p; return up->p; }
2214 +
2215 +static inline int
2216 +read_1u (const void *p) { return *(const unsigned char *)p; }
2217 +
2218 +static inline int
2219 +read_1s (const void *p) { return *(const signed char *)p; }
2220 +
2221 +static inline int
2222 +read_2u (const void *p) { const union unaligned *up = p; return up->u2; }
2223 +
2224 +static inline int
2225 +read_2s (const void *p) { const union unaligned *up = p; return up->s2; }
2226 +
2227 +static inline unsigned int
2228 +read_4u (const void *p) { const union unaligned *up = p; return up->u4; }
2229 +
2230 +static inline int
2231 +read_4s (const void *p) { const union unaligned *up = p; return up->s4; }
2232 +
2233 +static inline unsigned long
2234 +read_8u (const void *p) { const union unaligned *up = p; return up->u8; }
2235 +
2236 +static inline unsigned long
2237 +read_8s (const void *p) { const union unaligned *up = p; return up->s8; }
2238 +\f
2239 +/* Get the value of register REG as saved in CONTEXT.  */
2240 +
2241 +inline _Unwind_Word
2242 +_Unwind_GetGR (struct _Unwind_Context *context, int index)
2243 +{
2244 +  /* This will segfault if the register hasn't been saved.  */
2245 +  return * (_Unwind_Word *) context->reg[index];
2246 +}
2247 +
2248 +/* Overwrite the saved value for register REG in CONTEXT with VAL.  */
2249 +
2250 +inline void
2251 +_Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val)
2252 +{
2253 +  * (_Unwind_Word *) context->reg[index] = val;
2254 +}
2255 +
2256 +/* Retrieve the return address for CONTEXT.  */
2257 +
2258 +inline _Unwind_Ptr
2259 +_Unwind_GetIP (struct _Unwind_Context *context)
2260 +{
2261 +  return (_Unwind_Ptr) context->ra;
2262 +}
2263 +
2264 +/* Overwrite the return address for CONTEXT with VAL.  */
2265 +
2266 +inline void
2267 +_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
2268 +{
2269 +  context->ra = (void *) val;
2270 +}
2271 +
2272 +void *
2273 +_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
2274 +{
2275 +  return context->lsda;
2276 +}
2277 +
2278 +_Unwind_Ptr
2279 +_Unwind_GetRegionStart (struct _Unwind_Context *context)
2280 +{
2281 +  return (_Unwind_Ptr) context->bases.func;
2282 +}
2283 +
2284 +#ifndef __ia64__
2285 +_Unwind_Ptr
2286 +_Unwind_GetDataRelBase (struct _Unwind_Context *context)
2287 +{
2288 +  return (_Unwind_Ptr) context->bases.dbase;
2289 +}
2290 +
2291 +_Unwind_Ptr
2292 +_Unwind_GetTextRelBase (struct _Unwind_Context *context)
2293 +{
2294 +  return (_Unwind_Ptr) context->bases.tbase;
2295 +}
2296 +#endif
2297 +\f
2298 +/* Extract any interesting information from the CIE for the translation
2299 +   unit F belongs to.  Return a pointer to the byte after the augmentation,
2300 +   or NULL if we encountered an undecipherable augmentation.  */
2301 +
2302 +static const unsigned char *
2303 +extract_cie_info (struct dwarf_cie *cie, struct _Unwind_Context *context,
2304 +                 _Unwind_FrameState *fs)
2305 +{
2306 +  const unsigned char *aug = cie->augmentation;
2307 +  const unsigned char *p = aug + strlen (aug) + 1;
2308 +  const unsigned char *ret = NULL;
2309 +  _Unwind_Ptr tmp;
2310 +
2311 +  /* g++ v2 "eh" has pointer immediately following augmentation string,
2312 +     so it must be handled first.  */
2313 +  if (aug[0] == 'e' && aug[1] == 'h')
2314 +    {
2315 +      fs->eh_ptr = read_pointer (p);
2316 +      p += sizeof (void *);
2317 +      aug += 2;
2318 +    }
2319 +
2320 +  /* Immediately following the augmentation are the code and
2321 +     data alignment and return address column.  */
2322 +  p = read_uleb128 (p, &tmp); fs->code_align = tmp;
2323 +  p = read_sleb128 (p, &tmp); fs->data_align = (saddr) tmp;
2324 +  fs->retaddr_column = *p++;
2325 +  fs->lsda_encoding = DW_EH_PE_omit;
2326 +
2327 +  /* If the augmentation starts with 'z', then a uleb128 immediately
2328 +     follows containing the length of the augmentation field following
2329 +     the size.  */
2330 +  if (*aug == 'z')
2331 +    {
2332 +      p = read_uleb128 (p, &tmp);
2333 +      ret = p + tmp;
2334 +
2335 +      fs->saw_z = 1;
2336 +      ++aug;
2337 +    }
2338 +
2339 +  /* Iterate over recognized augmentation subsequences.  */
2340 +  while (*aug != '\0')
2341 +    {
2342 +      /* "L" indicates a byte showing how the LSDA pointer is encoded.  */
2343 +      if (aug[0] == 'L')
2344 +       {
2345 +         fs->lsda_encoding = *p++;
2346 +         aug += 1;
2347 +       }
2348 +
2349 +      /* "R" indicates a byte indicating how FDE addresses are encoded.  */
2350 +      else if (aug[0] == 'R')
2351 +       {
2352 +         fs->fde_encoding = *p++;
2353 +         aug += 1;
2354 +       }
2355 +
2356 +      /* "P" indicates a personality routine in the CIE augmentation.  */
2357 +      else if (aug[0] == 'P')
2358 +       {
2359 +         p = read_encoded_value (context, *p, p + 1,
2360 +                                 (_Unwind_Ptr *) &fs->personality);
2361 +         aug += 1;
2362 +       }
2363 +
2364 +      /* Otherwise we have an unknown augmentation string.
2365 +        Bail unless we saw a 'z' prefix.  */
2366 +      else
2367 +       return ret;
2368 +    }
2369 +
2370 +  return ret ? ret : p;
2371 +}
2372 +
2373 +#ifndef _LIBC
2374 +/* Decode a DW_OP stack program.  Return the top of stack.  Push INITIAL
2375 +   onto the stack to start.  */
2376 +
2377 +static _Unwind_Word
2378 +execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
2379 +                 struct _Unwind_Context *context, _Unwind_Word initial)
2380 +{
2381 +  _Unwind_Word stack[64];      /* ??? Assume this is enough. */
2382 +  int stack_elt;
2383 +
2384 +  stack[0] = initial;
2385 +  stack_elt = 1;
2386 +
2387 +  while (op_ptr < op_end)
2388 +    {
2389 +      enum dwarf_location_atom op = *op_ptr++;
2390 +      _Unwind_Word result = 0, reg;
2391 +      _Unwind_Sword offset;
2392 +      _Unwind_Ptr ptrtmp;
2393 +
2394 +      switch (op)
2395 +       {
2396 +       case DW_OP_lit0:
2397 +       case DW_OP_lit1:
2398 +       case DW_OP_lit2:
2399 +       case DW_OP_lit3:
2400 +       case DW_OP_lit4:
2401 +       case DW_OP_lit5:
2402 +       case DW_OP_lit6:
2403 +       case DW_OP_lit7:
2404 +       case DW_OP_lit8:
2405 +       case DW_OP_lit9:
2406 +       case DW_OP_lit10:
2407 +       case DW_OP_lit11:
2408 +       case DW_OP_lit12:
2409 +       case DW_OP_lit13:
2410 +       case DW_OP_lit14:
2411 +       case DW_OP_lit15:
2412 +       case DW_OP_lit16:
2413 +       case DW_OP_lit17:
2414 +       case DW_OP_lit18:
2415 +       case DW_OP_lit19:
2416 +       case DW_OP_lit20:
2417 +       case DW_OP_lit21:
2418 +       case DW_OP_lit22:
2419 +       case DW_OP_lit23:
2420 +       case DW_OP_lit24:
2421 +       case DW_OP_lit25:
2422 +       case DW_OP_lit26:
2423 +       case DW_OP_lit27:
2424 +       case DW_OP_lit28:
2425 +       case DW_OP_lit29:
2426 +       case DW_OP_lit30:
2427 +       case DW_OP_lit31:
2428 +         result = op - DW_OP_lit0;
2429 +         break;
2430 +
2431 +       case DW_OP_addr:
2432 +         result = (_Unwind_Word) (_Unwind_Ptr) read_pointer (op_ptr);
2433 +         op_ptr += sizeof (void *);
2434 +         break;
2435 +
2436 +       case DW_OP_const1u:
2437 +         result = read_1u (op_ptr);
2438 +         op_ptr += 1;
2439 +         break;
2440 +       case DW_OP_const1s:
2441 +         result = read_1s (op_ptr);
2442 +         op_ptr += 1;
2443 +         break;
2444 +       case DW_OP_const2u:
2445 +         result = read_2u (op_ptr);
2446 +         op_ptr += 2;
2447 +         break;
2448 +       case DW_OP_const2s:
2449 +         result = read_2s (op_ptr);
2450 +         op_ptr += 2;
2451 +         break;
2452 +       case DW_OP_const4u:
2453 +         result = read_4u (op_ptr);
2454 +         op_ptr += 4;
2455 +         break;
2456 +       case DW_OP_const4s:
2457 +         result = read_4s (op_ptr);
2458 +         op_ptr += 4;
2459 +         break;
2460 +       case DW_OP_const8u:
2461 +         result = read_8u (op_ptr);
2462 +         op_ptr += 8;
2463 +         break;
2464 +       case DW_OP_const8s:
2465 +         result = read_8s (op_ptr);
2466 +         op_ptr += 8;
2467 +         break;
2468 +       case DW_OP_constu:
2469 +         op_ptr = read_uleb128 (op_ptr, &ptrtmp);
2470 +         result = ptrtmp;
2471 +         break;
2472 +       case DW_OP_consts:
2473 +         op_ptr = read_sleb128 (op_ptr, &ptrtmp);
2474 +         result = (saddr)ptrtmp;
2475 +         break;
2476 +
2477 +       case DW_OP_reg0:
2478 +       case DW_OP_reg1:
2479 +       case DW_OP_reg2:
2480 +       case DW_OP_reg3:
2481 +       case DW_OP_reg4:
2482 +       case DW_OP_reg5:
2483 +       case DW_OP_reg6:
2484 +       case DW_OP_reg7:
2485 +       case DW_OP_reg8:
2486 +       case DW_OP_reg9:
2487 +       case DW_OP_reg10:
2488 +       case DW_OP_reg11:
2489 +       case DW_OP_reg12:
2490 +       case DW_OP_reg13:
2491 +       case DW_OP_reg14:
2492 +       case DW_OP_reg15:
2493 +       case DW_OP_reg16:
2494 +       case DW_OP_reg17:
2495 +       case DW_OP_reg18:
2496 +       case DW_OP_reg19:
2497 +       case DW_OP_reg20:
2498 +       case DW_OP_reg21:
2499 +       case DW_OP_reg22:
2500 +       case DW_OP_reg23:
2501 +       case DW_OP_reg24:
2502 +       case DW_OP_reg25:
2503 +       case DW_OP_reg26:
2504 +       case DW_OP_reg27:
2505 +       case DW_OP_reg28:
2506 +       case DW_OP_reg29:
2507 +       case DW_OP_reg30:
2508 +       case DW_OP_reg31:
2509 +         result = _Unwind_GetGR (context, op - DW_OP_reg0);
2510 +         break;
2511 +       case DW_OP_regx:
2512 +         op_ptr = read_uleb128 (op_ptr, &ptrtmp); reg = ptrtmp;
2513 +         result = _Unwind_GetGR (context, reg);
2514 +         break;
2515 +
2516 +       case DW_OP_breg0:
2517 +       case DW_OP_breg1:
2518 +       case DW_OP_breg2:
2519 +       case DW_OP_breg3:
2520 +       case DW_OP_breg4:
2521 +       case DW_OP_breg5:
2522 +       case DW_OP_breg6:
2523 +       case DW_OP_breg7:
2524 +       case DW_OP_breg8:
2525 +       case DW_OP_breg9:
2526 +       case DW_OP_breg10:
2527 +       case DW_OP_breg11:
2528 +       case DW_OP_breg12:
2529 +       case DW_OP_breg13:
2530 +       case DW_OP_breg14:
2531 +       case DW_OP_breg15:
2532 +       case DW_OP_breg16:
2533 +       case DW_OP_breg17:
2534 +       case DW_OP_breg18:
2535 +       case DW_OP_breg19:
2536 +       case DW_OP_breg20:
2537 +       case DW_OP_breg21:
2538 +       case DW_OP_breg22:
2539 +       case DW_OP_breg23:
2540 +       case DW_OP_breg24:
2541 +       case DW_OP_breg25:
2542 +       case DW_OP_breg26:
2543 +       case DW_OP_breg27:
2544 +       case DW_OP_breg28:
2545 +       case DW_OP_breg29:
2546 +       case DW_OP_breg30:
2547 +       case DW_OP_breg31:
2548 +         op_ptr = read_sleb128 (op_ptr, &ptrtmp); offset = (saddr)ptrtmp;
2549 +         result = _Unwind_GetGR (context, op - DW_OP_breg0) + offset;
2550 +         break;
2551 +       case DW_OP_bregx:
2552 +         op_ptr = read_uleb128 (op_ptr, &ptrtmp); reg = ptrtmp;
2553 +         op_ptr = read_sleb128 (op_ptr, &ptrtmp); offset = (saddr)ptrtmp;
2554 +         result = _Unwind_GetGR (context, reg) + offset;
2555 +         break;
2556 +
2557 +       case DW_OP_dup:
2558 +         if (stack_elt < 1)
2559 +           abort ();
2560 +         result = stack[stack_elt - 1];
2561 +         break;
2562 +
2563 +       case DW_OP_drop:
2564 +         if (--stack_elt < 0)
2565 +           abort ();
2566 +         goto no_push;
2567 +
2568 +       case DW_OP_pick:
2569 +         offset = *op_ptr++;
2570 +         if (offset >= stack_elt - 1)
2571 +           abort ();
2572 +         result = stack[stack_elt - 1 - offset];
2573 +         break;
2574 +
2575 +       case DW_OP_over:
2576 +         if (stack_elt < 2)
2577 +           abort ();
2578 +         result = stack[stack_elt - 2];
2579 +         break;
2580 +
2581 +       case DW_OP_rot:
2582 +         {
2583 +           _Unwind_Word t1, t2, t3;
2584 +
2585 +           if (stack_elt < 3)
2586 +             abort ();
2587 +           t1 = stack[stack_elt - 1];
2588 +           t2 = stack[stack_elt - 2];
2589 +           t3 = stack[stack_elt - 3];
2590 +           stack[stack_elt - 1] = t2;
2591 +           stack[stack_elt - 2] = t3;
2592 +           stack[stack_elt - 3] = t1;
2593 +           goto no_push;
2594 +         }
2595 +
2596 +       case DW_OP_deref:
2597 +       case DW_OP_deref_size:
2598 +       case DW_OP_abs:
2599 +       case DW_OP_neg:
2600 +       case DW_OP_not:
2601 +       case DW_OP_plus_uconst:
2602 +         /* Unary operations.  */
2603 +         if (--stack_elt < 0)
2604 +           abort ();
2605 +         result = stack[stack_elt];
2606 +
2607 +         switch (op)
2608 +           {
2609 +           case DW_OP_deref:
2610 +             {
2611 +               void *ptr = (void *)(_Unwind_Ptr) result;
2612 +               result = (_Unwind_Ptr) read_pointer (ptr);
2613 +             }
2614 +             break;
2615 +
2616 +           case DW_OP_deref_size:
2617 +             {
2618 +               void *ptr = (void *)(_Unwind_Ptr) result;
2619 +               switch (*op_ptr++)
2620 +                 {
2621 +                 case 1:
2622 +                   result = read_1u (ptr);
2623 +                   break;
2624 +                 case 2:
2625 +                   result = read_2u (ptr);
2626 +                   break;
2627 +                 case 4:
2628 +                   result = read_4u (ptr);
2629 +                   break;
2630 +                 case 8:
2631 +                   result = read_8u (ptr);
2632 +                   break;
2633 +                 default:
2634 +                   abort ();
2635 +                 }
2636 +             }
2637 +             break;
2638 +
2639 +           case DW_OP_abs:
2640 +             if ((_Unwind_Sword) result < 0)
2641 +               result = -result;
2642 +             break;
2643 +           case DW_OP_neg:
2644 +             result = -result;
2645 +             break;
2646 +           case DW_OP_not:
2647 +             result = ~result;
2648 +             break;
2649 +           case DW_OP_plus_uconst:
2650 +             op_ptr = read_uleb128 (op_ptr, &ptrtmp); reg = ptrtmp;
2651 +             result += reg;
2652 +             break;
2653 +           /* Avoid warnings.  */
2654 +           default:
2655 +             break;
2656 +           }
2657 +         break;
2658 +
2659 +       case DW_OP_and:
2660 +       case DW_OP_div:
2661 +       case DW_OP_minus:
2662 +       case DW_OP_mod:
2663 +       case DW_OP_mul:
2664 +       case DW_OP_or:
2665 +       case DW_OP_plus:
2666 +       case DW_OP_le:
2667 +       case DW_OP_ge:
2668 +       case DW_OP_eq:
2669 +       case DW_OP_lt:
2670 +       case DW_OP_gt:
2671 +       case DW_OP_ne:
2672 +         {
2673 +           /* Binary operations.  */
2674 +           _Unwind_Word first, second;
2675 +         if ((stack_elt -= 2) < 0)
2676 +           abort ();
2677 +         second = stack[stack_elt];
2678 +         first = stack[stack_elt + 1];
2679 +
2680 +         switch (op)
2681 +           {
2682 +           case DW_OP_and:
2683 +             result = second & first;
2684 +             break;
2685 +           case DW_OP_div:
2686 +             result = (_Unwind_Sword)second / (_Unwind_Sword)first;
2687 +             break;
2688 +           case DW_OP_minus:
2689 +             result = second - first;
2690 +             break;
2691 +           case DW_OP_mod:
2692 +             result = (_Unwind_Sword)second % (_Unwind_Sword)first;
2693 +             break;
2694 +           case DW_OP_mul:
2695 +             result = second * first;
2696 +             break;
2697 +           case DW_OP_or:
2698 +             result = second | first;
2699 +             break;
2700 +           case DW_OP_plus:
2701 +             result = second + first;
2702 +             break;
2703 +           case DW_OP_shl:
2704 +             result = second << first;
2705 +             break;
2706 +           case DW_OP_shr:
2707 +             result = second >> first;
2708 +             break;
2709 +           case DW_OP_shra:
2710 +             result = (_Unwind_Sword)second >> first;
2711 +             break;
2712 +           case DW_OP_xor:
2713 +             result = second ^ first;
2714 +             break;
2715 +           case DW_OP_le:
2716 +             result = (_Unwind_Sword)first <= (_Unwind_Sword)second;
2717 +             break;
2718 +           case DW_OP_ge:
2719 +             result = (_Unwind_Sword)first >= (_Unwind_Sword)second;
2720 +             break;
2721 +           case DW_OP_eq:
2722 +             result = (_Unwind_Sword)first == (_Unwind_Sword)second;
2723 +             break;
2724 +           case DW_OP_lt:
2725 +             result = (_Unwind_Sword)first < (_Unwind_Sword)second;
2726 +             break;
2727 +           case DW_OP_gt:
2728 +             result = (_Unwind_Sword)first > (_Unwind_Sword)second;
2729 +             break;
2730 +           case DW_OP_ne:
2731 +             result = (_Unwind_Sword)first != (_Unwind_Sword)second;
2732 +             break;
2733 +           default:
2734 +             /* Avoid warnings.  */
2735 +             break;
2736 +           }
2737 +         }
2738 +         break;
2739 +
2740 +       case DW_OP_skip:
2741 +         offset = read_2s (op_ptr);
2742 +         op_ptr += 2;
2743 +         op_ptr += offset;
2744 +         goto no_push;
2745 +
2746 +       case DW_OP_bra:
2747 +         if (--stack_elt < 0)
2748 +           abort ();
2749 +         offset = read_2s (op_ptr);
2750 +         op_ptr += 2;
2751 +         if (stack[stack_elt] != 0)
2752 +           op_ptr += offset;
2753 +         goto no_push;
2754 +
2755 +       case DW_OP_nop:
2756 +         goto no_push;
2757 +
2758 +       default:
2759 +         abort ();
2760 +       }
2761 +
2762 +      /* Most things push a result value.  */
2763 +      if ((size_t) stack_elt >= sizeof(stack)/sizeof(*stack))
2764 +       abort ();
2765 +      stack[++stack_elt] = result;
2766 +    no_push:;
2767 +    }
2768 +
2769 +  /* We were executing this program to get a value.  It should be
2770 +     at top of stack.  */
2771 +  if (--stack_elt < 0)
2772 +    abort ();
2773 +  return stack[stack_elt];
2774 +}
2775 +#endif
2776 +
2777 +/* Decode DWARF 2 call frame information. Takes pointers the
2778 +   instruction sequence to decode, current register information and
2779 +   CIE info, and the PC range to evaluate.  */
2780 +
2781 +static void
2782 +execute_cfa_program (const unsigned char *insn_ptr,
2783 +                    const unsigned char *insn_end,
2784 +                    struct _Unwind_Context *context,
2785 +                    _Unwind_FrameState *fs)
2786 +{
2787 +  struct frame_state_reg_info *unused_rs = NULL;
2788 +
2789 +  /* Don't allow remember/restore between CIE and FDE programs.  */
2790 +  fs->regs.prev = NULL;
2791 +
2792 +  while (insn_ptr < insn_end && fs->pc < context->ra)
2793 +    {
2794 +      unsigned char insn = *insn_ptr++;
2795 +      _Unwind_Word reg;
2796 +      _Unwind_Sword offset;
2797 +      _Unwind_Ptr ptrtmp;
2798 +
2799 +      if (insn & DW_CFA_advance_loc)
2800 +       fs->pc += (insn & 0x3f) * fs->code_align;
2801 +      else if (insn & DW_CFA_offset)
2802 +       {
2803 +         reg = insn & 0x3f;
2804 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2805 +         offset = ptrtmp * fs->data_align;
2806 +         fs->regs.reg[reg].how = REG_SAVED_OFFSET;
2807 +         fs->regs.reg[reg].loc.offset = offset;
2808 +       }
2809 +      else if (insn & DW_CFA_restore)
2810 +       {
2811 +         reg = insn & 0x3f;
2812 +         fs->regs.reg[reg].how = REG_UNSAVED;
2813 +       }
2814 +      else switch (insn)
2815 +       {
2816 +       case DW_CFA_set_loc:
2817 +         insn_ptr = read_encoded_value (context, fs->fde_encoding,
2818 +                                        insn_ptr, (_Unwind_Ptr *) &fs->pc);
2819 +         break;
2820 +
2821 +       case DW_CFA_advance_loc1:
2822 +         fs->pc += read_1u (insn_ptr) * fs->code_align;
2823 +         insn_ptr += 1;
2824 +         break;
2825 +       case DW_CFA_advance_loc2:
2826 +         fs->pc += read_2u (insn_ptr) * fs->code_align;
2827 +         insn_ptr += 2;
2828 +         break;
2829 +       case DW_CFA_advance_loc4:
2830 +         fs->pc += read_4u (insn_ptr) * fs->code_align;
2831 +         insn_ptr += 4;
2832 +         break;
2833 +
2834 +       case DW_CFA_offset_extended:
2835 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
2836 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2837 +         offset = ptrtmp * fs->data_align;
2838 +         fs->regs.reg[reg].how = REG_SAVED_OFFSET;
2839 +         fs->regs.reg[reg].loc.offset = offset;
2840 +         break;
2841 +
2842 +       case DW_CFA_restore_extended:
2843 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
2844 +         fs->regs.reg[reg].how = REG_UNSAVED;
2845 +         break;
2846 +
2847 +       case DW_CFA_undefined:
2848 +       case DW_CFA_same_value:
2849 +       case DW_CFA_nop:
2850 +         break;
2851 +
2852 +       case DW_CFA_register:
2853 +         {
2854 +           _Unwind_Word reg2;
2855 +           insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
2856 +           insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg2 = ptrtmp;
2857 +           fs->regs.reg[reg].how = REG_SAVED_REG;
2858 +           fs->regs.reg[reg].loc.reg = reg2;
2859 +         }
2860 +         break;
2861 +      
2862 +       case DW_CFA_remember_state:
2863 +         {
2864 +           struct frame_state_reg_info *new_rs;
2865 +           if (unused_rs)
2866 +             {
2867 +               new_rs = unused_rs;
2868 +               unused_rs = unused_rs->prev;
2869 +             }
2870 +           else
2871 +             new_rs = alloca (sizeof (struct frame_state_reg_info));
2872 +
2873 +           *new_rs = fs->regs;
2874 +           fs->regs.prev = new_rs;
2875 +         }
2876 +         break;
2877 +
2878 +       case DW_CFA_restore_state:
2879 +         {
2880 +           struct frame_state_reg_info *old_rs = fs->regs.prev;
2881 +           fs->regs = *old_rs;
2882 +           old_rs->prev = unused_rs;
2883 +           unused_rs = old_rs;
2884 +         }
2885 +         break;
2886 +
2887 +       case DW_CFA_def_cfa:
2888 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2889 +         fs->cfa_reg = ptrtmp;
2890 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2891 +         fs->cfa_offset = ptrtmp;
2892 +         fs->cfa_how = CFA_REG_OFFSET;
2893 +         break;
2894 +
2895 +       case DW_CFA_def_cfa_register:
2896 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2897 +         fs->cfa_reg = ptrtmp;
2898 +         fs->cfa_how = CFA_REG_OFFSET;
2899 +         break;
2900 +
2901 +       case DW_CFA_def_cfa_offset:
2902 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2903 +         fs->cfa_offset = ptrtmp;
2904 +         /* cfa_how deliberately not set.  */
2905 +         break;
2906 +
2907 +       case DW_CFA_def_cfa_expression:
2908 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2909 +         fs->cfa_exp = insn_ptr;
2910 +         fs->cfa_how = CFA_EXP;
2911 +         insn_ptr += ptrtmp;
2912 +         break;
2913 +
2914 +       case DW_CFA_expression:
2915 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
2916 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2917 +         fs->regs.reg[reg].how = REG_SAVED_EXP;
2918 +         fs->regs.reg[reg].loc.exp = insn_ptr;
2919 +         insn_ptr += ptrtmp;
2920 +         break;
2921 +
2922 +         /* From the 2.1 draft.  */
2923 +       case DW_CFA_offset_extended_sf:
2924 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
2925 +         insn_ptr = read_sleb128 (insn_ptr, &ptrtmp);
2926 +         offset = (saddr)ptrtmp * fs->data_align;
2927 +         fs->regs.reg[reg].how = REG_SAVED_OFFSET;
2928 +         fs->regs.reg[reg].loc.offset = offset;
2929 +         break;
2930 +         
2931 +       case DW_CFA_def_cfa_sf:
2932 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2933 +         fs->cfa_reg = ptrtmp;
2934 +         insn_ptr = read_sleb128 (insn_ptr, &ptrtmp);
2935 +         fs->cfa_offset = (saddr)ptrtmp;
2936 +         fs->cfa_how = CFA_REG_OFFSET;
2937 +         break;
2938 +
2939 +       case DW_CFA_def_cfa_offset_sf:
2940 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2941 +         fs->cfa_offset = ptrtmp;
2942 +         /* cfa_how deliberately not set.  */
2943 +         break;
2944 +
2945 +       case DW_CFA_GNU_window_save:
2946 +         /* ??? Hardcoded for SPARC register window configuration.  */
2947 +         for (reg = 16; reg < 32; ++reg)
2948 +           {
2949 +             fs->regs.reg[reg].how = REG_SAVED_OFFSET;
2950 +             fs->regs.reg[reg].loc.offset = (reg - 16) * sizeof (void *);
2951 +           }
2952 +         break;
2953 +
2954 +       case DW_CFA_GNU_args_size:
2955 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2956 +         context->args_size = ptrtmp;
2957 +         break;
2958 +
2959 +       case DW_CFA_GNU_negative_offset_extended:
2960 +         /* Obsoleted by DW_CFA_offset_extended_sf, but used by
2961 +            older PowerPC code.  */
2962 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
2963 +         insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2964 +         offset = ptrtmp * fs->data_align;
2965 +         fs->regs.reg[reg].how = REG_SAVED_OFFSET;
2966 +         fs->regs.reg[reg].loc.offset = -offset;
2967 +         break;
2968 +
2969 +       default:
2970 +         abort ();
2971 +       }
2972 +    }
2973 +}
2974 +\f
2975 +static _Unwind_Reason_Code
2976 +uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
2977 +{
2978 +  struct dwarf_fde *fde;
2979 +  struct dwarf_cie *cie;
2980 +  const unsigned char *aug, *insn, *end;
2981 +
2982 +  memset (fs, 0, sizeof (*fs));
2983 +  context->args_size = 0;
2984 +  context->lsda = 0;
2985 +
2986 +  fde = _Unwind_Find_FDE (context->ra - 1, &context->bases);
2987 +  if (fde == NULL)
2988 +    {
2989 +      /* Couldn't find frame unwind info for this function.  Try a
2990 +        target-specific fallback mechanism.  This will necessarily
2991 +        not profide a personality routine or LSDA.  */
2992 +#ifdef MD_FALLBACK_FRAME_STATE_FOR
2993 +      MD_FALLBACK_FRAME_STATE_FOR (context, fs, success);
2994 +      return _URC_END_OF_STACK;
2995 +    success:
2996 +      return _URC_NO_REASON;
2997 +#else
2998 +      return _URC_END_OF_STACK;
2999 +#endif
3000 +    }
3001 +
3002 +  fs->pc = context->bases.func;
3003 +
3004 +  cie = get_cie (fde);
3005 +  insn = extract_cie_info (cie, context, fs);
3006 +  if (insn == NULL)
3007 +    /* CIE contained unknown augmentation.  */
3008 +    return _URC_FATAL_PHASE1_ERROR;
3009 +
3010 +  /* First decode all the insns in the CIE.  */
3011 +  end = (unsigned char *) next_fde ((struct dwarf_fde *) cie);
3012 +  execute_cfa_program (insn, end, context, fs);
3013 +
3014 +  /* Locate augmentation for the fde.  */
3015 +  aug = (unsigned char *)fde + sizeof (*fde);
3016 +  aug += 2 * size_of_encoded_value (fs->fde_encoding);
3017 +  insn = NULL;
3018 +  if (fs->saw_z)
3019 +    {
3020 +      _Unwind_Ptr i;
3021 +      aug = read_uleb128 (aug, &i);
3022 +      insn = aug + i;
3023 +    }
3024 +  if (fs->lsda_encoding != DW_EH_PE_omit)
3025 +    aug = read_encoded_value (context, fs->lsda_encoding, aug,
3026 +                             (_Unwind_Ptr *) &context->lsda);
3027 +
3028 +  /* Then the insns in the FDE up to our target PC.  */
3029 +  if (insn == NULL)
3030 +    insn = aug;
3031 +  end = (unsigned char *) next_fde (fde);
3032 +  execute_cfa_program (insn, end, context, fs);
3033 +
3034 +  return _URC_NO_REASON;
3035 +}
3036 +\f
3037 +typedef struct frame_state
3038 +{
3039 +  void *cfa;
3040 +  void *eh_ptr;
3041 +  long cfa_offset;
3042 +  long args_size;
3043 +  long reg_or_offset[DWARF_FRAME_REGISTERS+1];
3044 +  unsigned short cfa_reg;
3045 +  unsigned short retaddr_column;
3046 +  char saved[DWARF_FRAME_REGISTERS+1];
3047 +} frame_state;
3048 +
3049 +struct frame_state * __frame_state_for (void *, struct frame_state *);
3050 +
3051 +/* Called from pre-G++ 3.0 __throw to find the registers to restore for
3052 +   a given PC_TARGET.  The caller should allocate a local variable of
3053 +   `struct frame_state' and pass its address to STATE_IN.  */
3054 +
3055 +struct frame_state *
3056 +__frame_state_for (void *pc_target, struct frame_state *state_in)
3057 +{
3058 +  struct _Unwind_Context context;
3059 +  _Unwind_FrameState fs;
3060 +  int reg;
3061 +
3062 +  memset (&context, 0, sizeof (struct _Unwind_Context));
3063 +  context.ra = pc_target + 1;
3064 +
3065 +  if (uw_frame_state_for (&context, &fs) != _URC_NO_REASON)
3066 +    return 0;
3067 +
3068 +  /* We have no way to pass a location expression for the CFA to our
3069 +     caller.  It wouldn't understand it anyway.  */
3070 +  if (fs.cfa_how == CFA_EXP)
3071 +    return 0;
3072 +
3073 +  for (reg = 0; reg < DWARF_FRAME_REGISTERS + 1; reg++)
3074 +    {
3075 +      state_in->saved[reg] = fs.regs.reg[reg].how;
3076 +      switch (state_in->saved[reg])
3077 +       {
3078 +       case REG_SAVED_REG:
3079 +         state_in->reg_or_offset[reg] = fs.regs.reg[reg].loc.reg;
3080 +         break;
3081 +       case REG_SAVED_OFFSET:
3082 +         state_in->reg_or_offset[reg] = fs.regs.reg[reg].loc.offset;
3083 +         break;
3084 +       default:
3085 +         state_in->reg_or_offset[reg] = 0;
3086 +         break;
3087 +       }
3088 +    }
3089 +
3090 +  state_in->cfa_offset = fs.cfa_offset;
3091 +  state_in->cfa_reg = fs.cfa_reg;
3092 +  state_in->retaddr_column = fs.retaddr_column;
3093 +  state_in->args_size = context.args_size;
3094 +  state_in->eh_ptr = fs.eh_ptr;
3095 +
3096 +  return state_in;
3097 +}
3098 +\f
3099 +#ifndef _LIBC
3100 +
3101 +static void
3102 +uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs)
3103 +{
3104 +  struct _Unwind_Context orig_context = *context;
3105 +  void *cfa;
3106 +  long i;
3107 +
3108 +  /* Compute this frame's CFA.  */
3109 +  switch (fs->cfa_how)
3110 +    {
3111 +    case CFA_REG_OFFSET:
3112 +      /* Special handling here: Many machines do not use a frame pointer,
3113 +        and track the CFA only through offsets from the stack pointer from
3114 +        one frame to the next.  In this case, the stack pointer is never
3115 +        stored, so it has no saved address in the context.  What we do 
3116 +        have is the CFA from the previous stack frame.  */
3117 +      if (context->reg[fs->cfa_reg] == NULL)
3118 +       cfa = context->cfa;
3119 +      else
3120 +       cfa = (void *) (_Unwind_Ptr) _Unwind_GetGR (context, fs->cfa_reg);
3121 +      cfa += fs->cfa_offset;
3122 +      break;
3123 +
3124 +    case CFA_EXP:
3125 +      /* ??? No way of knowing what register number is the stack pointer
3126 +        to do the same sort of handling as above.  Assume that if the
3127 +        CFA calculation is so complicated as to require a stack program
3128 +        that this will not be a problem.  */
3129 +      {
3130 +       const unsigned char *exp = fs->cfa_exp;
3131 +       _Unwind_Ptr len;
3132 +
3133 +       exp = read_uleb128 (exp, &len);
3134 +       cfa = (void *) (_Unwind_Ptr)
3135 +         execute_stack_op (exp, exp + len, context, 0);
3136 +       break;
3137 +      }
3138 +
3139 +    default:
3140 +      abort ();
3141 +    }
3142 +  context->cfa = cfa;
3143 +
3144 +  /* Compute the addresses of all registers saved in this frame.  */
3145 +  for (i = 0; i < DWARF_FRAME_REGISTERS + 1; ++i)
3146 +    switch (fs->regs.reg[i].how)
3147 +      {
3148 +      case REG_UNSAVED:
3149 +       break;
3150 +      case REG_SAVED_OFFSET:
3151 +       context->reg[i] = cfa + fs->regs.reg[i].loc.offset;
3152 +       break;
3153 +      case REG_SAVED_REG:
3154 +       context->reg[i] = orig_context.reg[fs->regs.reg[i].loc.reg];
3155 +       break;
3156 +      case REG_SAVED_EXP:
3157 +       {
3158 +         const unsigned char *exp = fs->regs.reg[i].loc.exp;
3159 +         _Unwind_Ptr len;
3160 +         _Unwind_Ptr val;
3161 +
3162 +         exp = read_uleb128 (exp, &len);
3163 +         val = execute_stack_op (exp, exp + len, &orig_context,
3164 +                                 (_Unwind_Ptr) cfa);
3165 +         context->reg[i] = (void *) val;
3166 +       }
3167 +       break;
3168 +      }
3169 +}
3170 +
3171 +static void
3172 +uw_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs)
3173 +{
3174 +  uw_update_context_1 (context, fs);
3175 +
3176 +  /* Compute the return address now, since the return address column
3177 +     can change from frame to frame.  */
3178 +  context->ra = __builtin_extract_return_addr
3179 +    ((void *) (_Unwind_Ptr) _Unwind_GetGR (context, fs->retaddr_column));
3180 +}
3181 +\f
3182 +/* Fill in CONTEXT for top-of-stack.  The only valid registers at this
3183 +   level will be the return address and the CFA.  */
3184 +   
3185 +#define uw_init_context(CONTEXT)                                       \
3186 +do {                                                                   \
3187 +  /* Do any necessary initialization to access arbitrary stack frames. \
3188 +     On the SPARC, this means flushing the register windows.  */       \
3189 +  __builtin_unwind_init ();                                            \
3190 +  uw_init_context_1 (CONTEXT, __builtin_dwarf_cfa (),                  \
3191 +                    __builtin_return_address (0));                     \
3192 +} while (0)
3193 +
3194 +static void
3195 +uw_init_context_1 (struct _Unwind_Context *context,
3196 +                  void *outer_cfa, void *outer_ra)
3197 +{
3198 +  void *ra = __builtin_extract_return_addr (__builtin_return_address (0));
3199 +  _Unwind_FrameState fs;
3200 +
3201 +  memset (context, 0, sizeof (struct _Unwind_Context));
3202 +  context->ra = ra;
3203 +
3204 +  if (uw_frame_state_for (context, &fs) != _URC_NO_REASON)
3205 +    abort ();
3206 +
3207 +  /* Force the frame state to use the known cfa value.  */
3208 +  context->cfa = outer_cfa;
3209 +  fs.cfa_how = CFA_REG_OFFSET;
3210 +  fs.cfa_reg = 0;
3211 +  fs.cfa_offset = 0;
3212 +
3213 +  uw_update_context_1 (context, &fs);
3214 +
3215 +  /* If the return address column was saved in a register in the
3216 +     initialization context, then we can't see it in the given
3217 +     call frame data.  So have the initialization context tell us.  */
3218 +  context->ra = __builtin_extract_return_addr (outer_ra);
3219 +}
3220 +
3221 +
3222 +/* Install TARGET into CURRENT so that we can return to it.  This is a
3223 +   macro because __builtin_eh_return must be invoked in the context of
3224 +   our caller.  */
3225 +
3226 +#define uw_install_context(CURRENT, TARGET)                            \
3227 +do {                                                                   \
3228 +  long offset = uw_install_context_1 ((CURRENT), (TARGET));            \
3229 +  void *handler = __builtin_frob_return_addr ((TARGET)->ra);           \
3230 +  __builtin_eh_return (offset, handler);                               \
3231 +} while (0)
3232 +
3233 +static inline void
3234 +init_dwarf_reg_size_table (void)
3235 +{
3236 +  __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table);
3237 +}
3238 +
3239 +static long
3240 +uw_install_context_1 (struct _Unwind_Context *current,
3241 +                     struct _Unwind_Context *target)
3242 +{
3243 +  long i;
3244 +
3245 +#if __GTHREADS
3246 +  {
3247 +    static __gthread_once_t once_regsizes = __GTHREAD_ONCE_INIT;
3248 +    if (__gthread_once (&once_regsizes, init_dwarf_reg_size_table) != 0
3249 +       || dwarf_reg_size_table[0] == 0)
3250 +      init_dwarf_reg_size_table ();
3251 +  }
3252 +#else
3253 +  if (dwarf_reg_size_table[0] == 0)
3254 +    init_dwarf_reg_size_table ();
3255 +#endif
3256 +
3257 +  for (i = 0; i < DWARF_FRAME_REGISTERS; ++i)
3258 +    {
3259 +      void *c = current->reg[i];
3260 +      void *t = target->reg[i];
3261 +      if (t && c && t != c)
3262 +       memcpy (c, t, dwarf_reg_size_table[i]);
3263 +    }
3264 +
3265 +  /* We adjust SP by the difference between CURRENT and TARGET's CFA.  */
3266 +  if (STACK_GROWS_DOWNWARD)
3267 +    return target->cfa - current->cfa + target->args_size;
3268 +  else
3269 +    return current->cfa - target->cfa - target->args_size;
3270 +}
3271 +
3272 +static inline _Unwind_Ptr
3273 +uw_identify_context (struct _Unwind_Context *context)
3274 +{
3275 +  return _Unwind_GetIP (context);
3276 +}
3277 +
3278 +
3279 +#include "unwind.inc"
3280 +
3281 +#endif /* _LIBC */
3282 +#endif /* !USING_SJLJ_EXCEPTIONS */
3283 --- libc/sysdeps/generic/unwind-pe.h.jj Tue Oct  2 17:30:51 2001
3284 +++ libc/sysdeps/generic/unwind-pe.h    Tue Oct  2 17:30:51 2001
3285 @@ -0,0 +1,272 @@
3286 +/* Exception handling and frame unwind runtime interface routines.
3287 +   Copyright (C) 2001 Free Software Foundation, Inc.
3288 +
3289 +   This file is part of GNU CC.
3290 +
3291 +   GNU CC is free software; you can redistribute it and/or modify
3292 +   it under the terms of the GNU General Public License as published by
3293 +   the Free Software Foundation; either version 2, or (at your option)
3294 +   any later version.
3295 +
3296 +   GNU CC is distributed in the hope that it will be useful,
3297 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3298 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3299 +   GNU General Public License for more details.
3300 +
3301 +   You should have received a copy of the GNU General Public License
3302 +   along with GNU CC; see the file COPYING.  If not, write to
3303 +   the Free Software Foundation, 59 Temple Place - Suite 330,
3304 +   Boston, MA 02111-1307, USA.  */
3305 +
3306 +/* @@@ Really this should be out of line, but this also causes link
3307 +   compatibility problems with the base ABI.  This is slightly better
3308 +   than duplicating code, however.  */
3309 +
3310 +/* If using C++, references to abort have to be qualified with std::. */
3311 +#if __cplusplus
3312 +#define __gxx_abort std::abort
3313 +#else
3314 +#define __gxx_abort abort
3315 +#endif
3316 +
3317 +/* Pointer encodings, from dwarf2.h.  */
3318 +#define DW_EH_PE_absptr         0x00
3319 +#define DW_EH_PE_omit           0xff
3320 +
3321 +#define DW_EH_PE_uleb128        0x01
3322 +#define DW_EH_PE_udata2         0x02
3323 +#define DW_EH_PE_udata4         0x03
3324 +#define DW_EH_PE_udata8         0x04
3325 +#define DW_EH_PE_sleb128        0x09
3326 +#define DW_EH_PE_sdata2         0x0A
3327 +#define DW_EH_PE_sdata4         0x0B
3328 +#define DW_EH_PE_sdata8         0x0C
3329 +#define DW_EH_PE_signed         0x08
3330 +
3331 +#define DW_EH_PE_pcrel          0x10
3332 +#define DW_EH_PE_textrel        0x20
3333 +#define DW_EH_PE_datarel        0x30
3334 +#define DW_EH_PE_funcrel        0x40
3335 +#define DW_EH_PE_aligned        0x50
3336 +
3337 +#define DW_EH_PE_indirect      0x80
3338 +\f
3339 +
3340 +/* Given an encoding, return the number of bytes the format occupies.
3341 +   This is only defined for fixed-size encodings, and so does not
3342 +   include leb128.  */
3343 +
3344 +#ifndef _LIBC
3345 +static
3346 +#endif
3347 +unsigned int
3348 +size_of_encoded_value (unsigned char encoding)
3349 +#if defined(_LIBC) && !defined(NO_BASE_OF_ENCODED_VALUE)
3350 +;
3351 +#else
3352 +{
3353 +  if (encoding == DW_EH_PE_omit)
3354 +    return 0;
3355 +
3356 +  switch (encoding & 0x07)
3357 +    {
3358 +    case DW_EH_PE_absptr:
3359 +      return sizeof (void *);
3360 +    case DW_EH_PE_udata2:
3361 +      return 2;
3362 +    case DW_EH_PE_udata4:
3363 +      return 4;
3364 +    case DW_EH_PE_udata8:
3365 +      return 8;
3366 +    }
3367 +  __gxx_abort ();
3368 +}
3369 +#endif
3370 +
3371 +#ifndef NO_BASE_OF_ENCODED_VALUE
3372 +
3373 +/* Given an encoding and an _Unwind_Context, return the base to which
3374 +   the encoding is relative.  This base may then be passed to
3375 +   read_encoded_value_with_base for use when the _Unwind_Context is
3376 +   not available.  */
3377 +
3378 +static _Unwind_Ptr
3379 +base_of_encoded_value (unsigned char encoding, struct _Unwind_Context *context)
3380 +{
3381 +  if (encoding == DW_EH_PE_omit)
3382 +    return 0;
3383 +
3384 +  switch (encoding & 0x70)
3385 +    {
3386 +    case DW_EH_PE_absptr:
3387 +    case DW_EH_PE_pcrel:
3388 +    case DW_EH_PE_aligned:
3389 +      return 0;
3390 +
3391 +    case DW_EH_PE_textrel:
3392 +      return _Unwind_GetTextRelBase (context);
3393 +    case DW_EH_PE_datarel:
3394 +      return _Unwind_GetDataRelBase (context);
3395 +    case DW_EH_PE_funcrel:
3396 +      return _Unwind_GetRegionStart (context);
3397 +    }
3398 +  __gxx_abort ();
3399 +}
3400 +
3401 +#endif
3402 +
3403 +/* Load an encoded value from memory at P.  The value is returned in VAL;
3404 +   The function returns P incremented past the value.  BASE is as given
3405 +   by base_of_encoded_value for this encoding in the appropriate context.  */
3406 +
3407 +#ifndef _LIBC
3408 +static
3409 +#endif
3410 +const unsigned char *
3411 +read_encoded_value_with_base (unsigned char encoding, _Unwind_Ptr base,
3412 +                             const unsigned char *p, _Unwind_Ptr *val)
3413 +#if defined(_LIBC) && !defined(NO_BASE_OF_ENCODED_VALUE)
3414 +;
3415 +#else
3416 +{
3417 +  union unaligned
3418 +    {
3419 +      void *ptr;
3420 +      unsigned u2 __attribute__ ((mode (HI)));
3421 +      unsigned u4 __attribute__ ((mode (SI)));
3422 +      unsigned u8 __attribute__ ((mode (DI)));
3423 +      signed s2 __attribute__ ((mode (HI)));
3424 +      signed s4 __attribute__ ((mode (SI)));
3425 +      signed s8 __attribute__ ((mode (DI)));
3426 +    } __attribute__((__packed__));
3427 +
3428 +  union unaligned *u = (union unaligned *) p;
3429 +  _Unwind_Ptr result;
3430 +
3431 +  if (encoding == DW_EH_PE_aligned)
3432 +    {
3433 +      _Unwind_Ptr a = (_Unwind_Ptr)p;
3434 +      a = (a + sizeof (void *) - 1) & - sizeof(void *);
3435 +      result = *(_Unwind_Ptr *) a;
3436 +      p = (const unsigned char *)(a + sizeof (void *));
3437 +    }
3438 +  else
3439 +    {
3440 +      switch (encoding & 0x0f)
3441 +       {
3442 +       case DW_EH_PE_absptr:
3443 +         result = (_Unwind_Ptr) u->ptr;
3444 +         p += sizeof (void *);
3445 +         break;
3446 +
3447 +       case DW_EH_PE_uleb128:
3448 +         {
3449 +           unsigned int shift = 0;
3450 +           unsigned char byte;
3451 +
3452 +           result = 0;
3453 +           do
3454 +             {
3455 +               byte = *p++;
3456 +               result |= (_Unwind_Ptr)(byte & 0x7f) << shift;
3457 +               shift += 7;
3458 +             }
3459 +           while (byte & 0x80);
3460 +         }
3461 +         break;
3462 +
3463 +       case DW_EH_PE_sleb128:
3464 +         {
3465 +           unsigned int shift = 0;
3466 +           unsigned char byte;
3467 +
3468 +           result = 0;
3469 +           do
3470 +             {
3471 +               byte = *p++;
3472 +               result |= (_Unwind_Ptr)(byte & 0x7f) << shift;
3473 +               shift += 7;
3474 +             }
3475 +           while (byte & 0x80);
3476 +
3477 +           if (shift < 8 * sizeof(result) && (byte & 0x40) != 0)
3478 +             result |= -(1L << shift);
3479 +         }
3480 +         break;
3481 +
3482 +       case DW_EH_PE_udata2:
3483 +         result = u->u2;
3484 +         p += 2;
3485 +         break;
3486 +       case DW_EH_PE_udata4:
3487 +         result = u->u4;
3488 +         p += 4;
3489 +         break;
3490 +       case DW_EH_PE_udata8:
3491 +         result = u->u8;
3492 +         p += 8;
3493 +         break;
3494 +
3495 +       case DW_EH_PE_sdata2:
3496 +         result = u->s2;
3497 +         p += 2;
3498 +         break;
3499 +       case DW_EH_PE_sdata4:
3500 +         result = u->s4;
3501 +         p += 4;
3502 +         break;
3503 +       case DW_EH_PE_sdata8:
3504 +         result = u->s8;
3505 +         p += 8;
3506 +         break;
3507 +
3508 +       default:
3509 +         __gxx_abort ();
3510 +       }
3511 +
3512 +      if (result != 0)
3513 +       {
3514 +         result += ((encoding & 0x70) == DW_EH_PE_pcrel
3515 +                    ? (_Unwind_Ptr)u : base);
3516 +         if (encoding & DW_EH_PE_indirect)
3517 +           result = *(_Unwind_Ptr *)result;
3518 +       }
3519 +    }
3520 +
3521 +  *val = result;
3522 +  return p;
3523 +}
3524 +#endif
3525 +
3526 +#ifndef NO_BASE_OF_ENCODED_VALUE
3527 +
3528 +/* Like read_encoded_value_with_base, but get the base from the context
3529 +   rather than providing it directly.  */
3530 +
3531 +static inline const unsigned char *
3532 +read_encoded_value (struct _Unwind_Context *context, unsigned char encoding,
3533 +                   const unsigned char *p, _Unwind_Ptr *val)
3534 +{
3535 +  return read_encoded_value_with_base (encoding,
3536 +               base_of_encoded_value (encoding, context),
3537 +               p, val);
3538 +}
3539 +
3540 +#endif
3541 +
3542 +/* Read an unsigned leb128 value from P, store the value in VAL, return
3543 +   P incremented past the value.  */
3544 +
3545 +static inline const unsigned char *
3546 +read_uleb128 (const unsigned char *p, _Unwind_Ptr *val)
3547 +{
3548 +  return read_encoded_value_with_base (DW_EH_PE_uleb128, 0, p, val);
3549 +}
3550 +
3551 +/* Similar, but read a signed leb128 value.  */
3552 +
3553 +static inline const unsigned char *
3554 +read_sleb128 (const unsigned char *p, _Unwind_Ptr *val)
3555 +{
3556 +  return read_encoded_value_with_base (DW_EH_PE_sleb128, 0, p, val);
3557 +}
3558 --- libc/sysdeps/generic/unwind.h.jj    Tue Oct  2 17:30:51 2001
3559 +++ libc/sysdeps/generic/unwind.h       Tue Oct  2 17:30:51 2001
3560 @@ -0,0 +1,191 @@
3561 +/* Exception handling and frame unwind runtime interface routines.
3562 +   Copyright (C) 2001 Free Software Foundation, Inc.
3563 +
3564 +   This file is part of GNU CC.
3565 +
3566 +   GNU CC is free software; you can redistribute it and/or modify
3567 +   it under the terms of the GNU General Public License as published by
3568 +   the Free Software Foundation; either version 2, or (at your option)
3569 +   any later version.
3570 +
3571 +   GNU CC is distributed in the hope that it will be useful,
3572 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3573 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3574 +   GNU General Public License for more details.
3575 +
3576 +   You should have received a copy of the GNU General Public License
3577 +   along with GNU CC; see the file COPYING.  If not, write to
3578 +   the Free Software Foundation, 59 Temple Place - Suite 330,
3579 +   Boston, MA 02111-1307, USA.  */
3580 +
3581 +/* This is derived from the C++ ABI for IA-64.  Where we diverge
3582 +   for cross-architecture compatibility are noted with "@@@".  */
3583 +
3584 +#ifdef __cplusplus
3585 +extern "C" {
3586 +#endif
3587 +
3588 +/* Level 1: Base ABI  */
3589 +
3590 +/* @@@ The IA-64 ABI uses uint64 throughout.  Most places this is
3591 +   inefficient for 32-bit and smaller machines.  */
3592 +typedef unsigned _Unwind_Word __attribute__((__mode__(__word__)));
3593 +typedef signed _Unwind_Sword __attribute__((__mode__(__word__)));
3594 +typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__)));
3595 +
3596 +/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and
3597 +   consumer of an exception.  We'll go along with this for now even on
3598 +   32-bit machines.  We'll need to provide some other option for
3599 +   16-bit machines and for machines with > 8 bits per byte.  */
3600 +typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__)));
3601 +
3602 +/* The unwind interface uses reason codes in several contexts to
3603 +   identify the reasons for failures or other actions.  */
3604 +typedef enum
3605 +{
3606 +  _URC_NO_REASON = 0,
3607 +  _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
3608 +  _URC_FATAL_PHASE2_ERROR = 2,
3609 +  _URC_FATAL_PHASE1_ERROR = 3,
3610 +  _URC_NORMAL_STOP = 4,
3611 +  _URC_END_OF_STACK = 5,
3612 +  _URC_HANDLER_FOUND = 6,
3613 +  _URC_INSTALL_CONTEXT = 7,
3614 +  _URC_CONTINUE_UNWIND = 8
3615 +} _Unwind_Reason_Code;
3616 +
3617 +
3618 +/* The unwind interface uses a pointer to an exception header object
3619 +   as its representation of an exception being thrown. In general, the
3620 +   full representation of an exception object is language- and
3621 +   implementation-specific, but it will be prefixed by a header
3622 +   understood by the unwind interface.  */
3623 +
3624 +struct _Unwind_Exception;
3625 +
3626 +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code,
3627 +                                             struct _Unwind_Exception *);
3628 +
3629 +struct _Unwind_Exception
3630 +{
3631 +  _Unwind_Exception_Class exception_class;
3632 +  _Unwind_Exception_Cleanup_Fn exception_cleanup;
3633 +  _Unwind_Word private_1;
3634 +  _Unwind_Word private_2;
3635 +
3636 +  /* @@@ The IA-64 ABI says that this structure must be double-word aligned.
3637 +     Taking that literally does not make much sense generically.  Instead we
3638 +     provide the maximum alignment required by any type for the machine.  */
3639 +} __attribute__((__aligned__));
3640 +
3641 +
3642 +/* The ACTIONS argument to the personality routine is a bitwise OR of one
3643 +   or more of the following constants.  */
3644 +typedef int _Unwind_Action;
3645 +
3646 +#define _UA_SEARCH_PHASE       1
3647 +#define _UA_CLEANUP_PHASE      2
3648 +#define _UA_HANDLER_FRAME      4
3649 +#define _UA_FORCE_UNWIND       8
3650 +
3651 +/* This is an opaque type used to refer to a system-specific data
3652 +   structure used by the system unwinder. This context is created and
3653 +   destroyed by the system, and passed to the personality routine
3654 +   during unwinding.  */
3655 +struct _Unwind_Context;
3656 +
3657 +/* Raise an exception, passing along the given exception object.  */
3658 +extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
3659 +
3660 +/* Raise an exception for forced unwinding.  */
3661 +
3662 +typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
3663 +     (int, _Unwind_Action, _Unwind_Exception_Class,
3664 +      struct _Unwind_Exception *, struct _Unwind_Context *, void *);
3665 +
3666 +extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
3667 +                                                _Unwind_Stop_Fn,
3668 +                                                void *);
3669 +
3670 +/* Helper to invoke the exception_cleanup routine.  */
3671 +extern void _Unwind_DeleteException (struct _Unwind_Exception *);
3672 +
3673 +/* Resume propagation of an existing exception.  This is used after
3674 +   e.g. executing cleanup code, and not to implement rethrowing.  */
3675 +extern void _Unwind_Resume (struct _Unwind_Exception *);
3676 +
3677 +/* These functions are used for communicating information about the unwind
3678 +   context (i.e. the unwind descriptors and the user register state) between
3679 +   the unwind library and the personality routine and landing pad.  Only
3680 +   selected registers maybe manipulated.  */
3681 +
3682 +extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int);
3683 +extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word);
3684 +
3685 +extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
3686 +extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
3687 +
3688 +extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *);
3689 +
3690 +extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *);
3691 +
3692 +
3693 +/* The personality routine is the function in the C++ (or other language)
3694 +   runtime library which serves as an interface between the system unwind
3695 +   library and language-specific exception handling semantics.  It is
3696 +   specific to the code fragment described by an unwind info block, and
3697 +   it is always referenced via the pointer in the unwind info block, and
3698 +   hence it has no ABI-specified name. 
3699 +
3700 +   Note that this implies that two different C++ implementations can
3701 +   use different names, and have different contents in the language
3702 +   specific data area.  Moreover, that the language specific data 
3703 +   area contains no version info because name of the function invoked
3704 +   provides more effective versioning by detecting at link time the
3705 +   lack of code to handle the different data format.  */
3706 +   
3707 +typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)
3708 +     (int, _Unwind_Action, _Unwind_Exception_Class,
3709 +      struct _Unwind_Exception *, struct _Unwind_Context *);
3710 +
3711 +/* @@@ The following alternate entry points are for setjmp/longjmp
3712 +   based unwinding.  */
3713 +
3714 +struct SjLj_Function_Context;
3715 +extern void _Unwind_SjLj_Register (struct SjLj_Function_Context *);
3716 +extern void _Unwind_SjLj_Unregister (struct SjLj_Function_Context *);
3717 +
3718 +extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException
3719 +     (struct _Unwind_Exception *);
3720 +extern _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind
3721 +     (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
3722 +extern void _Unwind_SjLj_Resume (struct _Unwind_Exception *);
3723 +
3724 +/* @@@ The following provide access to the base addresses for text
3725 +   and data-relative addressing in the LDSA.  In order to stay link
3726 +   compatible with the standard ABI for IA-64, we inline these.  */
3727 +
3728 +#ifdef __ia64__
3729 +#include <stdlib.h>
3730 +
3731 +static inline _Unwind_Ptr
3732 +_Unwind_GetDataRelBase (struct _Unwind_Context *_C)
3733 +{
3734 +  /* The GP is stored in R1.  */
3735 +  return _Unwind_GetGR (_C, 1);
3736 +}
3737 +
3738 +static inline _Unwind_Ptr
3739 +_Unwind_GetTextRelBase (struct _Unwind_Context *_C)
3740 +{
3741 +  abort ();
3742 +  return 0;
3743 +}
3744 +#else
3745 +extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *);
3746 +extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *);
3747 +#endif
3748 +
3749 +#ifdef __cplusplus
3750 +}
3751 +#endif
3752 --- libc/sysdeps/generic/framestate.c.jj        Tue Oct  2 17:30:51 2001
3753 +++ libc/sysdeps/generic/framestate.c   Tue Oct  2 17:30:51 2001
3754 @@ -0,0 +1,47 @@
3755 +/* __frame_state_for unwinder helper function wrapper
3756 +   Copyright (C) 2001 Free Software Foundation, Inc.
3757 +   This file is part of the GNU C Library.
3758 +   Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
3759 +
3760 +   The GNU C Library is free software; you can redistribute it and/or
3761 +   modify it under the terms of the GNU Lesser General Public
3762 +   License as published by the Free Software Foundation; either
3763 +   version 2.1 of the License, or (at your option) any later version.
3764 +
3765 +   The GNU C Library is distributed in the hope that it will be useful,
3766 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3767 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3768 +   Lesser General Public License for more details.
3769 +
3770 +   You should have received a copy of the GNU Lesser General Public
3771 +   License along with the GNU C Library; if not, write to the Free
3772 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3773 +   02111-1307 USA.  */
3774 +
3775 +#include <dlfcn.h>
3776 +#include <stdlib.h>
3777 +#define __frame_state_for fallback_frame_state_for
3778 +#include <unwind-dw2.c>
3779 +#undef __frame_state_for
3780 +
3781 +typedef struct frame_state * (*framesf)(void *pc, struct frame_state *);
3782 +struct frame_state *__frame_state_for (void *pc,
3783 +                                      struct frame_state *frame_state);
3784 +
3785 +struct frame_state *
3786 +__frame_state_for (void *pc, struct frame_state *frame_state)
3787 +{
3788 +  static framesf frame_state_for;
3789 +
3790 +  if (frame_state_for == NULL)
3791 +    {
3792 +      void *handle = __libc_dlopen ("libgcc_s.so.1");
3793 +
3794 +      if (handle == NULL
3795 +         || (frame_state_for
3796 +             = (framesf) __libc_dlsym (handle, "__frame_state_for")) == NULL)
3797 +       frame_state_for = fallback_frame_state_for;
3798 +    }
3799 +
3800 +  return frame_state_for (pc, frame_state);
3801 +}
3802 --- libc/sysdeps/hppa/gccframe.h.jj     Tue Oct  2 17:30:51 2001
3803 +++ libc/sysdeps/hppa/gccframe.h        Tue Oct  2 17:30:51 2001
3804 @@ -0,0 +1,23 @@
3805 +/* Definition of object in frame unwind info.  hppa version.
3806 +   Copyright (C) 2001 Free Software Foundation, Inc.
3807 +   This file is part of the GNU C Library.
3808 +
3809 +   The GNU C Library is free software; you can redistribute it and/or
3810 +   modify it under the terms of the GNU Lesser General Public
3811 +   License as published by the Free Software Foundation; either
3812 +   version 2.1 of the License, or (at your option) any later version.
3813 +
3814 +   The GNU C Library is distributed in the hope that it will be useful,
3815 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3816 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3817 +   Lesser General Public License for more details.
3818 +
3819 +   You should have received a copy of the GNU Lesser General Public
3820 +   License along with the GNU C Library; if not, write to the Free
3821 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3822 +   02111-1307 USA.  */
3823 +
3824 +/* Note: For hppa64 this is 61 */
3825 +#define DWARF_FRAME_REGISTERS 89
3826 +
3827 +#include <sysdeps/generic/gccframe.h>
3828 --- libc/sysdeps/i386/gccframe.h.jj     Tue Oct  2 17:30:51 2001
3829 +++ libc/sysdeps/i386/gccframe.h        Tue Oct  2 17:30:51 2001
3830 @@ -0,0 +1,28 @@
3831 +/* Definition of object in frame unwind info.  i386 version.
3832 +   Copyright (C) 2001 Free Software Foundation, Inc.
3833 +   This file is part of the GNU C Library.
3834 +
3835 +   The GNU C Library is free software; you can redistribute it and/or
3836 +   modify it under the terms of the GNU Lesser General Public
3837 +   License as published by the Free Software Foundation; either
3838 +   version 2.1 of the License, or (at your option) any later version.
3839 +
3840 +   The GNU C Library is distributed in the hope that it will be useful,
3841 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3842 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3843 +   Lesser General Public License for more details.
3844 +
3845 +   You should have received a copy of the GNU Lesser General Public
3846 +   License along with the GNU C Library; if not, write to the Free
3847 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3848 +   02111-1307 USA.  */
3849 +
3850 +#define DWARF_FRAME_REGISTERS 17
3851 +
3852 +#define CRT_GET_RFIB_DATA(BASE)                \
3853 +  {                                    \
3854 +    register void *__ebx __asm__("ebx");\
3855 +    BASE = __ebx;                      \
3856 +  }
3857 +
3858 +#include <sysdeps/generic/gccframe.h>
3859 --- libc/sysdeps/m68k/gccframe.h.jj     Tue Oct  2 17:30:51 2001
3860 +++ libc/sysdeps/m68k/gccframe.h        Tue Oct  2 17:30:51 2001
3861 @@ -0,0 +1,22 @@
3862 +/* Definition of object in frame unwind info.  m68k version.
3863 +   Copyright (C) 2001 Free Software Foundation, Inc.
3864 +   This file is part of the GNU C Library.
3865 +
3866 +   The GNU C Library is free software; you can redistribute it and/or
3867 +   modify it under the terms of the GNU Lesser General Public
3868 +   License as published by the Free Software Foundation; either
3869 +   version 2.1 of the License, or (at your option) any later version.
3870 +
3871 +   The GNU C Library is distributed in the hope that it will be useful,
3872 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3873 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3874 +   Lesser General Public License for more details.
3875 +
3876 +   You should have received a copy of the GNU Lesser General Public
3877 +   License along with the GNU C Library; if not, write to the Free
3878 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3879 +   02111-1307 USA.  */
3880 +
3881 +#define FIRST_PSEUDO_REGISTER 24
3882 +
3883 +#include <sysdeps/generic/gccframe.h>
3884 --- libc/sysdeps/mach/hurd/i386/Versions.jj     Thu Jun 15 10:09:05 2000
3885 +++ libc/sysdeps/mach/hurd/i386/Versions        Tue Oct  2 17:30:51 2001
3886 @@ -2,7 +2,6 @@ libc {
3887    GLIBC_2.0 {
3888      # Exception handling support functions from libgcc
3889      __register_frame; __register_frame_table; __deregister_frame;
3890 -    __register_frame_info; __deregister_frame_info; __frame_state_for;
3891 -    __register_frame_info_table;
3892 +    __frame_state_for; __register_frame_info_table;
3893    }
3894  }
3895 --- libc/sysdeps/mach/hurd/i386/Makefile.jj     Wed May 23 09:22:01 2001
3896 +++ libc/sysdeps/mach/hurd/i386/Makefile        Tue Oct  2 17:30:51 2001
3897 @@ -7,3 +7,11 @@ $(objpfx)crt0.o: $(objpfx)static-start.o
3898         $(link-relocatable)
3899  
3900  endif
3901 +
3902 +ifeq ($(subdir),elf)
3903 +ifeq (yes,$(build-shared))
3904 +# This is needed to support g++ v2 and v3.
3905 +sysdep_routines += framestate
3906 +shared-only-routines += framestate
3907 +endif
3908 +endif
3909 --- libc/sysdeps/mips/gccframe.h.jj     Tue Oct  2 17:30:51 2001
3910 +++ libc/sysdeps/mips/gccframe.h        Tue Oct  2 17:30:51 2001
3911 @@ -0,0 +1,22 @@
3912 +/* Definition of object in frame unwind info.  mips version.
3913 +   Copyright (C) 2001 Free Software Foundation, Inc.
3914 +   This file is part of the GNU C Library.
3915 +
3916 +   The GNU C Library is free software; you can redistribute it and/or
3917 +   modify it under the terms of the GNU Lesser General Public
3918 +   License as published by the Free Software Foundation; either
3919 +   version 2.1 of the License, or (at your option) any later version.
3920 +
3921 +   The GNU C Library is distributed in the hope that it will be useful,
3922 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3923 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3924 +   Lesser General Public License for more details.
3925 +
3926 +   You should have received a copy of the GNU Lesser General Public
3927 +   License along with the GNU C Library; if not, write to the Free
3928 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3929 +   02111-1307 USA.  */
3930 +
3931 +#define FIRST_PSEUDO_REGISTER 76
3932 +
3933 +#include <sysdeps/generic/gccframe.h>
3934 --- libc/sysdeps/powerpc/gccframe.h.jj  Tue Oct  2 17:30:51 2001
3935 +++ libc/sysdeps/powerpc/gccframe.h     Tue Oct  2 17:30:51 2001
3936 @@ -0,0 +1,22 @@
3937 +/* Definition of object in frame unwind info.  powerpc version.
3938 +   Copyright (C) 2001 Free Software Foundation, Inc.
3939 +   This file is part of the GNU C Library.
3940 +
3941 +   The GNU C Library is free software; you can redistribute it and/or
3942 +   modify it under the terms of the GNU Lesser General Public
3943 +   License as published by the Free Software Foundation; either
3944 +   version 2.1 of the License, or (at your option) any later version.
3945 +
3946 +   The GNU C Library is distributed in the hope that it will be useful,
3947 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3948 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3949 +   Lesser General Public License for more details.
3950 +
3951 +   You should have received a copy of the GNU Lesser General Public
3952 +   License along with the GNU C Library; if not, write to the Free
3953 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3954 +   02111-1307 USA.  */
3955 +
3956 +#define DWARF_FRAME_REGISTERS 77
3957 +
3958 +#include <sysdeps/generic/gccframe.h>
3959 --- libc/sysdeps/sparc/gccframe.h.jj    Tue Oct  2 17:30:51 2001
3960 +++ libc/sysdeps/sparc/gccframe.h       Tue Oct  2 17:30:51 2001
3961 @@ -0,0 +1,22 @@
3962 +/* Definition of object in frame unwind info.  sparc version.
3963 +   Copyright (C) 2001 Free Software Foundation, Inc.
3964 +   This file is part of the GNU C Library.
3965 +
3966 +   The GNU C Library is free software; you can redistribute it and/or
3967 +   modify it under the terms of the GNU Lesser General Public
3968 +   License as published by the Free Software Foundation; either
3969 +   version 2.1 of the License, or (at your option) any later version.
3970 +
3971 +   The GNU C Library is distributed in the hope that it will be useful,
3972 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3973 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3974 +   Lesser General Public License for more details.
3975 +
3976 +   You should have received a copy of the GNU Lesser General Public
3977 +   License along with the GNU C Library; if not, write to the Free
3978 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3979 +   02111-1307 USA.  */
3980 +
3981 +#define FIRST_PSEUDO_REGISTER 101
3982 +
3983 +#include <sysdeps/generic/gccframe.h>
3984 --- libc/sysdeps/sh/gccframe.h.jj       Tue Oct  2 17:30:51 2001
3985 +++ libc/sysdeps/sh/gccframe.h  Tue Oct  2 17:30:51 2001
3986 @@ -0,0 +1,22 @@
3987 +/* Definition of object in frame unwind info.  sh version.
3988 +   Copyright (C) 2001 Free Software Foundation, Inc.
3989 +   This file is part of the GNU C Library.
3990 +
3991 +   The GNU C Library is free software; you can redistribute it and/or
3992 +   modify it under the terms of the GNU Lesser General Public
3993 +   License as published by the Free Software Foundation; either
3994 +   version 2.1 of the License, or (at your option) any later version.
3995 +
3996 +   The GNU C Library is distributed in the hope that it will be useful,
3997 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3998 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3999 +   Lesser General Public License for more details.
4000 +
4001 +   You should have received a copy of the GNU Lesser General Public
4002 +   License along with the GNU C Library; if not, write to the Free
4003 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4004 +   02111-1307 USA.  */
4005 +
4006 +#define DWARF_FRAME_REGISTERS 49
4007 +
4008 +#include <sysdeps/generic/gccframe.h>
4009 --- libc/sysdeps/s390/gccframe.h.jj     Tue Oct  2 17:30:51 2001
4010 +++ libc/sysdeps/s390/gccframe.h        Tue Oct  2 17:30:51 2001
4011 @@ -0,0 +1,22 @@
4012 +/* Definition of object in frame unwind info.  s390 version.
4013 +   Copyright (C) 2001 Free Software Foundation, Inc.
4014 +   This file is part of the GNU C Library.
4015 +
4016 +   The GNU C Library is free software; you can redistribute it and/or
4017 +   modify it under the terms of the GNU Lesser General Public
4018 +   License as published by the Free Software Foundation; either
4019 +   version 2.1 of the License, or (at your option) any later version.
4020 +
4021 +   The GNU C Library is distributed in the hope that it will be useful,
4022 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
4023 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4024 +   Lesser General Public License for more details.
4025 +
4026 +   You should have received a copy of the GNU Lesser General Public
4027 +   License along with the GNU C Library; if not, write to the Free
4028 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4029 +   02111-1307 USA.  */
4030 +
4031 +#define FIRST_PSEUDO_REGISTER 34
4032 +
4033 +#include <sysdeps/generic/gccframe.h>
4034 --- libc/sysdeps/unix/sysv/linux/alpha/Versions.jj      Wed May 23 09:28:57 2001
4035 +++ libc/sysdeps/unix/sysv/linux/alpha/Versions Tue Oct  2 17:30:51 2001
4036 @@ -6,8 +6,7 @@ libc {
4037  
4038      # Exception handling support functions from libgcc
4039      __register_frame; __register_frame_table; __deregister_frame;
4040 -    __register_frame_info; __deregister_frame_info; __frame_state_for;
4041 -    __register_frame_info_table;
4042 +    __frame_state_for; __register_frame_info_table;
4043  
4044      # b*
4045      bus_base; bus_base_sparse;
4046 --- libc/sysdeps/unix/sysv/linux/alpha/Makefile.jj      Tue Mar 21 11:58:31 2000
4047 +++ libc/sysdeps/unix/sysv/linux/alpha/Makefile Tue Oct  2 17:30:51 2001
4048 @@ -23,3 +23,11 @@ ifeq ($(subdir),signal)
4049  sysdep_routines += rt_sigsuspend rt_sigprocmask rt_sigtimedwait        \
4050                    rt_sigqueueinfo rt_sigaction rt_sigpending
4051  endif
4052 +
4053 +ifeq ($(subdir),elf)
4054 +ifeq (yes,$(build-shared))
4055 +# This is needed to support g++ v2 and v3.
4056 +sysdep_routines += framestate
4057 +shared-only-routines += framestate
4058 +endif
4059 +endif
4060 --- libc/sysdeps/unix/sysv/linux/ia64/unwind-dw2-fde.c.jj       Tue Oct  2 17:30:51 2001
4061 +++ libc/sysdeps/unix/sysv/linux/ia64/unwind-dw2-fde.c  Tue Oct  2 17:30:51 2001
4062 @@ -0,0 +1 @@
4063 +/* Linux/ia64 does not need unwind table registry. */
4064 --- libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions.jj       Wed May 23 09:28:57 2001
4065 +++ libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions  Tue Oct  2 17:30:51 2001
4066 @@ -2,8 +2,7 @@ libc {
4067    GLIBC_2.0 {
4068      # Exception handling support functions from libgcc
4069      __register_frame; __register_frame_table; __deregister_frame;
4070 -    __register_frame_info; __deregister_frame_info; __frame_state_for;
4071 -    __register_frame_info_table;
4072 +    __frame_state_for; __register_frame_info_table;
4073    }
4074    GLIBC_2.2 {
4075      # functions used in other libraries
4076 --- libc/sysdeps/unix/sysv/linux/s390/s390-32/Makefile.jj       Wed May 23 09:22:02 2001
4077 +++ libc/sysdeps/unix/sysv/linux/s390/s390-32/Makefile  Tue Oct  2 17:30:51 2001
4078 @@ -6,3 +6,11 @@ endif
4079  ifeq ($(subdir),resource)
4080  sysdep_routines += oldgetrlimit64
4081  endif
4082 +
4083 +ifeq ($(subdir),elf)
4084 +ifeq (yes,$(build-shared))
4085 +# This is needed to support g++ v2 and v3.
4086 +sysdep_routines += framestate
4087 +shared-only-routines += framestate
4088 +endif
4089 +endif
4090 --- libc/sysdeps/unix/sysv/linux/arm/Versions.jj        Wed May 23 09:28:57 2001
4091 +++ libc/sysdeps/unix/sysv/linux/arm/Versions   Tue Oct  2 17:30:51 2001
4092 @@ -2,8 +2,7 @@ libc {
4093    GLIBC_2.0 {
4094      # Exception handling support functions from libgcc
4095      __register_frame; __register_frame_table; __deregister_frame;
4096 -    __register_frame_info; __deregister_frame_info; __frame_state_for;
4097 -    __register_frame_info_table;
4098 +    __frame_state_for; __register_frame_info_table;
4099    }
4100    GLIBC_2.1 {
4101      ioperm; iopl;
4102 --- libc/sysdeps/unix/sysv/linux/arm/Makefile.jj        Mon Mar 12 10:56:22 2001
4103 +++ libc/sysdeps/unix/sysv/linux/arm/Makefile   Tue Oct  2 17:30:51 2001
4104 @@ -19,4 +19,10 @@ sysdep-dl-routines += dl-procinfo
4105  sysdep_routines += dl-procinfo
4106  # extra shared linker files to link only into dl-allobjs.so
4107  sysdep-rtld-routines += dl-procinfo
4108 +
4109 +ifeq (yes,$(build-shared))
4110 +# This is needed to support g++ v2 and v3.
4111 +sysdep_routines += framestate
4112 +shared-only-routines += framestate
4113 +endif
4114  endif
4115 --- libc/sysdeps/unix/sysv/linux/i386/Versions.jj       Wed May 23 09:28:57 2001
4116 +++ libc/sysdeps/unix/sysv/linux/i386/Versions  Tue Oct  2 17:30:51 2001
4117 @@ -2,8 +2,7 @@ libc {
4118    GLIBC_2.0 {
4119      # Exception handling support functions from libgcc
4120      __register_frame; __register_frame_table; __deregister_frame;
4121 -    __register_frame_info; __deregister_frame_info; __frame_state_for;
4122 -    __register_frame_info_table;
4123 +    __frame_state_for; __register_frame_info_table;
4124  
4125      ioperm; iopl;
4126  
4127 --- libc/sysdeps/unix/sysv/linux/i386/Makefile.jj       Wed May 23 09:22:02 2001
4128 +++ libc/sysdeps/unix/sysv/linux/i386/Makefile  Tue Oct  2 17:30:51 2001
4129 @@ -12,6 +12,12 @@ sysdep-dl-routines += dl-procinfo
4130  sysdep_routines += dl-procinfo
4131  # extra shared linker files to link only into dl-allobjs.so
4132  sysdep-rtld-routines += dl-procinfo
4133 +
4134 +ifeq (yes,$(build-shared))
4135 +# This is needed to support g++ v2 and v3.
4136 +sysdep_routines += framestate
4137 +shared-only-routines += framestate
4138 +endif
4139  endif
4140  
4141  ifeq ($(subdir),resource)
4142 --- libc/sysdeps/unix/sysv/linux/m68k/Versions.jj       Wed May 23 09:28:57 2001
4143 +++ libc/sysdeps/unix/sysv/linux/m68k/Versions  Tue Oct  2 17:30:51 2001
4144 @@ -2,8 +2,7 @@ libc {
4145    GLIBC_2.0 {
4146      # Exception handling support functions from libgcc
4147      __register_frame; __register_frame_table; __deregister_frame;
4148 -    __register_frame_info; __deregister_frame_info; __frame_state_for;
4149 -    __register_frame_info_table;
4150 +    __frame_state_for; __register_frame_info_table;
4151  
4152      # c*
4153      cacheflush;
4154 --- libc/sysdeps/unix/sysv/linux/m68k/Makefile.jj       Thu Nov  2 08:52:25 2000
4155 +++ libc/sysdeps/unix/sysv/linux/m68k/Makefile  Tue Oct  2 17:30:51 2001
4156 @@ -10,6 +10,12 @@ endif
4157  ifeq ($(subdir),elf)
4158  sysdep-others += lddlibc4
4159  install-bin += lddlibc4
4160 +
4161 +ifeq (yes,$(build-shared))
4162 +# This is needed to support g++ v2 and v3.
4163 +sysdep_routines += framestate
4164 +shared-only-routines += framestate
4165 +endif
4166  endif
4167  
4168  ifeq ($(subdir),resource)
4169 --- libc/sysdeps/unix/sysv/linux/mips/Versions.jj       Wed May 23 09:28:57 2001
4170 +++ libc/sysdeps/unix/sysv/linux/mips/Versions  Tue Oct  2 17:30:51 2001
4171 @@ -2,8 +2,7 @@ libc {
4172    GLIBC_2.0 {
4173      # Exception handling support functions from libgcc
4174      __register_frame; __register_frame_table; __deregister_frame;
4175 -    __register_frame_info; __deregister_frame_info; __frame_state_for;
4176 -    __register_frame_info_table;
4177 +    __frame_state_for; __register_frame_info_table;
4178  
4179      # Needed by gcc:
4180      _flush_cache;
4181 --- libc/sysdeps/unix/sysv/linux/mips/Makefile.jj       Fri Sep  8 17:51:37 2000
4182 +++ libc/sysdeps/unix/sysv/linux/mips/Makefile  Tue Oct  2 17:30:51 2001
4183 @@ -9,3 +9,11 @@ sysdep_routines += cachectl cacheflush s
4184  
4185  sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
4186  endif
4187 +
4188 +ifeq ($(subdir),elf)
4189 +ifeq (yes,$(build-shared))
4190 +# This is needed to support g++ v2 and v3.
4191 +sysdep_routines += framestate
4192 +shared-only-routines += framestate
4193 +endif
4194 +endif
4195 --- libc/sysdeps/unix/sysv/linux/powerpc/Versions.jj    Wed May 23 09:28:57 2001
4196 +++ libc/sysdeps/unix/sysv/linux/powerpc/Versions       Tue Oct  2 17:30:51 2001
4197 @@ -2,8 +2,7 @@ libc {
4198    GLIBC_2.0 {
4199      # Exception handling support functions from libgcc
4200      __register_frame; __register_frame_table; __deregister_frame;
4201 -    __register_frame_info; __deregister_frame_info; __frame_state_for;
4202 -    __register_frame_info_table;
4203 +    __frame_state_for; __register_frame_info_table;
4204    }
4205    GLIBC_2.2 {
4206      # functions used in other libraries
4207 --- libc/sysdeps/unix/sysv/linux/powerpc/Makefile.jj    Wed May 23 09:22:02 2001
4208 +++ libc/sysdeps/unix/sysv/linux/powerpc/Makefile       Tue Oct  2 17:30:51 2001
4209 @@ -6,3 +6,11 @@ endif
4210  ifeq ($(subdir),resource)
4211  sysdep_routines += oldgetrlimit64
4212  endif
4213 +
4214 +ifeq ($(subdir),elf)
4215 +ifeq (yes,$(build-shared))
4216 +# This is needed to support g++ v2 and v3.
4217 +sysdep_routines += framestate
4218 +shared-only-routines += framestate
4219 +endif
4220 +endif
4221 --- libc/sysdeps/unix/sysv/linux/sparc/sparc32/Versions.jj      Wed May 23 09:28:57 2001
4222 +++ libc/sysdeps/unix/sysv/linux/sparc/sparc32/Versions Tue Oct  2 17:30:51 2001
4223 @@ -2,8 +2,7 @@ libc {
4224    GLIBC_2.0 {
4225      # Exception handling support functions from libgcc
4226      __register_frame; __register_frame_table; __deregister_frame;
4227 -    __register_frame_info; __deregister_frame_info; __frame_state_for;
4228 -    __register_frame_info_table;
4229 +    __frame_state_for; __register_frame_info_table;
4230    }
4231    GLIBC_2.2 {
4232      # functions used in other libraries
4233 --- libc/sysdeps/unix/sysv/linux/sparc/sparc64/Versions.jj      Wed Jan 31 16:35:24 2001
4234 +++ libc/sysdeps/unix/sysv/linux/sparc/sparc64/Versions Tue Oct  2 17:30:51 2001
4235 @@ -2,8 +2,7 @@ libc {
4236    GLIBC_2.0 {
4237      # Exception handling support functions from libgcc
4238      __register_frame; __register_frame_table; __deregister_frame;
4239 -    __register_frame_info; __deregister_frame_info; __frame_state_for;
4240 -    __register_frame_info_table;
4241 +    __frame_state_for; __register_frame_info_table;
4242    }
4243    GLIBC_2.2.2 {
4244      # w*
4245 --- libc/sysdeps/unix/sysv/linux/sparc/Makefile.jj      Thu Nov 16 02:48:14 2000
4246 +++ libc/sysdeps/unix/sysv/linux/sparc/Makefile Tue Oct  2 17:30:51 2001
4247 @@ -42,3 +42,11 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.
4248         mv -f $(@:.h=.d)-t2 $(@:.h=.d)
4249  
4250  endif
4251 +
4252 +ifeq ($(subdir),elf)
4253 +ifeq (yes,$(build-shared))
4254 +# This is needed to support g++ v2 and v3.
4255 +sysdep_routines += framestate
4256 +shared-only-routines += framestate
4257 +endif
4258 +endif
4259 --- libc/sysdeps/unix/sysv/linux/configure.in.jj        Thu Sep 27 23:26:38 2001
4260 +++ libc/sysdeps/unix/sysv/linux/configure.in   Tue Oct  2 17:30:51 2001
4261 @@ -44,6 +44,7 @@ case "$machine" in
4262      ;;
4263    ia64*)
4264      arch_minimum_kernel=2.4.0
4265 +    libc_cv_gcc_unwind_find_fde=no
4266      ;;
4267    hppa*)
4268      arch_minimum_kernel=2.3.99
4269 --- libc/sysdeps/unix/sysv/linux/configure.jj   Thu Sep 27 23:26:38 2001
4270 +++ libc/sysdeps/unix/sysv/linux/configure      Tue Oct  2 17:30:51 2001
4271 @@ -57,6 +57,7 @@ case "$machine" in
4272      ;;
4273    ia64*)
4274      arch_minimum_kernel=2.4.0
4275 +    libc_cv_gcc_unwind_find_fde=no
4276      ;;
4277    hppa*)
4278      arch_minimum_kernel=2.3.99
4279 --- libc/sysdeps/vax/gccframe.h.jj      Tue Oct  2 17:30:51 2001
4280 +++ libc/sysdeps/vax/gccframe.h Tue Oct  2 17:30:51 2001
4281 @@ -0,0 +1,22 @@
4282 +/* Definition of object in frame unwind info.  vax version.
4283 +   Copyright (C) 2001 Free Software Foundation, Inc.
4284 +   This file is part of the GNU C Library.
4285 +
4286 +   The GNU C Library is free software; you can redistribute it and/or
4287 +   modify it under the terms of the GNU Lesser General Public
4288 +   License as published by the Free Software Foundation; either
4289 +   version 2.1 of the License, or (at your option) any later version.
4290 +
4291 +   The GNU C Library is distributed in the hope that it will be useful,
4292 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
4293 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4294 +   Lesser General Public License for more details.
4295 +
4296 +   You should have received a copy of the GNU Lesser General Public
4297 +   License along with the GNU C Library; if not, write to the Free
4298 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4299 +   02111-1307 USA.  */
4300 +
4301 +#define DWARF_FRAME_REGISTERS 16
4302 +
4303 +#include <sysdeps/generic/gccframe.h>
4304 --- libc/Versions.def.jj        Thu Sep 27 23:22:16 2001
4305 +++ libc/Versions.def   Tue Oct  2 17:30:51 2001
4306 @@ -17,6 +17,9 @@ libc {
4307  %ifdef USE_IN_LIBIO
4308    HURD_CTHREADS_0.3
4309  %endif
4310 +%ifdef EXPORT_UNWIND_FIND_FDE
4311 +  GCC_3.0
4312 +%endif
4313  }
4314  libcrypt {
4315    GLIBC_2.0
4316 --- libc/configure.jj   Wed Sep 12 09:56:32 2001
4317 +++ libc/configure      Tue Oct  2 17:36:09 2001
4318 @@ -2105,27 +2105,6 @@ test -n "$aux_missing" && echo "configur
4319  CCVERSION=`$CC -v 2>&1 | sed -n 's/gcc version //p'`
4320  
4321  
4322 -case $CCVERSION in
4323 -  3.*) gcc3=yes;;
4324 -esac
4325 -
4326 -if test x"$gcc3" = xyes; then
4327 -    echo "\
4328 -*** This version of GNU libc cannot be compiled by GCC 3.x.
4329 -*** GCC 3.x will generate a library that is binary incompatible to
4330 -*** older and future releases of GNU libc.
4331 -*** You should compile this GNU libc release by an older GCC version
4332 -*** or wait for the next GNU libc release."
4333 -  if test $enable_sanity = yes; then
4334 -    echo "\
4335 -*** If you really mean to use GCC 3.x, run configure again
4336 -*** using the extra parameter \`--disable-sanity-checks'."
4337 -    exit 1
4338 -  else
4339 -    echo "\
4340 -*** This configuration is not supported by the GNU libc developers."
4341 -  fi
4342 -fi
4343  # if using special system headers, find out the compiler's sekrit
4344  # header directory and add that to the list.  NOTE: Only does the right
4345  # thing on a system that doesn't need fixincludes.  (Not presently a problem.)
4346 @@ -2188,6 +2188,21 @@ if test "$ld_library_path_setting" != "o
4347  *** and run configure again." 1>&2; exit 1; }
4348  fi
4349  
4350 +echo $ac_n "checking whether GCC supports -static-libgcc""... $ac_c" 1>&6
4351 +echo "configure:2172: checking whether GCC supports -static-libgcc" >&5
4352 +if eval "test \"`echo '$''{'libc_cv_gcc_static_libgcc'+set}'`\" = set"; then
4353 +  echo $ac_n "(cached) $ac_c" 1>&6
4354 +else
4355 +  if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then
4356 +    libc_cv_gcc_static_libgcc=
4357 +  else
4358 +    libc_cv_gcc_static_libgcc=-static-libgcc
4359 +  fi
4360 +fi
4361 +
4362 +echo "$ac_t""$libc_cv_gcc_static_libgcc" 1>&6
4363 +
4364 +
4365  # Extract the first word of "bash", so it can be a program name with args.
4366  set dummy bash; ac_word=$2
4367  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
4368 @@ -3492,6 +3507,7 @@ libc_link_sources=
4369  use_ldconfig=no
4370  ldd_rewrite_script=no
4371  libc_cv_sysconfdir=$sysconfdir
4372 +libc_cv_gcc_unwind_find_fde=yes
4373  
4374  # Iterate over all the sysdep directories we will use, running their
4375  # configure fragments, and looking for a uname implementation.
4376 @@ -3516,6 +3532,13 @@ for dir in $sysnames; do
4377    fi
4378  done
4379  
4380 +if test x$libc_cv_gcc_unwind_find_fde = xyes; then
4381 +  cat >> confdefs.h <<\EOF
4382 +#define EXPORT_UNWIND_FIND_FDE 1
4383 +EOF
4384 +
4385 +fi
4386 +
4387  
4388  
4389  # If we will use the generic uname implementation, we must figure out what
4390 @@ -3860,6 +3883,7 @@ s%@RANLIB@%$RANLIB%g
4391  s%@MIG@%$MIG%g
4392  s%@CCVERSION@%$CCVERSION%g
4393  s%@SYSINCLUDES@%$SYSINCLUDES%g
4394 +s%@libc_cv_gcc_static_libgcc@%$libc_cv_gcc_static_libgcc%g
4395  s%@BASH@%$BASH%g
4396  s%@libc_cv_have_bash2@%$libc_cv_have_bash2%g
4397  s%@KSH@%$KSH%g
4398 --- libc/configure.in.jj        Wed Sep 12 09:56:32 2001
4399 +++ libc/configure.in   Tue Oct  2 17:30:52 2001
4400 @@ -636,27 +636,6 @@ test -n "$aux_missing" && AC_MSG_WARN([
4401  CCVERSION=`$CC -v 2>&1 | sed -n 's/gcc version //p'`
4402  AC_SUBST(CCVERSION)
4403  
4404 -case $CCVERSION in
4405 -  3.*) gcc3=yes;;
4406 -esac
4407 -
4408 -if test x"$gcc3" = xyes; then
4409 -    echo "\
4410 -*** This version of GNU libc cannot be compiled by GCC 3.x.
4411 -*** GCC 3.x will generate a library that is binary incompatible to
4412 -*** older and future releases of GNU libc.
4413 -*** You should compile this GNU libc release by an older GCC version
4414 -*** or wait for the next GNU libc release."
4415 -  if test $enable_sanity = yes; then
4416 -    echo "\
4417 -*** If you really mean to use GCC 3.x, run configure again
4418 -*** using the extra parameter \`--disable-sanity-checks'."
4419 -    exit 1
4420 -  else
4421 -    echo "\
4422 -*** This configuration is not supported by the GNU libc developers."
4423 -  fi
4424 -fi
4425  # if using special system headers, find out the compiler's sekrit
4426  # header directory and add that to the list.  NOTE: Only does the right
4427  # thing on a system that doesn't need fixincludes.  (Not presently a problem.)
4428 @@ -713,6 +713,14 @@ AC_MSG_ERROR([
4429  *** and run configure again.])
4430  fi
4431  
4432 +AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
4433 +if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then
4434 +  libc_cv_gcc_static_libgcc=
4435 +else
4436 +  libc_cv_gcc_static_libgcc=-static-libgcc
4437 +fi])
4438 +AC_SUBST(libc_cv_gcc_static_libgcc)
4439 +
4440  AC_PATH_PROG(BASH, bash, no)
4441  if test "$BASH" != no &&
4442     $BASH -c 'test "$BASH_VERSINFO" \
4443 @@ -1459,6 +1467,7 @@ libc_link_sources=
4444  use_ldconfig=no
4445  ldd_rewrite_script=no
4446  libc_cv_sysconfdir=$sysconfdir
4447 +libc_cv_gcc_unwind_find_fde=yes
4448  
4449  # Iterate over all the sysdep directories we will use, running their
4450  # configure fragments, and looking for a uname implementation.
4451 @@ -1484,6 +1493,10 @@ for dir in $sysnames; do
4452  ]dnl
4453  done
4454  
4455 +if test x$libc_cv_gcc_unwind_find_fde = xyes; then
4456 +  AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
4457 +fi
4458 +
4459  AC_LINK_FILES(`echo $libc_link_sources`, `echo $libc_link_dests`)
4460  
4461  # If we will use the generic uname implementation, we must figure out what
4462 --- libc/config.h.in.jj Mon Sep 17 00:18:18 2001
4463 +++ libc/config.h.in    Tue Oct  2 17:30:52 2001
4464 @@ -48,6 +48,9 @@
4465  /* Define a symbol_name as a global .symbol_name for ld.  */
4466  #undef HAVE_ASM_GLOBAL_DOT_NAME
4467  
4468 +/* Define if _Unwind_Find_FDE should be exported from glibc.  */
4469 +#undef  EXPORT_UNWIND_FIND_FDE
4470 +
4471  /* Define to use GNU libio instead of GNU stdio.
4472     This is defined by configure under --enable-libio.  */
4473  #undef USE_IN_LIBIO
4474 --- libc/config.make.in.jj      Wed Sep 12 09:56:32 2001
4475 +++ libc/config.make.in Tue Oct  2 17:30:52 2001
4476 @@ -47,6 +47,8 @@ need-nopic-initfini = @nopic_initfini@
4477  with-cvs = @with_cvs@
4478  old-glibc-headers = @old_glibc_headers@
4479  
4480 +static-libgcc = @libc_cv_gcc_static_libgcc@
4481 +
4482  versioning = @VERSIONING@
4483  oldest-abi = @oldest_abi@
4484  no-whole-archive = @no_whole_archive@
4485 --- libc/Makerules.jj   Wed Sep 12 09:56:32 2001
4486 +++ libc/Makerules      Tue Oct  2 17:30:52 2001
4487 @@ -400,7 +400,7 @@ endif
4488  
4489  ifeq ($(elf),yes)
4490  define build-shlib-helper
4491 -$(LINK.o) -shared -Wl,-O1 $(sysdep-LDFLAGS) $(config-LDFLAGS) \
4492 +$(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) $(config-LDFLAGS) \
4493           $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
4494           $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
4495           -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
4496 @@ -460,7 +460,7 @@ $(LINK.o) -Wl,-G -Wl,-bM:SRE -Wl,-bnoent
4497  endef
4498  else
4499  define build-module-helper
4500 -$(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) \
4501 +$(LINK.o) -shared $(static-libgcc) $(sysdep-LDFLAGS) $(config-LDFLAGS) \
4502           -B$(csu-objpfx) $(load-map-file) \
4503           $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
4504           -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
This page took 0.473414 seconds and 3 git commands to generate.