summaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-Invalid-data-offsets-pointer-after-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-Invalid-data-offsets-pointer-after-.patch')
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-Invalid-data-offsets-pointer-after-.patch142
1 files changed, 142 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-Invalid-data-offsets-pointer-after-.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-Invalid-data-offsets-pointer-after-.patch
new file mode 100644
index 00000000..cb31c0d7
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-Invalid-data-offsets-pointer-after-.patch
@@ -0,0 +1,142 @@
1From 7bddfaf3ad574aa738ab903f63a345ebde134f9e Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 24 Jan 2022 16:04:07 +0530
4Subject: [PATCH 31/34] [Patch,MicroBlaze] : Invalid data offsets (pointer)
5 after relaxation. Proposed patch from community member (dednev@rambler.ru)
6 against 2021.1 [CR-1115232]
7
8---
9 bfd/elf32-microblaze.c | 18 ++++++++++++++++++
10 bfd/elf64-microblaze.c | 17 +++++++++++++++++
11 2 files changed, 35 insertions(+)
12
13diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
14index 88ac730582b..588367ebcbb 100644
15--- a/bfd/elf32-microblaze.c
16+++ b/bfd/elf32-microblaze.c
17@@ -2095,6 +2095,9 @@ microblaze_elf_relax_section (bfd *abfd,
18 {
19 unsigned int val;
20
21+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
22+ continue;
23+
24 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
25
26 /* hax: We only do the following fixup for debug location lists. */
27@@ -2136,6 +2139,9 @@ microblaze_elf_relax_section (bfd *abfd,
28 }
29 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
30 {
31+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
32+ continue;
33+
34 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
35
36 /* Look at the reloc only if the value has been resolved. */
37@@ -2168,6 +2174,9 @@ microblaze_elf_relax_section (bfd *abfd,
38 }
39 else if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_SYM_OP_SYM)
40 {
41+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
42+ continue;
43+
44 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
45
46 /* Look at the reloc only if the value has been resolved. */
47@@ -2205,6 +2214,9 @@ microblaze_elf_relax_section (bfd *abfd,
48 || (ELF32_R_TYPE (irelscan->r_info)
49 == (int) R_MICROBLAZE_TEXTREL_32_LO))
50 {
51+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
52+ continue;
53+
54 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
55
56 /* Look at the reloc only if the value has been resolved. */
57@@ -2251,6 +2263,9 @@ microblaze_elf_relax_section (bfd *abfd,
58 || (ELF32_R_TYPE (irelscan->r_info)
59 == (int) R_MICROBLAZE_TEXTREL_64))
60 {
61+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
62+ continue;
63+
64 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
65
66 /* Look at the reloc only if the value has been resolved. */
67@@ -2285,6 +2300,9 @@ microblaze_elf_relax_section (bfd *abfd,
68 }
69 else if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_PCREL)
70 {
71+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
72+ continue;
73+
74 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
75
76 /* Look at the reloc only if the value has been resolved. */
77diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
78index 03fe9eba53a..76aec43ec7a 100644
79--- a/bfd/elf64-microblaze.c
80+++ b/bfd/elf64-microblaze.c
81@@ -2132,6 +2132,8 @@ microblaze_elf_relax_section (bfd *abfd,
82 if (1 && ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
83 {
84 unsigned int val;
85+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
86+ continue;
87
88 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
89
90@@ -2174,6 +2176,9 @@ microblaze_elf_relax_section (bfd *abfd,
91 if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32
92 || ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
93 {
94+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
95+ continue;
96+
97 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
98
99 /* Look at the reloc only if the value has been resolved. */
100@@ -2206,6 +2211,9 @@ microblaze_elf_relax_section (bfd *abfd,
101 }
102 else if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_SYM_OP_SYM)
103 {
104+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
105+ continue;
106+
107 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
108
109 /* Look at the reloc only if the value has been resolved. */
110@@ -2243,6 +2251,9 @@ microblaze_elf_relax_section (bfd *abfd,
111 || (ELF32_R_TYPE (irelscan->r_info)
112 == (int) R_MICROBLAZE_TEXTREL_32_LO))
113 {
114+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
115+ continue;
116+
117 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
118
119 /* Look at the reloc only if the value has been resolved. */
120@@ -2288,6 +2299,9 @@ microblaze_elf_relax_section (bfd *abfd,
121 if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64
122 || (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_TEXTREL_64))
123 {
124+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
125+ continue;
126+
127 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
128
129 /* Look at the reloc only if the value has been resolved. */
130@@ -2336,6 +2350,9 @@ microblaze_elf_relax_section (bfd *abfd,
131 }
132 else if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_PCREL)
133 {
134+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
135+ continue;
136+
137 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
138
139 /* Look at the reloc only if the value has been resolved. */
140--
1412.37.1 (Apple Git-137.1)
142