summaryrefslogtreecommitdiff
path: root/patches/gcc/6.2.0/894-libgcc-fix-DWARF-compilation-with-FDPIC-targets.patch
blob: ce49de7ee9b58528203b6184aeda97bf553c68f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From 9d9f97ca5d1ceba66677bf406c9b31027dc1f22e Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Fri, 19 Aug 2016 13:54:46 +0200
Subject: [PATCH] libgcc: fix DWARF compilation with FDPIC targets

The build of unwind-dw2-fde-dip.c currently fails for FDPIC targets with
the following error:

libgcc/unwind-dw2-fde-dip.c:167:31: error: storage size of 'load_base' isn't known
   struct elf32_fdpic_loadaddr load_base;

This patch addresses that by defining load_base with the appropriate
type on FDPIC targets. It has been tested on FRV and Blackfin.

Fixes PR gcc/68468.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 libgcc/unwind-dw2-fde-dip.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libgcc/unwind-dw2-fde-dip.c b/libgcc/unwind-dw2-fde-dip.c
index f7a1c3f..801bce8 100644
--- a/libgcc/unwind-dw2-fde-dip.c
+++ b/libgcc/unwind-dw2-fde-dip.c
@@ -124,7 +124,11 @@ static struct frame_hdr_cache_element
 {
   _Unwind_Ptr pc_low;
   _Unwind_Ptr pc_high;
+#if defined __FRV_FDPIC__ || defined __BFIN_FDPIC__
+  struct elf32_fdpic_loadaddr load_base;
+#else
   _Unwind_Ptr load_base;
+#endif
   const ElfW(Phdr) *p_eh_frame_hdr;
   const ElfW(Phdr) *p_dynamic;
   struct frame_hdr_cache_element *link;
@@ -163,7 +167,7 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
   struct unw_eh_callback_data *data = (struct unw_eh_callback_data *) ptr;
   const ElfW(Phdr) *phdr, *p_eh_frame_hdr, *p_dynamic;
   long n, match;
-#ifdef __FRV_FDPIC__
+#if defined __FRV_FDPIC__ || defined __BFIN_FDPIC__
   struct elf32_fdpic_loadaddr load_base;
 #else
   _Unwind_Ptr load_base;
@@ -347,7 +351,7 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
 	    break;
 	  }
     }
-# elif defined __FRV_FDPIC__ && defined __linux__
+# elif (defined __FRV_FDPIC__ || defined __BFIN_FDPIC__) && defined __linux__
   data->dbase = load_base.got_value;
 # else
 #  error What is DW_EH_PE_datarel base on this platform?
-- 
2.7.4