summaryrefslogtreecommitdiff
path: root/toolchain/elf2flt/patches/453398f917d167f8c308c8f997270c48ae8f8b12/0005-arm.patch
blob: 247ff2b35afdabf298074572dcedf6498e075e0b (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
diff -Nur elf2flt-453398f917d167f8c308c8f997270c48ae8f8b12.orig/elf2flt.c elf2flt-453398f917d167f8c308c8f997270c48ae8f8b12/elf2flt.c
--- elf2flt-453398f917d167f8c308c8f997270c48ae8f8b12.orig/elf2flt.c	2021-02-08 14:02:15.000000000 +0100
+++ elf2flt-453398f917d167f8c308c8f997270c48ae8f8b12/elf2flt.c	2021-04-09 20:40:19.386179197 +0200
@@ -424,7 +424,8 @@
 	 */
 	if ((!pic_with_got || ALWAYS_RELOC_TEXT) &&
 	    ((a->flags & SEC_CODE) ||
-	    ((a->flags & (SEC_DATA | SEC_READONLY)) == (SEC_DATA | SEC_READONLY))))
+	    ((a->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) == 
+	                 (SEC_DATA | SEC_READONLY | SEC_RELOC))))
 		sectionp = text + (a->vma - text_vma);
 	else if (a->flags & SEC_DATA)
 		sectionp = data + (a->vma - data_vma);
@@ -1861,7 +1862,9 @@
     bfd_size_type sec_size;
     bfd_vma sec_vma;
 
-    if (s->flags & SEC_CODE) {
+    if ((s->flags & SEC_CODE) ||
+       ((s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
+                    (SEC_DATA | SEC_READONLY | SEC_RELOC))) {
       vma = &text_vma;
       len = &text_len;
     } else if (s->flags & SEC_DATA) {
@@ -1896,7 +1899,9 @@
 
   /* Read in all text sections.  */
   for (s = abs_bfd->sections; s != NULL; s = s->next)
-    if (s->flags & SEC_CODE) 
+    if ((s->flags & SEC_CODE) ||
+       ((s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
+                    (SEC_DATA | SEC_READONLY | SEC_RELOC)))
       if (!bfd_get_section_contents(abs_bfd, s,
 				   text + (s->vma - text_vma), 0,
 				   bfd_section_size(abs_bfd, s)))
@@ -1922,7 +1927,9 @@
 
   /* Read in all data sections.  */
   for (s = abs_bfd->sections; s != NULL; s = s->next)
-    if (s->flags & SEC_DATA) 
+      if ((s->flags & SEC_DATA) &&
+         ((s->flags & (SEC_READONLY | SEC_RELOC)) !=
+                    (SEC_READONLY | SEC_RELOC)))
       if (!bfd_get_section_contents(abs_bfd, s,
 				   data + (s->vma - data_vma), 0,
 				   bfd_section_size(abs_bfd, s)))