comparison gcc/unwind-dw2-fde-glibc.c @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents 77e2b8dfacca
children
comparison
equal deleted inserted replaced
65:65488c3d617d 67:f6334be47118
1 /* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc. 1 /* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
2 Free Software Foundation, Inc.
2 Contributed by Jakub Jelinek <jakub@redhat.com>. 3 Contributed by Jakub Jelinek <jakub@redhat.com>.
3 4
4 This file is part of GCC. 5 This file is part of GCC.
5 6
6 GCC is free software; you can redistribute it and/or modify 7 GCC is free software; you can redistribute it and/or modify
31 #endif 32 #endif
32 33
33 #include "tconfig.h" 34 #include "tconfig.h"
34 #include "tsystem.h" 35 #include "tsystem.h"
35 #ifndef inhibit_libc 36 #ifndef inhibit_libc
36 #include <link.h> 37 #include <elf.h> /* Get DT_CONFIG. */
37 #endif 38 #endif
38 #include "coretypes.h" 39 #include "coretypes.h"
39 #include "tm.h" 40 #include "tm.h"
40 #include "dwarf2.h" 41 #include "dwarf2.h"
41 #include "unwind.h" 42 #include "unwind.h"
55 && defined(__FreeBSD__) && __FreeBSD__ >= 7 56 && defined(__FreeBSD__) && __FreeBSD__ >= 7
56 # define ElfW __ElfN 57 # define ElfW __ElfN
57 # define USE_PT_GNU_EH_FRAME 58 # define USE_PT_GNU_EH_FRAME
58 #endif 59 #endif
59 60
61 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
62 && defined(TARGET_DL_ITERATE_PHDR) \
63 && defined(__sun__) && defined(__svr4__)
64 # define USE_PT_GNU_EH_FRAME
65 #endif
66
60 #if defined(USE_PT_GNU_EH_FRAME) 67 #if defined(USE_PT_GNU_EH_FRAME)
68
69 #include <link.h>
61 70
62 #ifndef __RELOC_POINTER 71 #ifndef __RELOC_POINTER
63 # define __RELOC_POINTER(ptr, base) ((ptr) + (base)) 72 # define __RELOC_POINTER(ptr, base) ((ptr) + (base))
64 #endif 73 #endif
65 74
252 pc_high = vaddr + phdr->p_memsz; 261 pc_high = vaddr + phdr->p_memsz;
253 } 262 }
254 } 263 }
255 else if (phdr->p_type == PT_GNU_EH_FRAME) 264 else if (phdr->p_type == PT_GNU_EH_FRAME)
256 p_eh_frame_hdr = phdr; 265 p_eh_frame_hdr = phdr;
266 #ifdef PT_SUNW_UNWIND
267 /* Sun ld emits PT_SUNW_UNWIND .eh_frame_hdr sections instead of
268 PT_SUNW_EH_FRAME/PT_GNU_EH_FRAME, so accept them as well. */
269 else if (phdr->p_type == PT_SUNW_UNWIND)
270 p_eh_frame_hdr = phdr;
271 #endif
257 else if (phdr->p_type == PT_DYNAMIC) 272 else if (phdr->p_type == PT_DYNAMIC)
258 p_dynamic = phdr; 273 p_dynamic = phdr;
259 } 274 }
260 275
261 if (!match) 276 if (!match)
301 ElfW(Dyn) *dyn = (ElfW(Dyn) *) 316 ElfW(Dyn) *dyn = (ElfW(Dyn) *)
302 __RELOC_POINTER (p_dynamic->p_vaddr, load_base); 317 __RELOC_POINTER (p_dynamic->p_vaddr, load_base);
303 for (; dyn->d_tag != DT_NULL ; dyn++) 318 for (; dyn->d_tag != DT_NULL ; dyn++)
304 if (dyn->d_tag == DT_PLTGOT) 319 if (dyn->d_tag == DT_PLTGOT)
305 { 320 {
306 /* On IA-32, _DYNAMIC is writable and GLIBC has relocated it. */
307 data->dbase = (void *) dyn->d_un.d_ptr; 321 data->dbase = (void *) dyn->d_un.d_ptr;
322 #if defined __linux__
323 /* On IA-32 Linux, _DYNAMIC is writable and GLIBC has
324 relocated it. */
325 #elif defined __sun__ && defined __svr4__
326 /* On Solaris 2/x86, we need to do this ourselves. */
327 data->dbase += load_base;
328 #endif
308 break; 329 break;
309 } 330 }
310 } 331 }
311 # elif defined __FRV_FDPIC__ && defined __linux__ 332 # elif defined __FRV_FDPIC__ && defined __linux__
312 data->dbase = load_base.got_value; 333 data->dbase = load_base.got_value;
334 # elif defined __x86_64__ && defined __sun__ && defined __svr4__
335 /* While CRT_GET_RFIB_DATA is also defined for 64-bit Solaris 10+/x86, it
336 doesn't apply since it uses DW_EH_PE_pcrel encoding. */
313 # else 337 # else
314 # error What is DW_EH_PE_datarel base on this platform? 338 # error What is DW_EH_PE_datarel base on this platform?
315 # endif 339 # endif
316 #endif 340 #endif
317 341