summaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-microblaze/binutils/binutils/0004-Fix-relaxation-of-assembler-resolved-references.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-microblaze/recipes-microblaze/binutils/binutils/0004-Fix-relaxation-of-assembler-resolved-references.patch')
-rw-r--r--meta-microblaze/recipes-microblaze/binutils/binutils/0004-Fix-relaxation-of-assembler-resolved-references.patch74
1 files changed, 74 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-microblaze/binutils/binutils/0004-Fix-relaxation-of-assembler-resolved-references.patch b/meta-microblaze/recipes-microblaze/binutils/binutils/0004-Fix-relaxation-of-assembler-resolved-references.patch
new file mode 100644
index 00000000..d1b754c3
--- /dev/null
+++ b/meta-microblaze/recipes-microblaze/binutils/binutils/0004-Fix-relaxation-of-assembler-resolved-references.patch
@@ -0,0 +1,74 @@
1From ababe1df64146c616455eb1af4cf8fd21eb6f42c Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Tue, 14 Feb 2012 01:00:22 +0100
4Subject: [PATCH 04/43] Fix relaxation of assembler resolved references
5
6---
7 bfd/elf32-microblaze.c | 38 ++++++++++++++++++++++++++++++++++++++
8 gas/config/tc-microblaze.c | 1 +
9 2 files changed, 39 insertions(+)
10
11diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
12index e3c8027248..359484dd5e 100644
13--- a/bfd/elf32-microblaze.c
14+++ b/bfd/elf32-microblaze.c
15@@ -1973,6 +1973,44 @@ microblaze_elf_relax_section (bfd *abfd,
16 irelscanend = irelocs + o->reloc_count;
17 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
18 {
19+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE)
20+ {
21+ unsigned int val;
22+
23+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
24+
25+ /* This was a PC-relative instruction that was completely resolved. */
26+ if (ocontents == NULL)
27+ {
28+ if (elf_section_data (o)->this_hdr.contents != NULL)
29+ ocontents = elf_section_data (o)->this_hdr.contents;
30+ else
31+ {
32+ /* We always cache the section contents.
33+ Perhaps, if info->keep_memory is FALSE, we
34+ should free them, if we are permitted to. */
35+
36+ if (o->rawsize == 0)
37+ o->rawsize = o->size;
38+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
39+ if (ocontents == NULL)
40+ goto error_return;
41+ if (!bfd_get_section_contents (abfd, o, ocontents,
42+ (file_ptr) 0,
43+ o->rawsize))
44+ goto error_return;
45+ elf_section_data (o)->this_hdr.contents = ocontents;
46+ }
47+ }
48+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
49+ + isym->st_value, sec);
50+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
51+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
52+ irelscan->r_addend);
53+ }
54+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) {
55+ fprintf(stderr, "Unhandled NONE 64\n");
56+ }
57 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
58 {
59 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
60diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
61index c92e9ce563..3e728400b7 100644
62--- a/gas/config/tc-microblaze.c
63+++ b/gas/config/tc-microblaze.c
64@@ -2205,6 +2205,7 @@ md_apply_fix (fixS * fixP,
65 else
66 fixP->fx_r_type = BFD_RELOC_NONE;
67 fixP->fx_addsy = section_symbol (absolute_section);
68+ fixP->fx_done = 0;
69 }
70 return;
71 }
72--
732.17.1
74