3 # DP: Patch to allow glibc to interact with gcc3 correctly. Patch provided
4 # DP: by Jakub Jelinek.
7 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
12 patch -d "$2" -f --no-backup-if-mismatch -p1 < $0
16 patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0
20 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
25 2001-10-02 Jakub Jelinek <jakub@redhat.com>
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
33 (gcc3): Allow glibc to be compiled with gcc 3.x.
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
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
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):
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
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.
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
97 calling those lists of functions. */
99 #include <libc-internal.h>
102 #ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
103 # include <gccframe.h>
104 @@ -29,7 +30,10 @@ static char __EH_FRAME_BEGIN__[]
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 *,
110 extern void __deregister_frame_info (const void *);
111 +extern void __deregister_frame_info_bases (const void *);
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
118 static struct object ob;
119 +# if defined(CRT_GET_RFIB_TEXT) || defined(CRT_GET_RFIB_DATA)
120 + void *tbase, *dbase;
122 +# ifdef CRT_GET_RFIB_TEXT
123 + CRT_GET_RFIB_TEXT (tbase);
127 +# ifdef CRT_GET_RFIB_DATA
128 + CRT_GET_RFIB_DATA (dbase);
132 + __register_frame_info_bases (__EH_FRAME_BEGIN__, &ob, tbase, dbase);
134 __register_frame_info (__EH_FRAME_BEGIN__, &ob);
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__);
146 __deregister_frame_info (__EH_FRAME_BEGIN__);
149 __deregister_frame (__EH_FRAME_BEGIN__);
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 {
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;
162 # functions used in other libraries
163 @@ -17,6 +20,12 @@ libc {
167 +%ifdef EXPORT_UNWIND_FIND_FDE
169 + __register_frame_info_bases; __deregister_frame_info_bases;
170 + __register_frame_info_table_bases; _Unwind_Find_FDE;
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
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.
194 - printf("%s %s %s\n", actlib, actver, $0) | sort;
196 + # Ensure GLIBC_ versions come always first
197 + sub(/^GLIBC_/," GLIBC_",sortver)
198 + printf("%s %s %s\n", actlib, sortver, $0) | sort;
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
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.
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.
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.
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
224 +#define FIRST_PSEUDO_REGISTER 64
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
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.
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.
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.
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
249 +#define FIRST_PSEUDO_REGISTER 27
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
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).
262 +This file is part of GNU CC.
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)
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.
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. */
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. */
285 +/* This file is shared between GCC and GDB, and should not contain
288 +/* Tag names and codes. */
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
350 +#define DW_TAG_lo_user 0x4080
351 +#define DW_TAG_hi_user 0xffff
353 +/* flag that tells whether entry has a child or not */
354 +#define DW_children_no 0
355 +#define DW_children_yes 1
357 +/* Form names and codes. */
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
383 +/* Attribute names and codes. */
385 +enum dwarf_attribute
387 + DW_AT_sibling = 0x01,
388 + DW_AT_location = 0x02,
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,
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
470 +#define DW_AT_lo_user 0x2000 /* implementation-defined range start */
471 +#define DW_AT_hi_user 0x3ff0 /* implementation-defined range end */
473 +/* Location atom names and codes. */
475 +enum dwarf_location_atom
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,
495 + DW_OP_xderef = 0x18,
499 + DW_OP_minus = 0x1c,
506 + DW_OP_plus_uconst = 0x23,
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,
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,
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,
624 +#define DW_OP_lo_user 0x80 /* implementation-defined range start */
625 +#define DW_OP_hi_user 0xff /* implementation-defined range end */
627 +/* Type encodings. */
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
642 +#define DW_ATE_lo_user 0x80
643 +#define DW_ATE_hi_user 0xff
645 +/* Array ordering names and codes. */
646 +enum dwarf_array_dim_ordering
648 + DW_ORD_row_major = 0,
649 + DW_ORD_col_major = 1
652 +/* access attribute */
653 +enum dwarf_access_attribute
655 + DW_ACCESS_public = 1,
656 + DW_ACCESS_protected = 2,
657 + DW_ACCESS_private = 3
661 +enum dwarf_visibility_attribute
664 + DW_VIS_exported = 2,
665 + DW_VIS_qualified = 3
669 +enum dwarf_virtuality_attribute
671 + DW_VIRTUALITY_none = 0,
672 + DW_VIRTUALITY_virtual = 1,
673 + DW_VIRTUALITY_pure_virtual = 2
676 +/* case sensitivity */
679 + DW_ID_case_sensitive = 0,
681 + DW_ID_down_case = 2,
682 + DW_ID_case_insensitive = 3
685 +/* calling convention */
686 +enum dwarf_calling_convention
688 + DW_CC_normal = 0x1,
689 + DW_CC_program = 0x2,
693 +#define DW_CC_lo_user 0x40
694 +#define DW_CC_hi_user 0xff
696 +/* inline attribute */
697 +enum dwarf_inline_attribute
699 + DW_INL_not_inlined = 0,
700 + DW_INL_inlined = 1,
701 + DW_INL_declared_not_inlined = 2,
702 + DW_INL_declared_inlined = 3
705 +/* discriminant lists */
706 +enum dwarf_discrim_list
712 +/* line number opcodes */
713 +enum dwarf_line_number_ops
715 + DW_LNS_extended_op = 0,
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
727 +/* line number extended opcodes */
728 +enum dwarf_line_number_x_ops
730 + DW_LNE_end_sequence = 1,
731 + DW_LNE_set_address = 2,
732 + DW_LNE_define_file = 3
735 +/* call frame information */
736 +enum dwarf_call_frame_info
738 + DW_CFA_advance_loc = 0x40,
739 + DW_CFA_offset = 0x80,
740 + DW_CFA_restore = 0xc0,
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,
759 + DW_CFA_offset_extended_sf = 0x11,
760 + DW_CFA_def_cfa_sf = 0x12,
761 + DW_CFA_def_cfa_offset_sf = 0x13,
763 + /* SGI/MIPS specific */
764 + DW_CFA_MIPS_advance_loc8 = 0x1d,
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
772 +#define DW_CIE_ID 0xffffffff
773 +#define DW_CIE_VERSION 1
775 +#define DW_CFA_extended 0
776 +#define DW_CFA_low_user 0x1c
777 +#define DW_CFA_high_user 0x3f
779 +#define DW_CHILDREN_no 0x00
780 +#define DW_CHILDREN_yes 0x01
782 +#define DW_ADDR_none 0
784 +/* Source language names and codes. */
786 +enum dwarf_source_language
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
803 +#define DW_LANG_lo_user 0x8000 /* implementation-defined range start */
804 +#define DW_LANG_hi_user 0xffff /* implementation-defined range start */
806 +/* Names and codes for macro information. */
808 +enum dwarf_macinfo_record_type
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
818 +/* @@@ For use with GNU frame unwind information. */
820 +#define DW_EH_PE_absptr 0x00
821 +#define DW_EH_PE_omit 0xff
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
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
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
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.
848 The GNU C Library is free software; you can redistribute it and/or
850 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
853 -/* This must match what's in frame.h in gcc. */
854 +#include <sys/types.h>
865 - __SIZE_TYPE__ count;
869 + struct dwarf_fde *single;
870 + struct dwarf_fde **array;
871 + struct fde_vector *sort;
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;
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
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>.
896 +This file is part of GNU CC.
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)
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
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.
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. */
925 +#include <bits/libc-lock.h>
928 +#define NO_BASE_OF_ENCODED_VALUE
929 +#include <unwind-pe.h>
930 +#include <unwind-dw2-fde.h>
932 +#include "tconfig.h"
933 +#include "tsystem.h"
936 +#define NO_BASE_OF_ENCODED_VALUE
937 +#include "unwind-pe.h"
938 +#include "unwind-dw2-fde.h"
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;
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))
958 +#ifdef __GTHREAD_MUTEX_INIT
959 +static __gthread_mutex_t object_mutex = __GTHREAD_MUTEX_INIT;
961 +static __gthread_mutex_t object_mutex;
964 +#ifdef __GTHREAD_MUTEX_INIT_FUNCTION
966 +init_object_mutex (void)
968 + __GTHREAD_MUTEX_INIT_FUNCTION (&object_mutex);
972 +init_object_mutex_once (void)
974 + static __gthread_once_t once = __GTHREAD_ONCE_INIT;
975 + __gthread_once (&once, init_object_mutex);
978 +#define init_object_mutex_once()
983 +/* Called from crtbegin.o to register the unwind info for an object. */
986 +__register_frame_info_bases (void *begin, struct object *ob,
987 + void *tbase, void *dbase)
989 + ob->pc_begin = (void *)-1;
992 + ob->u.single = begin;
994 + ob->s.b.encoding = DW_EH_PE_omit;
996 + init_object_mutex_once ();
997 + __gthread_mutex_lock (&object_mutex);
999 + ob->next = unseen_objects;
1000 + unseen_objects = ob;
1002 + __gthread_mutex_unlock (&object_mutex);
1006 +__register_frame_info (void *begin, struct object *ob)
1008 + __register_frame_info_bases (begin, ob, 0, 0);
1012 +__register_frame (void *begin)
1014 + struct object *ob = (struct object *) malloc (sizeof (struct object));
1015 + __register_frame_info (begin, ob);
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
1023 +__register_frame_info_table_bases (void *begin, struct object *ob,
1024 + void *tbase, void *dbase)
1026 + ob->pc_begin = (void *)-1;
1027 + ob->tbase = tbase;
1028 + ob->dbase = dbase;
1029 + ob->u.array = begin;
1031 + ob->s.b.from_array = 1;
1032 + ob->s.b.encoding = DW_EH_PE_omit;
1034 + init_object_mutex_once ();
1035 + __gthread_mutex_lock (&object_mutex);
1037 + ob->next = unseen_objects;
1038 + unseen_objects = ob;
1040 + __gthread_mutex_unlock (&object_mutex);
1044 +__register_frame_info_table (void *begin, struct object *ob)
1046 + __register_frame_info_table_bases (begin, ob, 0, 0);
1050 +__register_frame_table (void *begin)
1052 + struct object *ob = (struct object *) malloc (sizeof (struct object));
1053 + __register_frame_info_table (begin, ob);
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.
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. */
1069 +__deregister_frame_info_bases (void *begin)
1071 + struct object **p;
1072 + struct object *ob = 0;
1074 + init_object_mutex_once ();
1075 + __gthread_mutex_lock (&object_mutex);
1077 + for (p = &unseen_objects; *p ; p = &(*p)->next)
1078 + if ((*p)->u.single == begin)
1085 + for (p = &seen_objects; *p ; p = &(*p)->next)
1086 + if ((*p)->s.b.sorted)
1088 + if ((*p)->u.sort->orig_data == begin)
1092 + free (ob->u.sort);
1098 + if ((*p)->u.single == begin)
1106 + __gthread_mutex_unlock (&object_mutex);
1110 + __gthread_mutex_unlock (&object_mutex);
1111 + return (void *) ob;
1115 +__deregister_frame_info (void *begin)
1117 + return __deregister_frame_info_bases (begin);
1121 +__deregister_frame (void *begin)
1123 + free (__deregister_frame_info (begin));
1127 +/* Like base_of_encoded_value, but take the base from a struct object
1128 + instead of an _Unwind_Context. */
1131 +base_from_object (unsigned char encoding, struct object *ob)
1133 + if (encoding == DW_EH_PE_omit)
1136 + switch (encoding & 0x70)
1138 + case DW_EH_PE_absptr:
1139 + case DW_EH_PE_pcrel:
1140 + case DW_EH_PE_aligned:
1143 + case DW_EH_PE_textrel:
1144 + return (_Unwind_Ptr) ob->tbase;
1145 + case DW_EH_PE_datarel:
1146 + return (_Unwind_Ptr) ob->dbase;
1151 +/* Return the FDE pointer encoding from the CIE. */
1152 +/* ??? This is a subset of extract_cie_info from unwind-dw2.c. */
1155 +get_cie_encoding (struct dwarf_cie *cie)
1157 + const unsigned char *aug, *p;
1158 + _Unwind_Ptr dummy;
1160 + aug = cie->augmentation;
1161 + if (aug[0] != 'z')
1162 + return DW_EH_PE_absptr;
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. */
1169 + aug++; /* Skip 'z' */
1170 + p = read_uleb128 (p, &dummy); /* Skip augmentation length. */
1173 + /* This is what we're looking for. */
1176 + /* Personality encoding and pointer. */
1177 + else if (*aug == 'P')
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);
1184 + /* LSDA encoding. */
1185 + else if (*aug == 'L')
1187 + /* Otherwise end of string, or unknown augmentation. */
1189 + return DW_EH_PE_absptr;
1195 +get_fde_encoding (struct dwarf_fde *f)
1197 + return get_cie_encoding (get_cie (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.) */
1205 +/* Comparison routines. Three variants of increasing complexity. */
1208 +fde_unencoded_compare (struct object *ob __attribute__((unused)),
1211 + return *(saddr *)x->pc_begin - *(saddr *)y->pc_begin;
1215 +fde_single_encoding_compare (struct object *ob, fde *x, fde *y)
1217 + _Unwind_Ptr base, x_ptr, y_ptr;
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);
1223 + return x_ptr - y_ptr;
1227 +fde_mixed_encoding_compare (struct object *ob, fde *x, fde *y)
1229 + int x_encoding, y_encoding;
1230 + _Unwind_Ptr x_ptr, y_ptr;
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);
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);
1240 + return x_ptr - y_ptr;
1243 +typedef saddr (*fde_compare_t) (struct object *, fde *, fde *);
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. */
1257 +struct fde_accumulator
1259 + struct fde_vector *linear;
1260 + struct fde_vector *erratic;
1264 +start_fde_sort (struct fde_accumulator *accu, size_t count)
1270 + size = sizeof (struct fde_vector) + sizeof (fde *) * count;
1271 + if ((accu->linear = (struct fde_vector *) malloc (size)))
1273 + accu->linear->count = 0;
1274 + if ((accu->erratic = (struct fde_vector *) malloc (size)))
1275 + accu->erratic->count = 0;
1283 +fde_insert (struct fde_accumulator *accu, fde *this_fde)
1286 + accu->linear->array[accu->linear->count++] = this_fde;
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).
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. */
1302 +fde_split (struct object *ob, fde_compare_t fde_compare,
1303 + struct fde_vector *linear, struct fde_vector *erratic)
1305 + static fde *marker;
1306 + size_t count = linear->count;
1307 + fde **chain_end = ▮
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 **))
1316 + for (i = 0; i < count; i++)
1320 + for (probe = chain_end;
1321 + probe != &marker && fde_compare (ob, linear->array[i], *probe) < 0;
1322 + probe = chain_end)
1324 + chain_end = (fde **)erratic->array[probe - linear->array];
1325 + erratic->array[probe - linear->array] = NULL;
1327 + erratic->array[i] = (fde *)chain_end;
1328 + chain_end = &linear->array[i];
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];
1338 + erratic->array[k++] = linear->array[i];
1339 + linear->count = j;
1340 + erratic->count = k;
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. */
1347 +frame_heapsort (struct object *ob, fde_compare_t fde_compare,
1348 + struct fde_vector *erratic)
1350 + /* For a description of this algorithm, see:
1351 + Samuel P. Harbison, Guy L. Steele Jr.: C, a reference manual, 2nd ed.,
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;
1364 + /* Invariant: a[m..n-1] is a heap. */
1366 + for (i = m; 2*i+1 < 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)
1372 + SWAP (a[i], a[2*i+2]);
1375 + else if (fde_compare (ob, a[2*i+1], a[i]) > 0)
1377 + SWAP (a[i], a[2*i+1]);
1386 + /* Invariant: a[0..n-1] is a heap. */
1388 + SWAP (a[0], a[n]);
1389 + for (i = 0; 2*i+1 < 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)
1395 + SWAP (a[i], a[2*i+2]);
1398 + else if (fde_compare (ob, a[2*i+1], a[i]) > 0)
1400 + SWAP (a[i], a[2*i+1]);
1410 +/* Merge V1 and V2, both sorted, and put the result into V1. */
1412 +fde_merge (struct object *ob, fde_compare_t fde_compare,
1413 + struct fde_vector *v1, struct fde_vector *v2)
1424 + fde2 = v2->array[i2];
1425 + while (i1 > 0 && fde_compare (ob, v1->array[i1-1], fde2) > 0)
1427 + v1->array[i1+i2] = v1->array[i1-1];
1430 + v1->array[i1+i2] = fde2;
1432 + v1->count += v2->count;
1437 +end_fde_sort (struct object *ob, struct fde_accumulator *accu, size_t count)
1439 + fde_compare_t fde_compare;
1441 + if (accu->linear && accu->linear->count != count)
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;
1449 + fde_compare = fde_single_encoding_compare;
1451 + if (accu->erratic)
1453 + fde_split (ob, fde_compare, accu->linear, accu->erratic);
1454 + if (accu->linear->count + accu->erratic->count != count)
1456 + frame_heapsort (ob, fde_compare, accu->erratic);
1457 + fde_merge (ob, fde_compare, accu->linear, accu->erratic);
1458 + free (accu->erratic);
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);
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. */
1474 +classify_object_over_fdes (struct object *ob, fde *this_fde)
1476 + struct dwarf_cie *last_cie = 0;
1478 + int encoding = DW_EH_PE_absptr;
1479 + _Unwind_Ptr base = 0;
1481 + for (; this_fde->length != 0; this_fde = next_fde (this_fde))
1483 + struct dwarf_cie *this_cie;
1484 + _Unwind_Ptr mask, pc_begin;
1487 + if (this_fde->CIE_delta == 0)
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)
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;
1504 + read_encoded_value_with_base (encoding, base, this_fde->pc_begin,
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;
1517 + if ((pc_begin & mask) == 0)
1521 + if ((void *)pc_begin < ob->pc_begin)
1522 + ob->pc_begin = (void *)pc_begin;
1529 +add_fdes (struct object *ob, struct fde_accumulator *accu, fde *this_fde)
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);
1535 + for (; this_fde->length != 0; this_fde = next_fde (this_fde))
1537 + struct dwarf_cie *this_cie;
1540 + if (this_fde->CIE_delta == 0)
1543 + if (ob->s.b.mixed_encoding)
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)
1550 + last_cie = this_cie;
1551 + encoding = get_cie_encoding (this_cie);
1552 + base = base_from_object (encoding, ob);
1556 + if (encoding == DW_EH_PE_absptr)
1558 + if (*(_Unwind_Ptr *)this_fde->pc_begin == 0)
1563 + _Unwind_Ptr pc_begin, mask;
1565 + read_encoded_value_with_base (encoding, base, this_fde->pc_begin,
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;
1578 + if ((pc_begin & mask) == 0)
1582 + fde_insert (accu, this_fde);
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. */
1592 +init_object (struct object* ob)
1594 + struct fde_accumulator accu;
1597 + count = ob->s.b.count;
1600 + if (ob->s.b.from_array)
1602 + fde **p = ob->u.array;
1603 + for (count = 0; *p; ++p)
1604 + count += classify_object_over_fdes (ob, *p);
1607 + count = classify_object_over_fdes (ob, ob->u.single);
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;
1619 + if (!start_fde_sort (&accu, count))
1622 + if (ob->s.b.from_array)
1625 + for (p = ob->u.array; *p; ++p)
1626 + add_fdes (ob, &accu, *p);
1629 + add_fdes (ob, &accu, ob->u.single);
1631 + end_fde_sort (ob, &accu, count);
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;
1638 + ob->s.b.sorted = 1;
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
1646 +linear_search_fdes (struct object *ob, fde *this_fde, void *pc)
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);
1652 + for (; this_fde->length != 0; this_fde = next_fde (this_fde))
1654 + struct dwarf_cie *this_cie;
1655 + _Unwind_Ptr pc_begin, pc_range;
1658 + if (this_fde->CIE_delta == 0)
1661 + if (ob->s.b.mixed_encoding)
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)
1668 + last_cie = this_cie;
1669 + encoding = get_cie_encoding (this_cie);
1670 + base = base_from_object (encoding, ob);
1674 + if (encoding == DW_EH_PE_absptr)
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)
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);
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;
1700 + if ((pc_begin & mask) == 0)
1704 + if ((_Unwind_Ptr)pc - pc_begin < pc_range)
1711 +/* Binary search for an FDE containing the given PC. Here are three
1712 + implementations of increasing complexity. */
1714 +static inline fde *
1715 +binary_search_unencoded_fdes (struct object *ob, void *pc)
1717 + struct fde_vector *vec = ob->u.sort;
1720 + for (lo = 0, hi = vec->count; lo < hi; )
1722 + size_t i = (lo + hi) / 2;
1723 + fde *f = vec->array[i];
1727 + pc_begin = ((void **)f->pc_begin)[0];
1728 + pc_range = ((uaddr *)f->pc_begin)[1];
1730 + if (pc < pc_begin)
1732 + else if (pc >= pc_begin + pc_range)
1741 +static inline fde *
1742 +binary_search_single_encoding_fdes (struct object *ob, void *pc)
1744 + struct fde_vector *vec = ob->u.sort;
1745 + int encoding = ob->s.b.encoding;
1746 + _Unwind_Ptr base = base_from_object (encoding, ob);
1749 + for (lo = 0, hi = vec->count; lo < hi; )
1751 + size_t i = (lo + hi) / 2;
1752 + fde *f = vec->array[i];
1753 + _Unwind_Ptr pc_begin, pc_range;
1756 + p = read_encoded_value_with_base (encoding, base, f->pc_begin,
1758 + read_encoded_value_with_base (encoding & 0x0F, 0, p, &pc_range);
1760 + if ((_Unwind_Ptr)pc < pc_begin)
1762 + else if ((_Unwind_Ptr)pc >= pc_begin + pc_range)
1771 +static inline fde *
1772 +binary_search_mixed_encoding_fdes (struct object *ob, void *pc)
1774 + struct fde_vector *vec = ob->u.sort;
1777 + for (lo = 0, hi = vec->count; lo < hi; )
1779 + size_t i = (lo + hi) / 2;
1780 + fde *f = vec->array[i];
1781 + _Unwind_Ptr pc_begin, pc_range;
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);
1791 + if ((_Unwind_Ptr)pc < pc_begin)
1793 + else if ((_Unwind_Ptr)pc >= pc_begin + pc_range)
1803 +search_object (struct object* ob, void *pc)
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)
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)
1818 + if (ob->s.b.sorted)
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);
1825 + return binary_search_single_encoding_fdes (ob, pc);
1829 + /* Long slow labourious linear search, cos we've no memory. */
1830 + if (ob->s.b.from_array)
1833 + for (p = ob->u.array; *p ; p++)
1835 + fde *f = linear_search_fdes (ob, *p, pc);
1842 + return linear_search_fdes (ob, ob->u.single, pc);
1847 +_Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases)
1849 + struct object *ob;
1852 + init_object_mutex_once ();
1853 + __gthread_mutex_lock (&object_mutex);
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)
1861 + f = search_object (ob, pc);
1867 + /* Classify and search the objects we've not yet processed. */
1868 + while ((ob = unseen_objects))
1870 + struct object **p;
1872 + unseen_objects = ob->next;
1873 + f = search_object (ob, pc);
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)
1887 + __gthread_mutex_unlock (&object_mutex);
1893 + bases->tbase = ob->tbase;
1894 + bases->dbase = ob->dbase;
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);
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
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>.
1912 +This file is part of GNU CC.
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)
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
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.
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. */
1943 + struct dwarf_fde *array __flexarr;
1947 +#include <gccframe.h>
1955 + struct dwarf_fde *single;
1956 + struct dwarf_fde **array;
1957 + struct fde_vector *sort;
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;
1973 + struct object *next;
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. */
1985 + struct dwarf_fde *fde_begin;
1986 + struct dwarf_fde **fde_array;
1988 + struct old_object *next;
1991 +struct dwarf_eh_bases
1999 +extern void __register_frame_info_bases (void *, struct object *,
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 *,
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 *);
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;
2019 + CIE - Common Information Element
2020 + FDE - Frame Descriptor Element
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.
2026 + The data structures are defined in the DWARF specfication, although
2027 + not in a very readable way (see LITERATURE).
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
2034 + b) using the FDE table for that shared object, locate the FDE using
2035 + binary search (which requires the sorting). */
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. */
2045 + unsigned char augmentation __flexarr;
2046 +} __attribute__ ((packed, aligned (__alignof__ (void *))));
2048 +/* The first few fields of an FDE. */
2053 + unsigned char pc_begin __flexarr;
2054 +} __attribute__ ((packed, aligned (__alignof__ (void *))));
2056 +typedef struct dwarf_fde fde;
2058 +/* Locate the CIE for a given FDE. */
2060 +static inline struct dwarf_cie *
2061 +get_cie (struct dwarf_fde *f)
2063 + return (void *)&f->CIE_delta - f->CIE_delta;
2066 +static inline fde *
2069 + return (fde *)((char *)f + f->length + sizeof (f->length));
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
2076 +/* DWARF2 exception handling and frame unwind runtime interface routines.
2077 + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
2079 + This file is part of GNU CC.
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.
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.
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. */
2097 +#include <stdlib.h>
2098 +#include <string.h>
2100 +#include <libintl.h>
2101 +#include <dwarf2.h>
2102 +#include <unwind.h>
2103 +#include <unwind-pe.h>
2104 +#include <unwind-dw2-fde.h>
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"
2115 +#if !USING_SJLJ_EXCEPTIONS
2117 +#ifndef STACK_GROWS_DOWNWARD
2118 +#define STACK_GROWS_DOWNWARD 0
2120 +#undef STACK_GROWS_DOWNWARD
2121 +#define STACK_GROWS_DOWNWARD 1
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
2130 +/* This is the register and unwind state for a particular frame. */
2131 +struct _Unwind_Context
2133 + void *reg[DWARF_FRAME_REGISTERS+1];
2137 + struct dwarf_eh_bases bases;
2138 + _Unwind_Word args_size;
2142 +/* Byte size of every register managed by these routines. */
2143 +static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS];
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. */
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
2159 + _Unwind_Sword offset;
2160 + const unsigned char *exp;
2168 + } reg[DWARF_FRAME_REGISTERS+1];
2170 + /* Used to implement DW_CFA_remember_state. */
2171 + struct frame_state_reg_info *prev;
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;
2185 + /* The PC described by the current frame state. */
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;
2197 +} _Unwind_FrameState;
2199 +/* Read unaligned data from the instruction buffer. */
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));
2212 +static inline void *
2213 +read_pointer (const void *p) { const union unaligned *up = p; return up->p; }
2216 +read_1u (const void *p) { return *(const unsigned char *)p; }
2219 +read_1s (const void *p) { return *(const signed char *)p; }
2222 +read_2u (const void *p) { const union unaligned *up = p; return up->u2; }
2225 +read_2s (const void *p) { const union unaligned *up = p; return up->s2; }
2227 +static inline unsigned int
2228 +read_4u (const void *p) { const union unaligned *up = p; return up->u4; }
2231 +read_4s (const void *p) { const union unaligned *up = p; return up->s4; }
2233 +static inline unsigned long
2234 +read_8u (const void *p) { const union unaligned *up = p; return up->u8; }
2236 +static inline unsigned long
2237 +read_8s (const void *p) { const union unaligned *up = p; return up->s8; }
2239 +/* Get the value of register REG as saved in CONTEXT. */
2241 +inline _Unwind_Word
2242 +_Unwind_GetGR (struct _Unwind_Context *context, int index)
2244 + /* This will segfault if the register hasn't been saved. */
2245 + return * (_Unwind_Word *) context->reg[index];
2248 +/* Overwrite the saved value for register REG in CONTEXT with VAL. */
2251 +_Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val)
2253 + * (_Unwind_Word *) context->reg[index] = val;
2256 +/* Retrieve the return address for CONTEXT. */
2259 +_Unwind_GetIP (struct _Unwind_Context *context)
2261 + return (_Unwind_Ptr) context->ra;
2264 +/* Overwrite the return address for CONTEXT with VAL. */
2267 +_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
2269 + context->ra = (void *) val;
2273 +_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
2275 + return context->lsda;
2279 +_Unwind_GetRegionStart (struct _Unwind_Context *context)
2281 + return (_Unwind_Ptr) context->bases.func;
2286 +_Unwind_GetDataRelBase (struct _Unwind_Context *context)
2288 + return (_Unwind_Ptr) context->bases.dbase;
2292 +_Unwind_GetTextRelBase (struct _Unwind_Context *context)
2294 + return (_Unwind_Ptr) context->bases.tbase;
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. */
2302 +static const unsigned char *
2303 +extract_cie_info (struct dwarf_cie *cie, struct _Unwind_Context *context,
2304 + _Unwind_FrameState *fs)
2306 + const unsigned char *aug = cie->augmentation;
2307 + const unsigned char *p = aug + strlen (aug) + 1;
2308 + const unsigned char *ret = NULL;
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')
2315 + fs->eh_ptr = read_pointer (p);
2316 + p += sizeof (void *);
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;
2327 + /* If the augmentation starts with 'z', then a uleb128 immediately
2328 + follows containing the length of the augmentation field following
2332 + p = read_uleb128 (p, &tmp);
2339 + /* Iterate over recognized augmentation subsequences. */
2340 + while (*aug != '\0')
2342 + /* "L" indicates a byte showing how the LSDA pointer is encoded. */
2343 + if (aug[0] == 'L')
2345 + fs->lsda_encoding = *p++;
2349 + /* "R" indicates a byte indicating how FDE addresses are encoded. */
2350 + else if (aug[0] == 'R')
2352 + fs->fde_encoding = *p++;
2356 + /* "P" indicates a personality routine in the CIE augmentation. */
2357 + else if (aug[0] == 'P')
2359 + p = read_encoded_value (context, *p, p + 1,
2360 + (_Unwind_Ptr *) &fs->personality);
2364 + /* Otherwise we have an unknown augmentation string.
2365 + Bail unless we saw a 'z' prefix. */
2370 + return ret ? ret : p;
2374 +/* Decode a DW_OP stack program. Return the top of stack. Push INITIAL
2375 + onto the stack to start. */
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)
2381 + _Unwind_Word stack[64]; /* ??? Assume this is enough. */
2384 + stack[0] = initial;
2387 + while (op_ptr < op_end)
2389 + enum dwarf_location_atom op = *op_ptr++;
2390 + _Unwind_Word result = 0, reg;
2391 + _Unwind_Sword offset;
2392 + _Unwind_Ptr ptrtmp;
2428 + result = op - DW_OP_lit0;
2432 + result = (_Unwind_Word) (_Unwind_Ptr) read_pointer (op_ptr);
2433 + op_ptr += sizeof (void *);
2436 + case DW_OP_const1u:
2437 + result = read_1u (op_ptr);
2440 + case DW_OP_const1s:
2441 + result = read_1s (op_ptr);
2444 + case DW_OP_const2u:
2445 + result = read_2u (op_ptr);
2448 + case DW_OP_const2s:
2449 + result = read_2s (op_ptr);
2452 + case DW_OP_const4u:
2453 + result = read_4u (op_ptr);
2456 + case DW_OP_const4s:
2457 + result = read_4s (op_ptr);
2460 + case DW_OP_const8u:
2461 + result = read_8u (op_ptr);
2464 + case DW_OP_const8s:
2465 + result = read_8s (op_ptr);
2468 + case DW_OP_constu:
2469 + op_ptr = read_uleb128 (op_ptr, &ptrtmp);
2472 + case DW_OP_consts:
2473 + op_ptr = read_sleb128 (op_ptr, &ptrtmp);
2474 + result = (saddr)ptrtmp;
2509 + result = _Unwind_GetGR (context, op - DW_OP_reg0);
2512 + op_ptr = read_uleb128 (op_ptr, &ptrtmp); reg = ptrtmp;
2513 + result = _Unwind_GetGR (context, reg);
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;
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;
2558 + if (stack_elt < 1)
2560 + result = stack[stack_elt - 1];
2564 + if (--stack_elt < 0)
2569 + offset = *op_ptr++;
2570 + if (offset >= stack_elt - 1)
2572 + result = stack[stack_elt - 1 - offset];
2576 + if (stack_elt < 2)
2578 + result = stack[stack_elt - 2];
2583 + _Unwind_Word t1, t2, t3;
2585 + if (stack_elt < 3)
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;
2597 + case DW_OP_deref_size:
2601 + case DW_OP_plus_uconst:
2602 + /* Unary operations. */
2603 + if (--stack_elt < 0)
2605 + result = stack[stack_elt];
2611 + void *ptr = (void *)(_Unwind_Ptr) result;
2612 + result = (_Unwind_Ptr) read_pointer (ptr);
2616 + case DW_OP_deref_size:
2618 + void *ptr = (void *)(_Unwind_Ptr) result;
2619 + switch (*op_ptr++)
2622 + result = read_1u (ptr);
2625 + result = read_2u (ptr);
2628 + result = read_4u (ptr);
2631 + result = read_8u (ptr);
2640 + if ((_Unwind_Sword) result < 0)
2649 + case DW_OP_plus_uconst:
2650 + op_ptr = read_uleb128 (op_ptr, &ptrtmp); reg = ptrtmp;
2653 + /* Avoid warnings. */
2673 + /* Binary operations. */
2674 + _Unwind_Word first, second;
2675 + if ((stack_elt -= 2) < 0)
2677 + second = stack[stack_elt];
2678 + first = stack[stack_elt + 1];
2683 + result = second & first;
2686 + result = (_Unwind_Sword)second / (_Unwind_Sword)first;
2689 + result = second - first;
2692 + result = (_Unwind_Sword)second % (_Unwind_Sword)first;
2695 + result = second * first;
2698 + result = second | first;
2701 + result = second + first;
2704 + result = second << first;
2707 + result = second >> first;
2710 + result = (_Unwind_Sword)second >> first;
2713 + result = second ^ first;
2716 + result = (_Unwind_Sword)first <= (_Unwind_Sword)second;
2719 + result = (_Unwind_Sword)first >= (_Unwind_Sword)second;
2722 + result = (_Unwind_Sword)first == (_Unwind_Sword)second;
2725 + result = (_Unwind_Sword)first < (_Unwind_Sword)second;
2728 + result = (_Unwind_Sword)first > (_Unwind_Sword)second;
2731 + result = (_Unwind_Sword)first != (_Unwind_Sword)second;
2734 + /* Avoid warnings. */
2741 + offset = read_2s (op_ptr);
2747 + if (--stack_elt < 0)
2749 + offset = read_2s (op_ptr);
2751 + if (stack[stack_elt] != 0)
2762 + /* Most things push a result value. */
2763 + if ((size_t) stack_elt >= sizeof(stack)/sizeof(*stack))
2765 + stack[++stack_elt] = result;
2769 + /* We were executing this program to get a value. It should be
2770 + at top of stack. */
2771 + if (--stack_elt < 0)
2773 + return stack[stack_elt];
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. */
2782 +execute_cfa_program (const unsigned char *insn_ptr,
2783 + const unsigned char *insn_end,
2784 + struct _Unwind_Context *context,
2785 + _Unwind_FrameState *fs)
2787 + struct frame_state_reg_info *unused_rs = NULL;
2789 + /* Don't allow remember/restore between CIE and FDE programs. */
2790 + fs->regs.prev = NULL;
2792 + while (insn_ptr < insn_end && fs->pc < context->ra)
2794 + unsigned char insn = *insn_ptr++;
2796 + _Unwind_Sword offset;
2797 + _Unwind_Ptr ptrtmp;
2799 + if (insn & DW_CFA_advance_loc)
2800 + fs->pc += (insn & 0x3f) * fs->code_align;
2801 + else if (insn & DW_CFA_offset)
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;
2809 + else if (insn & DW_CFA_restore)
2811 + reg = insn & 0x3f;
2812 + fs->regs.reg[reg].how = REG_UNSAVED;
2814 + else switch (insn)
2816 + case DW_CFA_set_loc:
2817 + insn_ptr = read_encoded_value (context, fs->fde_encoding,
2818 + insn_ptr, (_Unwind_Ptr *) &fs->pc);
2821 + case DW_CFA_advance_loc1:
2822 + fs->pc += read_1u (insn_ptr) * fs->code_align;
2825 + case DW_CFA_advance_loc2:
2826 + fs->pc += read_2u (insn_ptr) * fs->code_align;
2829 + case DW_CFA_advance_loc4:
2830 + fs->pc += read_4u (insn_ptr) * fs->code_align;
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;
2842 + case DW_CFA_restore_extended:
2843 + insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
2844 + fs->regs.reg[reg].how = REG_UNSAVED;
2847 + case DW_CFA_undefined:
2848 + case DW_CFA_same_value:
2852 + case DW_CFA_register:
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;
2862 + case DW_CFA_remember_state:
2864 + struct frame_state_reg_info *new_rs;
2867 + new_rs = unused_rs;
2868 + unused_rs = unused_rs->prev;
2871 + new_rs = alloca (sizeof (struct frame_state_reg_info));
2873 + *new_rs = fs->regs;
2874 + fs->regs.prev = new_rs;
2878 + case DW_CFA_restore_state:
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;
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;
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;
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. */
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;
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;
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;
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;
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. */
2945 + case DW_CFA_GNU_window_save:
2946 + /* ??? Hardcoded for SPARC register window configuration. */
2947 + for (reg = 16; reg < 32; ++reg)
2949 + fs->regs.reg[reg].how = REG_SAVED_OFFSET;
2950 + fs->regs.reg[reg].loc.offset = (reg - 16) * sizeof (void *);
2954 + case DW_CFA_GNU_args_size:
2955 + insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
2956 + context->args_size = ptrtmp;
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;
2975 +static _Unwind_Reason_Code
2976 +uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
2978 + struct dwarf_fde *fde;
2979 + struct dwarf_cie *cie;
2980 + const unsigned char *aug, *insn, *end;
2982 + memset (fs, 0, sizeof (*fs));
2983 + context->args_size = 0;
2984 + context->lsda = 0;
2986 + fde = _Unwind_Find_FDE (context->ra - 1, &context->bases);
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;
2996 + return _URC_NO_REASON;
2998 + return _URC_END_OF_STACK;
3002 + fs->pc = context->bases.func;
3004 + cie = get_cie (fde);
3005 + insn = extract_cie_info (cie, context, fs);
3007 + /* CIE contained unknown augmentation. */
3008 + return _URC_FATAL_PHASE1_ERROR;
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);
3014 + /* Locate augmentation for the fde. */
3015 + aug = (unsigned char *)fde + sizeof (*fde);
3016 + aug += 2 * size_of_encoded_value (fs->fde_encoding);
3021 + aug = read_uleb128 (aug, &i);
3024 + if (fs->lsda_encoding != DW_EH_PE_omit)
3025 + aug = read_encoded_value (context, fs->lsda_encoding, aug,
3026 + (_Unwind_Ptr *) &context->lsda);
3028 + /* Then the insns in the FDE up to our target PC. */
3031 + end = (unsigned char *) next_fde (fde);
3032 + execute_cfa_program (insn, end, context, fs);
3034 + return _URC_NO_REASON;
3037 +typedef struct frame_state
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];
3049 +struct frame_state * __frame_state_for (void *, struct frame_state *);
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. */
3055 +struct frame_state *
3056 +__frame_state_for (void *pc_target, struct frame_state *state_in)
3058 + struct _Unwind_Context context;
3059 + _Unwind_FrameState fs;
3062 + memset (&context, 0, sizeof (struct _Unwind_Context));
3063 + context.ra = pc_target + 1;
3065 + if (uw_frame_state_for (&context, &fs) != _URC_NO_REASON)
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)
3073 + for (reg = 0; reg < DWARF_FRAME_REGISTERS + 1; reg++)
3075 + state_in->saved[reg] = fs.regs.reg[reg].how;
3076 + switch (state_in->saved[reg])
3078 + case REG_SAVED_REG:
3079 + state_in->reg_or_offset[reg] = fs.regs.reg[reg].loc.reg;
3081 + case REG_SAVED_OFFSET:
3082 + state_in->reg_or_offset[reg] = fs.regs.reg[reg].loc.offset;
3085 + state_in->reg_or_offset[reg] = 0;
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;
3102 +uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs)
3104 + struct _Unwind_Context orig_context = *context;
3108 + /* Compute this frame's CFA. */
3109 + switch (fs->cfa_how)
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;
3120 + cfa = (void *) (_Unwind_Ptr) _Unwind_GetGR (context, fs->cfa_reg);
3121 + cfa += fs->cfa_offset;
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. */
3130 + const unsigned char *exp = fs->cfa_exp;
3133 + exp = read_uleb128 (exp, &len);
3134 + cfa = (void *) (_Unwind_Ptr)
3135 + execute_stack_op (exp, exp + len, context, 0);
3142 + context->cfa = cfa;
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)
3150 + case REG_SAVED_OFFSET:
3151 + context->reg[i] = cfa + fs->regs.reg[i].loc.offset;
3153 + case REG_SAVED_REG:
3154 + context->reg[i] = orig_context.reg[fs->regs.reg[i].loc.reg];
3156 + case REG_SAVED_EXP:
3158 + const unsigned char *exp = fs->regs.reg[i].loc.exp;
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;
3172 +uw_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs)
3174 + uw_update_context_1 (context, fs);
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));
3182 +/* Fill in CONTEXT for top-of-stack. The only valid registers at this
3183 + level will be the return address and the CFA. */
3185 +#define uw_init_context(CONTEXT) \
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)); \
3195 +uw_init_context_1 (struct _Unwind_Context *context,
3196 + void *outer_cfa, void *outer_ra)
3198 + void *ra = __builtin_extract_return_addr (__builtin_return_address (0));
3199 + _Unwind_FrameState fs;
3201 + memset (context, 0, sizeof (struct _Unwind_Context));
3204 + if (uw_frame_state_for (context, &fs) != _URC_NO_REASON)
3207 + /* Force the frame state to use the known cfa value. */
3208 + context->cfa = outer_cfa;
3209 + fs.cfa_how = CFA_REG_OFFSET;
3211 + fs.cfa_offset = 0;
3213 + uw_update_context_1 (context, &fs);
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);
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
3226 +#define uw_install_context(CURRENT, TARGET) \
3228 + long offset = uw_install_context_1 ((CURRENT), (TARGET)); \
3229 + void *handler = __builtin_frob_return_addr ((TARGET)->ra); \
3230 + __builtin_eh_return (offset, handler); \
3234 +init_dwarf_reg_size_table (void)
3236 + __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table);
3240 +uw_install_context_1 (struct _Unwind_Context *current,
3241 + struct _Unwind_Context *target)
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 ();
3253 + if (dwarf_reg_size_table[0] == 0)
3254 + init_dwarf_reg_size_table ();
3257 + for (i = 0; i < DWARF_FRAME_REGISTERS; ++i)
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]);
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;
3269 + return current->cfa - target->cfa - target->args_size;
3272 +static inline _Unwind_Ptr
3273 +uw_identify_context (struct _Unwind_Context *context)
3275 + return _Unwind_GetIP (context);
3279 +#include "unwind.inc"
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
3286 +/* Exception handling and frame unwind runtime interface routines.
3287 + Copyright (C) 2001 Free Software Foundation, Inc.
3289 + This file is part of GNU CC.
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.
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.
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. */
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. */
3310 +/* If using C++, references to abort have to be qualified with std::. */
3312 +#define __gxx_abort std::abort
3314 +#define __gxx_abort abort
3317 +/* Pointer encodings, from dwarf2.h. */
3318 +#define DW_EH_PE_absptr 0x00
3319 +#define DW_EH_PE_omit 0xff
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
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
3337 +#define DW_EH_PE_indirect 0x80
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. */
3348 +size_of_encoded_value (unsigned char encoding)
3349 +#if defined(_LIBC) && !defined(NO_BASE_OF_ENCODED_VALUE)
3353 + if (encoding == DW_EH_PE_omit)
3356 + switch (encoding & 0x07)
3358 + case DW_EH_PE_absptr:
3359 + return sizeof (void *);
3360 + case DW_EH_PE_udata2:
3362 + case DW_EH_PE_udata4:
3364 + case DW_EH_PE_udata8:
3371 +#ifndef NO_BASE_OF_ENCODED_VALUE
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
3379 +base_of_encoded_value (unsigned char encoding, struct _Unwind_Context *context)
3381 + if (encoding == DW_EH_PE_omit)
3384 + switch (encoding & 0x70)
3386 + case DW_EH_PE_absptr:
3387 + case DW_EH_PE_pcrel:
3388 + case DW_EH_PE_aligned:
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);
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. */
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)
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__));
3428 + union unaligned *u = (union unaligned *) p;
3429 + _Unwind_Ptr result;
3431 + if (encoding == DW_EH_PE_aligned)
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 *));
3440 + switch (encoding & 0x0f)
3442 + case DW_EH_PE_absptr:
3443 + result = (_Unwind_Ptr) u->ptr;
3444 + p += sizeof (void *);
3447 + case DW_EH_PE_uleb128:
3449 + unsigned int shift = 0;
3450 + unsigned char byte;
3456 + result |= (_Unwind_Ptr)(byte & 0x7f) << shift;
3459 + while (byte & 0x80);
3463 + case DW_EH_PE_sleb128:
3465 + unsigned int shift = 0;
3466 + unsigned char byte;
3472 + result |= (_Unwind_Ptr)(byte & 0x7f) << shift;
3475 + while (byte & 0x80);
3477 + if (shift < 8 * sizeof(result) && (byte & 0x40) != 0)
3478 + result |= -(1L << shift);
3482 + case DW_EH_PE_udata2:
3486 + case DW_EH_PE_udata4:
3490 + case DW_EH_PE_udata8:
3495 + case DW_EH_PE_sdata2:
3499 + case DW_EH_PE_sdata4:
3503 + case DW_EH_PE_sdata8:
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;
3526 +#ifndef NO_BASE_OF_ENCODED_VALUE
3528 +/* Like read_encoded_value_with_base, but get the base from the context
3529 + rather than providing it directly. */
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)
3535 + return read_encoded_value_with_base (encoding,
3536 + base_of_encoded_value (encoding, context),
3542 +/* Read an unsigned leb128 value from P, store the value in VAL, return
3543 + P incremented past the value. */
3545 +static inline const unsigned char *
3546 +read_uleb128 (const unsigned char *p, _Unwind_Ptr *val)
3548 + return read_encoded_value_with_base (DW_EH_PE_uleb128, 0, p, val);
3551 +/* Similar, but read a signed leb128 value. */
3553 +static inline const unsigned char *
3554 +read_sleb128 (const unsigned char *p, _Unwind_Ptr *val)
3556 + return read_encoded_value_with_base (DW_EH_PE_sleb128, 0, p, val);
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
3561 +/* Exception handling and frame unwind runtime interface routines.
3562 + Copyright (C) 2001 Free Software Foundation, Inc.
3564 + This file is part of GNU CC.
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.
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.
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. */
3581 +/* This is derived from the C++ ABI for IA-64. Where we diverge
3582 + for cross-architecture compatibility are noted with "@@@". */
3588 +/* Level 1: Base ABI */
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__)));
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__)));
3602 +/* The unwind interface uses reason codes in several contexts to
3603 + identify the reasons for failures or other actions. */
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;
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. */
3624 +struct _Unwind_Exception;
3626 +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code,
3627 + struct _Unwind_Exception *);
3629 +struct _Unwind_Exception
3631 + _Unwind_Exception_Class exception_class;
3632 + _Unwind_Exception_Cleanup_Fn exception_cleanup;
3633 + _Unwind_Word private_1;
3634 + _Unwind_Word private_2;
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__));
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;
3646 +#define _UA_SEARCH_PHASE 1
3647 +#define _UA_CLEANUP_PHASE 2
3648 +#define _UA_HANDLER_FRAME 4
3649 +#define _UA_FORCE_UNWIND 8
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;
3657 +/* Raise an exception, passing along the given exception object. */
3658 +extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
3660 +/* Raise an exception for forced unwinding. */
3662 +typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
3663 + (int, _Unwind_Action, _Unwind_Exception_Class,
3664 + struct _Unwind_Exception *, struct _Unwind_Context *, void *);
3666 +extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
3670 +/* Helper to invoke the exception_cleanup routine. */
3671 +extern void _Unwind_DeleteException (struct _Unwind_Exception *);
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 *);
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. */
3682 +extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int);
3683 +extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word);
3685 +extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
3686 +extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
3688 +extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *);
3690 +extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *);
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.
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. */
3707 +typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)
3708 + (int, _Unwind_Action, _Unwind_Exception_Class,
3709 + struct _Unwind_Exception *, struct _Unwind_Context *);
3711 +/* @@@ The following alternate entry points are for setjmp/longjmp
3712 + based unwinding. */
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 *);
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 *);
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. */
3729 +#include <stdlib.h>
3731 +static inline _Unwind_Ptr
3732 +_Unwind_GetDataRelBase (struct _Unwind_Context *_C)
3734 + /* The GP is stored in R1. */
3735 + return _Unwind_GetGR (_C, 1);
3738 +static inline _Unwind_Ptr
3739 +_Unwind_GetTextRelBase (struct _Unwind_Context *_C)
3745 +extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *);
3746 +extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *);
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
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.
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.
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.
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. */
3776 +#include <stdlib.h>
3777 +#define __frame_state_for fallback_frame_state_for
3778 +#include <unwind-dw2.c>
3779 +#undef __frame_state_for
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);
3785 +struct frame_state *
3786 +__frame_state_for (void *pc, struct frame_state *frame_state)
3788 + static framesf frame_state_for;
3790 + if (frame_state_for == NULL)
3792 + void *handle = __libc_dlopen ("libgcc_s.so.1");
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;
3800 + return frame_state_for (pc, frame_state);
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
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.
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.
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.
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. */
3824 +/* Note: For hppa64 this is 61 */
3825 +#define DWARF_FRAME_REGISTERS 89
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
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.
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.
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.
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. */
3850 +#define DWARF_FRAME_REGISTERS 17
3852 +#define CRT_GET_RFIB_DATA(BASE) \
3854 + register void *__ebx __asm__("ebx");\
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
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.
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.
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.
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. */
3881 +#define FIRST_PSEUDO_REGISTER 24
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 {
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;
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
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
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
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.
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.
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.
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. */
3931 +#define FIRST_PSEUDO_REGISTER 76
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
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.
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.
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.
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. */
3956 +#define DWARF_FRAME_REGISTERS 77
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
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.
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.
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.
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. */
3981 +#define FIRST_PSEUDO_REGISTER 101
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
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.
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.
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.
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. */
4006 +#define DWARF_FRAME_REGISTERS 49
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
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.
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.
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.
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. */
4031 +#define FIRST_PSEUDO_REGISTER 34
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 {
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;
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
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
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
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 {
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;
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
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
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 {
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;
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
4109 +ifeq (yes,$(build-shared))
4110 +# This is needed to support g++ v2 and v3.
4111 +sysdep_routines += framestate
4112 +shared-only-routines += framestate
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 {
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;
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
4134 +ifeq (yes,$(build-shared))
4135 +# This is needed to support g++ v2 and v3.
4136 +sysdep_routines += framestate
4137 +shared-only-routines += framestate
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 {
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;
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
4161 +ifeq (yes,$(build-shared))
4162 +# This is needed to support g++ v2 and v3.
4163 +sysdep_routines += framestate
4164 +shared-only-routines += framestate
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 {
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;
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
4185 sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
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
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 {
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;
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
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
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 {
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;
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 {
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;
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)
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
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
4264 arch_minimum_kernel=2.4.0
4265 + libc_cv_gcc_unwind_find_fde=no
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
4274 arch_minimum_kernel=2.4.0
4275 + libc_cv_gcc_unwind_find_fde=no
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
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.
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.
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.
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. */
4301 +#define DWARF_FRAME_REGISTERS 16
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 {
4310 +%ifdef EXPORT_UNWIND_FIND_FDE
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'`
4326 -if test x"$gcc3" = xyes; then
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
4335 -*** If you really mean to use GCC 3.x, run configure again
4336 -*** using the extra parameter \`--disable-sanity-checks'."
4340 -*** This configuration is not supported by the GNU libc developers."
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; }
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
4355 + if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then
4356 + libc_cv_gcc_static_libgcc=
4358 + libc_cv_gcc_static_libgcc=-static-libgcc
4362 +echo "$ac_t""$libc_cv_gcc_static_libgcc" 1>&6
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=
4370 ldd_rewrite_script=no
4371 libc_cv_sysconfdir=$sysconfdir
4372 +libc_cv_gcc_unwind_find_fde=yes
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
4380 +if test x$libc_cv_gcc_unwind_find_fde = xyes; then
4381 + cat >> confdefs.h <<\EOF
4382 +#define EXPORT_UNWIND_FIND_FDE 1
4389 # If we will use the generic uname implementation, we must figure out what
4390 @@ -3860,6 +3883,7 @@ s%@RANLIB@%$RANLIB%g
4392 s%@CCVERSION@%$CCVERSION%g
4393 s%@SYSINCLUDES@%$SYSINCLUDES%g
4394 +s%@libc_cv_gcc_static_libgcc@%$libc_cv_gcc_static_libgcc%g
4396 s%@libc_cv_have_bash2@%$libc_cv_have_bash2%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'`
4408 -if test x"$gcc3" = xyes; then
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
4417 -*** If you really mean to use GCC 3.x, run configure again
4418 -*** using the extra parameter \`--disable-sanity-checks'."
4422 -*** This configuration is not supported by the GNU libc developers."
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.])
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=
4436 + libc_cv_gcc_static_libgcc=-static-libgcc
4438 +AC_SUBST(libc_cv_gcc_static_libgcc)
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=
4445 ldd_rewrite_script=no
4446 libc_cv_sysconfdir=$sysconfdir
4447 +libc_cv_gcc_unwind_find_fde=yes
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
4455 +if test x$libc_cv_gcc_unwind_find_fde = xyes; then
4456 + AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
4459 AC_LINK_FILES(`echo $libc_link_sources`, `echo $libc_link_dests`)
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
4465 /* Define a symbol_name as a global .symbol_name for ld. */
4466 #undef HAVE_ASM_GLOBAL_DOT_NAME
4468 +/* Define if _Unwind_Find_FDE should be exported from glibc. */
4469 +#undef EXPORT_UNWIND_FIND_FDE
4471 /* Define to use GNU libio instead of GNU stdio.
4472 This is defined by configure under --enable-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@
4480 +static-libgcc = @libc_cv_gcc_static_libgcc@
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
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
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)