summaryrefslogtreecommitdiffstats
path: root/patches/elf2flt-20110404-g40f0d17/0001-Arm-support-update-exidx-sections.patch
blob: ccb1d598e19cd0671da4f22d975d3818a972c646 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
From: Paul Chavent <paul.chavent@fnac.net>
Date: Thu, 17 May 2012 08:10:44 +0200
Subject: [PATCH] Arm support update (exidx sections).

---
 .gitignore    |    1 +
 elf2flt.c     |   27 +++++++++++++++++++++++++++
 elf2flt.ld.in |   17 ++++++++++++++---
 3 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 92ff5f6..e0e0bd5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,4 @@ elf2flt
 elf2flt.ld
 flthdr
 ld-elf2flt
+ld-elf2flt.sh
\ No newline at end of file
diff --git a/elf2flt.c b/elf2flt.c
index 2fea9b5..1a7ef88 100644
--- a/elf2flt.c
+++ b/elf2flt.c
@@ -54,6 +54,8 @@ const char *elf2flt_progname;
 
 #if defined(TARGET_h8300)
 #include <elf/h8.h>      /* TARGET_* ELF support for the BFD library            */
+#elif defined(TARGET_arm)
+#include "elf/arm.h"
 #elif defined(__CYGWIN__) || defined(__MINGW32__) || defined(TARGET_nios) || defined(TARGET_nios2)
 #include "cygwin-elf.h"	/* Cygwin uses a local copy */
 #elif defined(TARGET_microblaze)
@@ -639,12 +641,16 @@ dump_symbols(symbols, number_of_symbols);
 					relocation_needed = 1;
 					break;
 				case R_ARM_REL32:
+				case R_ARM_JUMP24:
+				case R_ARM_CALL:
 				case R_ARM_THM_PC11:
 				case R_ARM_THM_PC22:
 				case R_ARM_PC24:
 				case R_ARM_PLT32:
 				case R_ARM_GOTPC:
 				case R_ARM_GOT32:
+				case R_ARM_PREL31:
+				case R_ARM_NONE:
 					relocation_needed = 0;
 					break;
 				default:
@@ -1702,6 +1708,27 @@ int main(int argc, char *argv[])
     }
   }
   
+  if (verbose) {
+    printf("  verbose      = %d\n"
+           "  load_to_ram  = %d\n"
+           "  ktrace       = %d\n"
+           "  docompress   = %d\n"
+           "  pfile        = \"%s\"\n"
+           "  ofile        = \"%s\"\n"
+           "  use_resolved = %d\n"
+           "  stack        = %d\n"
+           "  rel_file     = \"%s\\n",
+           verbose     ,
+           load_to_ram ,
+           ktrace      ,
+           docompress  ,
+           pfile       ,
+           ofile       ,
+           use_resolved,
+           stack       ,
+           rel_file    );
+  }
+
   /*
    * if neither the -r or -p options was given,  default to
    * a RAM load as that is the only option that makes sense.
diff --git a/elf2flt.ld.in b/elf2flt.ld.in
index c7e01a6..56b8f96 100644
--- a/elf2flt.ld.in
+++ b/elf2flt.ld.in
@@ -32,6 +32,8 @@ W_RODAT		*(.rodata1)
 W_RODAT		*(.rodata.*)
 W_RODAT		*(.gnu.linkonce.r*)
 
+		/* .ARM.extab name sections containing exception unwinding information */
+		*(.ARM.extab* .gnu.linkonce.armextab.*)
 		/* This is special code area at the end of the normal
 		   text section.  It contains a small lookup table at
 		   the start followed by the code pointed to by entries
@@ -40,11 +42,20 @@ W_RODAT		*(.gnu.linkonce.r*)
 		PROVIDE(@SYMBOL_PREFIX@__ctbp = .);
 		*(.call_table_data)
 		*(.call_table_text)
-
-		. = ALIGN(0x20) ;
-		@SYMBOL_PREFIX@_etext = . ;
 	} > flatmem :text
 
+	/* .ARM.exidx name sections containing index entries for section unwinding */
+	/* .ARM.exidx is sorted, so has to go in its own output section.  */
+	@SYMBOL_PREFIX@__exidx_start = .;
+	.ARM.exidx :
+	{
+		*(.ARM.exidx* .gnu.linkonce.armexidx.*)
+	} > flatmem
+	@SYMBOL_PREFIX@__exidx_end = .;
+
+	. = ALIGN(0x20) ;
+	@SYMBOL_PREFIX@_etext = . ;
+
 	.data : {
 		. = ALIGN(0x4) ;
 		@SYMBOL_PREFIX@_sdata = . ;