1 From 9d9f97ca5d1ceba66677bf406c9b31027dc1f22e Mon Sep 17 00:00:00 2001
2 From: Waldemar Brodkorb <wbx@openadk.org>
3 Date: Fri, 19 Aug 2016 13:54:46 +0200
4 Subject: [PATCH] libgcc: fix DWARF compilation with FDPIC targets
6 The build of unwind-dw2-fde-dip.c currently fails for FDPIC targets with
9 libgcc/unwind-dw2-fde-dip.c:167:31: error: storage size of 'load_base' isn't known
10 struct elf32_fdpic_loadaddr load_base;
12 This patch addresses that by defining load_base with the appropriate
13 type on FDPIC targets. It has been tested on FRV and Blackfin.
17 Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
18 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
20 libgcc/unwind-dw2-fde-dip.c | 8 ++++++--
21 1 file changed, 6 insertions(+), 2 deletions(-)
23 diff --git a/libgcc/unwind-dw2-fde-dip.c b/libgcc/unwind-dw2-fde-dip.c
24 index f7a1c3f..801bce8 100644
25 --- a/libgcc/unwind-dw2-fde-dip.c
26 +++ b/libgcc/unwind-dw2-fde-dip.c
27 @@ -124,7 +124,11 @@ static struct frame_hdr_cache_element
31 +#if defined __FRV_FDPIC__ || defined __BFIN_FDPIC__
32 + struct elf32_fdpic_loadaddr load_base;
34 _Unwind_Ptr load_base;
36 const ElfW(Phdr) *p_eh_frame_hdr;
37 const ElfW(Phdr) *p_dynamic;
38 struct frame_hdr_cache_element *link;
39 @@ -163,7 +167,7 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
40 struct unw_eh_callback_data *data = (struct unw_eh_callback_data *) ptr;
41 const ElfW(Phdr) *phdr, *p_eh_frame_hdr, *p_dynamic;
44 +#if defined __FRV_FDPIC__ || defined __BFIN_FDPIC__
45 struct elf32_fdpic_loadaddr load_base;
47 _Unwind_Ptr load_base;
48 @@ -347,7 +351,7 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
52 -# elif defined __FRV_FDPIC__ && defined __linux__
53 +# elif (defined __FRV_FDPIC__ || defined __BFIN_FDPIC__) && defined __linux__
54 data->dbase = load_base.got_value;
56 # error What is DW_EH_PE_datarel base on this platform?