diff options
Diffstat (limited to 'recipes-devtools/binutils/files/0017-Fix-relaxation-of-assembler-resolved-reference.patch')
-rw-r--r-- | recipes-devtools/binutils/files/0017-Fix-relaxation-of-assembler-resolved-reference.patch | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/recipes-devtools/binutils/files/0017-Fix-relaxation-of-assembler-resolved-reference.patch b/recipes-devtools/binutils/files/0017-Fix-relaxation-of-assembler-resolved-reference.patch new file mode 100644 index 00000000..fb3ff355 --- /dev/null +++ b/recipes-devtools/binutils/files/0017-Fix-relaxation-of-assembler-resolved-reference.patch | |||
@@ -0,0 +1,75 @@ | |||
1 | From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> | ||
2 | Date: Tue, 14 Feb 2012 01:00:22 +0100 | ||
3 | Subject: Fix relaxation of assembler resolved references | ||
4 | |||
5 | Upstream-Status: Pending | ||
6 | --- | ||
7 | bfd/elf32-microblaze.c | 39 +++++++++++++++++++++++++++++++++++++++ | ||
8 | gas/config/tc-microblaze.c | 1 + | ||
9 | 2 files changed, 40 insertions(+) | ||
10 | |||
11 | diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c | ||
12 | index 502e3c9..9de2479 100644 | ||
13 | --- a/bfd/elf32-microblaze.c | ||
14 | +++ b/bfd/elf32-microblaze.c | ||
15 | @@ -1906,6 +1906,45 @@ 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 | + | ||
49 | + irelscan->r_addend -= calc_fixup (irelscan->r_addend | ||
50 | + + isym->st_value, sec); | ||
51 | + val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); | ||
52 | + microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, | ||
53 | + irelscan->r_addend); | ||
54 | + } | ||
55 | + if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) { | ||
56 | + fprintf(stderr, "Unhandled NONE 64\n"); | ||
57 | + } | ||
58 | if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) | ||
59 | { | ||
60 | isym = isymbuf + ELF32_R_SYM (irelscan->r_info); | ||
61 | diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c | ||
62 | index b241743..7dd5895 100644 | ||
63 | --- a/gas/config/tc-microblaze.c | ||
64 | +++ b/gas/config/tc-microblaze.c | ||
65 | @@ -2169,6 +2169,7 @@ md_apply_fix (fixS * fixP, | ||
66 | else | ||
67 | fixP->fx_r_type = BFD_RELOC_NONE; | ||
68 | fixP->fx_addsy = section_symbol (absolute_section); | ||
69 | + fixP->fx_done = 0; | ||
70 | } | ||
71 | return; | ||
72 | } | ||
73 | -- | ||
74 | 1.7.9.5 | ||
75 | |||