summaryrefslogtreecommitdiffstats
path: root/recipes-microblaze
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2015-09-02 21:13:49 +1000
committerNathan Rossi <nathan@nathanrossi.com>2015-09-02 21:13:49 +1000
commitb7960e3fc669cf2fda93265db9776d867d44683a (patch)
treeca714fadeeb5807260a8888c9e16e1c3b9183be3 /recipes-microblaze
parent08d2ad0f03fecf211355312264f20a15368b67d1 (diff)
downloadmeta-xilinx-b7960e3fc669cf2fda93265db9776d867d44683a.tar.gz
binutils: Update and drop patches
* Update recipe for minor 2.25 update in core * Drop any patches which are not upstream and are not required for a functional linux system * Use wildcard to make the recipe append to multiple versions of binutils Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Diffstat (limited to 'recipes-microblaze')
-rw-r--r--recipes-microblaze/binutils/binutils%.bbappend7
-rw-r--r--recipes-microblaze/binutils/binutils-cross-canadian_2.25.bbappend1
-rw-r--r--recipes-microblaze/binutils/binutils-cross_2.25.bbappend1
-rw-r--r--recipes-microblaze/binutils/binutils-crosssdk_2.25.bbappend1
-rw-r--r--recipes-microblaze/binutils/binutils-microblaze-2.25.inc11
-rw-r--r--recipes-microblaze/binutils/binutils_2.25.bbappend1
-rw-r--r--recipes-microblaze/binutils/files/Add-mlittle-endian-and-mbig-endian.patch64
-rw-r--r--recipes-microblaze/binutils/files/Add-wdc.ext.clear-and-wdc.ext.flush.patch67
-rw-r--r--recipes-microblaze/binutils/files/Disable-the-warning-message-for-eh_frame_hdr.patch33
-rw-r--r--recipes-microblaze/binutils/files/Fix-relaxation-of-assembler-resolved-reference.patch75
-rw-r--r--recipes-microblaze/binutils/files/Fixup-debug_loc-sections-after-linker-relaxati.patch228
11 files changed, 7 insertions, 482 deletions
diff --git a/recipes-microblaze/binutils/binutils%.bbappend b/recipes-microblaze/binutils/binutils%.bbappend
new file mode 100644
index 00000000..2b0db287
--- /dev/null
+++ b/recipes-microblaze/binutils/binutils%.bbappend
@@ -0,0 +1,7 @@
1
2# Add MicroBlaze Patches
3FILESEXTRAPATHS_append := "${THISDIR}/files:"
4SRC_URI_append_microblaze += " \
5 file://upstream-change-to-garbage-collection-s.patch \
6 "
7
diff --git a/recipes-microblaze/binutils/binutils-cross-canadian_2.25.bbappend b/recipes-microblaze/binutils/binutils-cross-canadian_2.25.bbappend
deleted file mode 100644
index e42e7a60..00000000
--- a/recipes-microblaze/binutils/binutils-cross-canadian_2.25.bbappend
+++ /dev/null
@@ -1 +0,0 @@
1require binutils-microblaze-${PV}.inc
diff --git a/recipes-microblaze/binutils/binutils-cross_2.25.bbappend b/recipes-microblaze/binutils/binutils-cross_2.25.bbappend
deleted file mode 100644
index e42e7a60..00000000
--- a/recipes-microblaze/binutils/binutils-cross_2.25.bbappend
+++ /dev/null
@@ -1 +0,0 @@
1require binutils-microblaze-${PV}.inc
diff --git a/recipes-microblaze/binutils/binutils-crosssdk_2.25.bbappend b/recipes-microblaze/binutils/binutils-crosssdk_2.25.bbappend
deleted file mode 100644
index e42e7a60..00000000
--- a/recipes-microblaze/binutils/binutils-crosssdk_2.25.bbappend
+++ /dev/null
@@ -1 +0,0 @@
1require binutils-microblaze-${PV}.inc
diff --git a/recipes-microblaze/binutils/binutils-microblaze-2.25.inc b/recipes-microblaze/binutils/binutils-microblaze-2.25.inc
deleted file mode 100644
index 96dbb058..00000000
--- a/recipes-microblaze/binutils/binutils-microblaze-2.25.inc
+++ /dev/null
@@ -1,11 +0,0 @@
1
2# Add MicroBlaze Patches
3FILESEXTRAPATHS_append := "${THISDIR}/files:"
4SRC_URI_append_microblaze += " \
5 file://Add-wdc.ext.clear-and-wdc.ext.flush.patch \
6 file://Add-mlittle-endian-and-mbig-endian.patch \
7 file://Disable-the-warning-message-for-eh_frame_hdr.patch \
8 file://Fix-relaxation-of-assembler-resolved-reference.patch \
9 file://Fixup-debug_loc-sections-after-linker-relaxati.patch \
10 file://upstream-change-to-garbage-collection-s.patch \
11 "
diff --git a/recipes-microblaze/binutils/binutils_2.25.bbappend b/recipes-microblaze/binutils/binutils_2.25.bbappend
deleted file mode 100644
index e42e7a60..00000000
--- a/recipes-microblaze/binutils/binutils_2.25.bbappend
+++ /dev/null
@@ -1 +0,0 @@
1require binutils-microblaze-${PV}.inc
diff --git a/recipes-microblaze/binutils/files/Add-mlittle-endian-and-mbig-endian.patch b/recipes-microblaze/binutils/files/Add-mlittle-endian-and-mbig-endian.patch
deleted file mode 100644
index 984fda3f..00000000
--- a/recipes-microblaze/binutils/files/Add-mlittle-endian-and-mbig-endian.patch
+++ /dev/null
@@ -1,64 +0,0 @@
1From: nagaraju <nmekala@xilix.com>
2Date: Tue, 19 Mar 2013 17:18:23 +0530
3Subject: Add mlittle-endian and mbig-endian flags
4
5Added support in gas for mlittle-endian and mbig-endian flags
6as options.
7
8Updated show usage for MicroBlaze specific assembler options
9to include new entries.
10
11Signed-off-by:nagaraju <nmekala@xilix.com>
12Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
13Upstream-Status: Pending
14---
15 gas/config/tc-microblaze.c | 9 +++++++++
16 1 file changed, 9 insertions(+)
17
18diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
19index 872737b..b241743 100644
20--- a/gas/config/tc-microblaze.c
21+++ b/gas/config/tc-microblaze.c
22@@ -37,6 +37,8 @@
23
24 #define OPTION_EB (OPTION_MD_BASE + 0)
25 #define OPTION_EL (OPTION_MD_BASE + 1)
26+#define OPTION_LITTLE (OPTION_MD_BASE + 2)
27+#define OPTION_BIG (OPTION_MD_BASE + 3)
28
29 void microblaze_generate_symbol (char *sym);
30 static bfd_boolean check_spl_reg (unsigned *);
31@@ -1824,6 +1826,8 @@ struct option md_longopts[] =
32 {
33 {"EB", no_argument, NULL, OPTION_EB},
34 {"EL", no_argument, NULL, OPTION_EL},
35+ {"mlittle-endian", no_argument, NULL, OPTION_LITTLE},
36+ {"mbig-endian", no_argument, NULL, OPTION_BIG},
37 { NULL, no_argument, NULL, 0}
38 };
39
40@@ -2457,9 +2461,11 @@ md_parse_option (int c, char * arg ATTRIBUTE_UNUSED)
41 switch (c)
42 {
43 case OPTION_EB:
44+ case OPTION_BIG:
45 target_big_endian = 1;
46 break;
47 case OPTION_EL:
48+ case OPTION_LITTLE:
49 target_big_endian = 0;
50 break;
51 default:
52@@ -2474,6 +2480,9 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
53 /* fprintf(stream, _("\
54 MicroBlaze options:\n\
55 -noSmall Data in the comm and data sections do not go into the small data section\n")); */
56+ fprintf (stream, _(" MicroBlaze specific assembler options:\n"));
57+ fprintf (stream, " -%-23s%s\n", "mbig-endian", N_("assemble for a big endian cpu"));
58+ fprintf (stream, " -%-23s%s\n", "mlittle-endian", N_("assemble for a little endian cpu"));
59 }
60
61
62--
631.7.9.5
64
diff --git a/recipes-microblaze/binutils/files/Add-wdc.ext.clear-and-wdc.ext.flush.patch b/recipes-microblaze/binutils/files/Add-wdc.ext.clear-and-wdc.ext.flush.patch
deleted file mode 100644
index cb58f603..00000000
--- a/recipes-microblaze/binutils/files/Add-wdc.ext.clear-and-wdc.ext.flush.patch
+++ /dev/null
@@ -1,67 +0,0 @@
1From: David Holsgrove <david.holsgrove@xilinx.com>
2Date: Wed, 8 May 2013 11:03:36 +1000
3Subject: Add wdc.ext.clear and wdc.ext.flush insns
4
5Added two new instructions, wdc.ext.clear and wdc.ext.flush,
6to enable MicroBlaze to flush an external cache, which is
7used with the new coherency support for multiprocessing.
8
9Signed-off-by:nagaraju <nmekala@xilix.com>
10Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
11Upstream-Status: Pending
12---
13 opcodes/microblaze-opc.h | 5 ++++-
14 opcodes/microblaze-opcm.h | 6 +++---
15 2 files changed, 7 insertions(+), 4 deletions(-)
16
17diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
18index e9da12a..dd56ab5 100644
19--- a/opcodes/microblaze-opc.h
20+++ b/opcodes/microblaze-opc.h
21@@ -91,6 +91,7 @@
22 #define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
23 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
24 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
25+#define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
26 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
27
28 /* New Mask for msrset, msrclr insns. */
29@@ -101,7 +102,7 @@
30 #define DELAY_SLOT 1
31 #define NO_DELAY_SLOT 0
32
33-#define MAX_OPCODES 289
34+#define MAX_OPCODES 291
35
36 struct op_code_struct
37 {
38@@ -174,7 +175,9 @@ struct op_code_struct
39 {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst },
40 {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst },
41 {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst },
42+ {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst },
43 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst },
44+ {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst },
45 {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst },
46 {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst },
47 {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst },
48diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
49index 124cdec..8e531f9 100644
50--- a/opcodes/microblaze-opcm.h
51+++ b/opcodes/microblaze-opcm.h
52@@ -31,9 +31,9 @@ enum microblaze_instr
53 idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
54 ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
55 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
56- wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd,
57- brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
58- bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
59+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, mts, mfs, mbar,
60+ br, brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned,
61+ blt, bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
62 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
63 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
64 bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh,
65--
661.7.9.5
67
diff --git a/recipes-microblaze/binutils/files/Disable-the-warning-message-for-eh_frame_hdr.patch b/recipes-microblaze/binutils/files/Disable-the-warning-message-for-eh_frame_hdr.patch
deleted file mode 100644
index f6616a1b..00000000
--- a/recipes-microblaze/binutils/files/Disable-the-warning-message-for-eh_frame_hdr.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
2Date: Fri, 22 Jun 2012 01:20:20 +0200
3Subject: Disable the warning message for eh_frame_hdr
4
5Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
6Upstream-Status: Pending
7---
8 bfd/elf-eh-frame.c | 9 ++++++---
9 1 file changed, 6 insertions(+), 3 deletions(-)
10
11diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
12index a75d806..de69cef 100644
13--- a/bfd/elf-eh-frame.c
14+++ b/bfd/elf-eh-frame.c
15@@ -913,9 +913,12 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
16 goto success;
17
18 free_no_table:
19- (*info->callbacks->einfo)
20- (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"),
21- abfd, sec);
22+ /* FIXME: Remove the microblaze specifics when relaxing gets fixed. */
23+ if (bfd_get_arch(abfd) != bfd_arch_microblaze) {
24+ (*info->callbacks->einfo)
25+ (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"),
26+ abfd, sec);
27+ }
28 hdr_info->table = FALSE;
29 if (sec_info)
30 free (sec_info);
31--
321.7.9.5
33
diff --git a/recipes-microblaze/binutils/files/Fix-relaxation-of-assembler-resolved-reference.patch b/recipes-microblaze/binutils/files/Fix-relaxation-of-assembler-resolved-reference.patch
deleted file mode 100644
index fb3ff355..00000000
--- a/recipes-microblaze/binutils/files/Fix-relaxation-of-assembler-resolved-reference.patch
+++ /dev/null
@@ -1,75 +0,0 @@
1From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
2Date: Tue, 14 Feb 2012 01:00:22 +0100
3Subject: Fix relaxation of assembler resolved references
4
5Upstream-Status: Pending
6---
7 bfd/elf32-microblaze.c | 39 +++++++++++++++++++++++++++++++++++++++
8 gas/config/tc-microblaze.c | 1 +
9 2 files changed, 40 insertions(+)
10
11diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
12index 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);
61diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
62index 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--
741.7.9.5
75
diff --git a/recipes-microblaze/binutils/files/Fixup-debug_loc-sections-after-linker-relaxati.patch b/recipes-microblaze/binutils/files/Fixup-debug_loc-sections-after-linker-relaxati.patch
deleted file mode 100644
index 0623e945..00000000
--- a/recipes-microblaze/binutils/files/Fixup-debug_loc-sections-after-linker-relaxati.patch
+++ /dev/null
@@ -1,228 +0,0 @@
1From: David Holsgrove <david.holsgrove@xilinx.com>
2Date: Mon, 4 Feb 2013 12:15:22 +1000
3Subject: Fixup debug_loc sections after linker relaxation
4
5Adds a new reloctype R_MICROBLAZE_32_NONE, used for passing
6reloc info from the assembler to the linker when the linker
7manages to fully resolve a local symbol reference.
8
9This is a workaround for design flaws in the assembler to
10linker interface with regards to linker relaxation.
11
12Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
14Upstream-Status: Pending
15---
16 bfd/bfd-in2.h | 5 +++++
17 bfd/elf32-microblaze.c | 45 +++++++++++++++++++++++++++++++++++++--------
18 bfd/libbfd.h | 1 +
19 bfd/reloc.c | 6 ++++++
20 binutils/readelf.c | 4 ++++
21 gas/config/tc-microblaze.c | 3 +++
22 include/elf/microblaze.h | 1 +
23 7 files changed, 57 insertions(+), 8 deletions(-)
24
25diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
26index 8b7f2ee..de38907 100644
27--- a/bfd/bfd-in2.h
28+++ b/bfd/bfd-in2.h
29@@ -5449,6 +5449,11 @@ value relative to the read-write small data area anchor */
30 expressions of the form "Symbol Op Symbol" */
31 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
32
33+/* This is a 32 bit reloc that stores the 32 bit pc relative
34+value in two words (with an imm instruction). No relocation is
35+done here - only used for relaxing */
36+ BFD_RELOC_MICROBLAZE_32_NONE,
37+
38 /* This is a 64 bit reloc that stores the 32 bit pc relative
39 value in two words (with an imm instruction). No relocation is
40 done here - only used for relaxing */
41diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
42index f90df47..d440084 100644
43--- a/bfd/elf32-microblaze.c
44+++ b/bfd/elf32-microblaze.c
45@@ -177,6 +177,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
46 FALSE), /* PC relative offset? */
47
48 /* This reloc does nothing. Used for relaxation. */
49+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
50+ 0, /* Rightshift. */
51+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
52+ 32, /* Bitsize. */
53+ TRUE, /* PC_relative. */
54+ 0, /* Bitpos. */
55+ complain_overflow_bitfield, /* Complain on overflow. */
56+ NULL, /* Special Function. */
57+ "R_MICROBLAZE_32_NONE",/* Name. */
58+ FALSE, /* Partial Inplace. */
59+ 0, /* Source Mask. */
60+ 0, /* Dest Mask. */
61+ FALSE), /* PC relative offset? */
62+
63 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
64 0, /* Rightshift. */
65 2, /* Size (0 = byte, 1 = short, 2 = long). */
66@@ -532,7 +546,10 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
67 case BFD_RELOC_NONE:
68 microblaze_reloc = R_MICROBLAZE_NONE;
69 break;
70- case BFD_RELOC_MICROBLAZE_64_NONE:
71+ case BFD_RELOC_MICROBLAZE_32_NONE:
72+ microblaze_reloc = R_MICROBLAZE_32_NONE;
73+ break;
74+ case BFD_RELOC_MICROBLAZE_64_NONE:
75 microblaze_reloc = R_MICROBLAZE_64_NONE;
76 break;
77 case BFD_RELOC_32:
78@@ -1913,14 +1930,22 @@ microblaze_elf_relax_section (bfd *abfd,
79 }
80 break;
81 case R_MICROBLAZE_NONE:
82+ case R_MICROBLAZE_32_NONE:
83 {
84 /* This was a PC-relative instruction that was
85 completely resolved. */
86 int sfix, efix;
87+ unsigned int val;
88 bfd_vma target_address;
89 target_address = irel->r_addend + irel->r_offset;
90 sfix = calc_fixup (irel->r_offset, 0, sec);
91 efix = calc_fixup (target_address, 0, sec);
92+
93+ /* Validate the in-band val. */
94+ val = bfd_get_32 (abfd, contents + irel->r_offset);
95+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
96+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, (unsigned long)irel->r_addend);
97+ }
98 irel->r_addend -= (efix - sfix);
99 /* Should use HOWTO. */
100 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
101@@ -1968,12 +1993,16 @@ microblaze_elf_relax_section (bfd *abfd,
102 irelscanend = irelocs + o->reloc_count;
103 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
104 {
105- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE)
106+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
107 {
108 unsigned int val;
109
110 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
111
112+ /* hax: We only do the following fixup for debug location lists. */
113+ if (strcmp(".debug_loc", o->name))
114+ continue;
115+
116 /* This was a PC-relative instruction that was completely resolved. */
117 if (ocontents == NULL)
118 {
119@@ -1998,15 +2027,15 @@ microblaze_elf_relax_section (bfd *abfd,
120 }
121 }
122
123- irelscan->r_addend -= calc_fixup (irelscan->r_addend
124- + isym->st_value, sec);
125 val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
126+ if (val != irelscan->r_addend) {
127+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, (unsigned long)irelscan->r_addend);
128+ }
129+
130+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
131 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
132 irelscan->r_addend);
133 }
134- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) {
135- fprintf(stderr, "Unhandled NONE 64\n");
136- }
137 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
138 {
139 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
140@@ -2066,7 +2095,7 @@ microblaze_elf_relax_section (bfd *abfd,
141 elf_section_data (o)->this_hdr.contents = ocontents;
142 }
143 }
144- irelscan->r_addend -= calc_fixup (irel->r_addend
145+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
146 + isym->st_value,
147 0,
148 sec);
149diff --git a/bfd/libbfd.h b/bfd/libbfd.h
150index 09f307f..840c662 100644
151--- a/bfd/libbfd.h
152+++ b/bfd/libbfd.h
153@@ -2644,6 +2644,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
154 "BFD_RELOC_MICROBLAZE_32_ROSDA",
155 "BFD_RELOC_MICROBLAZE_32_RWSDA",
156 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
157+ "BFD_RELOC_MICROBLAZE_32_NONE",
158 "BFD_RELOC_MICROBLAZE_64_NONE",
159 "BFD_RELOC_MICROBLAZE_64_GOTPC",
160 "BFD_RELOC_MICROBLAZE_64_GOT",
161diff --git a/bfd/reloc.c b/bfd/reloc.c
162index 7f46c58..5bcd52d 100644
163--- a/bfd/reloc.c
164+++ b/bfd/reloc.c
165@@ -6396,6 +6396,12 @@ ENUMDOC
166 This is a 32 bit reloc for the microblaze to handle
167 expressions of the form "Symbol Op Symbol"
168 ENUM
169+ BFD_RELOC_MICROBLAZE_32_NONE
170+ENUMDOC
171+ This is a 32 bit reloc that stores the 32 bit pc relative
172+ value in two words (with an imm instruction). No relocation is
173+ done here - only used for relaxing
174+ENUM
175 BFD_RELOC_MICROBLAZE_64_NONE
176 ENUMDOC
177 This is a 64 bit reloc that stores the 32 bit pc relative
178diff --git a/binutils/readelf.c b/binutils/readelf.c
179index af6463e..343eb61 100644
180--- a/binutils/readelf.c
181+++ b/binutils/readelf.c
182@@ -10821,6 +10821,10 @@ is_none_reloc (unsigned int reloc_type)
183 || reloc_type == 19 /* R_XTENSA_DIFF32. */);
184 case EM_METAG:
185 return reloc_type == 3; /* R_METAG_NONE. */
186+ case EM_MICROBLAZE:
187+ return reloc_type == 30 /* R_MICROBLAZE_32_NONE. */
188+ || reloc_type == 0 /* R_MICROBLAZE_NONE. */
189+ || reloc_type == 9; /* R_MICROBLAZE_64_NONE. */
190 }
191 return FALSE;
192 }
193diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
194index 12ad616..46d61db 100644
195--- a/gas/config/tc-microblaze.c
196+++ b/gas/config/tc-microblaze.c
197@@ -2167,6 +2167,8 @@ md_apply_fix (fixS * fixP,
198 moves code around due to relaxing. */
199 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
200 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
201+ else if (fixP->fx_r_type == BFD_RELOC_32)
202+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
203 else
204 fixP->fx_r_type = BFD_RELOC_NONE;
205 fixP->fx_addsy = section_symbol (absolute_section);
206@@ -2388,6 +2390,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
207 switch (fixp->fx_r_type)
208 {
209 case BFD_RELOC_NONE:
210+ case BFD_RELOC_MICROBLAZE_32_NONE:
211 case BFD_RELOC_MICROBLAZE_64_NONE:
212 case BFD_RELOC_32:
213 case BFD_RELOC_MICROBLAZE_32_LO:
214diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
215index effca20..f8420dc 100644
216--- a/include/elf/microblaze.h
217+++ b/include/elf/microblaze.h
218@@ -58,6 +58,7 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
219 RELOC_NUMBER (R_MICROBLAZE_TLSDTPREL64, 27) /* TLS Offset Within TLS Block */
220 RELOC_NUMBER (R_MICROBLAZE_TLSGOTTPREL32, 28) /* TLS Offset From Thread Pointer */
221 RELOC_NUMBER (R_MICROBLAZE_TLSTPREL32, 29) /* TLS Offset From Thread Pointer */
222+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 30)
223
224 END_RELOC_NUMBERS (R_MICROBLAZE_max)
225
226--
2271.9.0
228