summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools/binutils')
-rw-r--r--recipes-devtools/binutils/binutils-cross-canadian_2.24.bbappend1
-rw-r--r--recipes-devtools/binutils/binutils-cross_2.24.bbappend1
-rw-r--r--recipes-devtools/binutils/binutils-crosssdk_2.24.bbappend1
-rw-r--r--recipes-devtools/binutils/binutils-microblaze-2.24.inc11
-rw-r--r--recipes-devtools/binutils/binutils_2.24.bbappend1
-rw-r--r--recipes-devtools/binutils/files/Add-mlittle-endian-and-mbig-endian.patch64
-rw-r--r--recipes-devtools/binutils/files/Add-wdc.ext.clear-and-wdc.ext.flush.patch67
-rw-r--r--recipes-devtools/binutils/files/Disable-the-warning-message-for-eh_frame_hdr.patch33
-rw-r--r--recipes-devtools/binutils/files/Fix-relaxation-of-assembler-resolved-reference.patch75
-rw-r--r--recipes-devtools/binutils/files/Fixup-debug_loc-sections-after-linker-relaxati.patch228
-rw-r--r--recipes-devtools/binutils/files/upstream-change-to-garbage-collection-s.patch38
11 files changed, 520 insertions, 0 deletions
diff --git a/recipes-devtools/binutils/binutils-cross-canadian_2.24.bbappend b/recipes-devtools/binutils/binutils-cross-canadian_2.24.bbappend
new file mode 100644
index 00000000..e42e7a60
--- /dev/null
+++ b/recipes-devtools/binutils/binutils-cross-canadian_2.24.bbappend
@@ -0,0 +1 @@
require binutils-microblaze-${PV}.inc
diff --git a/recipes-devtools/binutils/binutils-cross_2.24.bbappend b/recipes-devtools/binutils/binutils-cross_2.24.bbappend
new file mode 100644
index 00000000..e42e7a60
--- /dev/null
+++ b/recipes-devtools/binutils/binutils-cross_2.24.bbappend
@@ -0,0 +1 @@
require binutils-microblaze-${PV}.inc
diff --git a/recipes-devtools/binutils/binutils-crosssdk_2.24.bbappend b/recipes-devtools/binutils/binutils-crosssdk_2.24.bbappend
new file mode 100644
index 00000000..e42e7a60
--- /dev/null
+++ b/recipes-devtools/binutils/binutils-crosssdk_2.24.bbappend
@@ -0,0 +1 @@
require binutils-microblaze-${PV}.inc
diff --git a/recipes-devtools/binutils/binutils-microblaze-2.24.inc b/recipes-devtools/binutils/binutils-microblaze-2.24.inc
new file mode 100644
index 00000000..71b50ee8
--- /dev/null
+++ b/recipes-devtools/binutils/binutils-microblaze-2.24.inc
@@ -0,0 +1,11 @@
1
2# Add MicroBlaze Patches
3FILESEXTRAPATHS_append := "${THISDIR}/files:"
4SRC_URI_append += " \
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-devtools/binutils/binutils_2.24.bbappend b/recipes-devtools/binutils/binutils_2.24.bbappend
new file mode 100644
index 00000000..e42e7a60
--- /dev/null
+++ b/recipes-devtools/binutils/binutils_2.24.bbappend
@@ -0,0 +1 @@
require binutils-microblaze-${PV}.inc
diff --git a/recipes-devtools/binutils/files/Add-mlittle-endian-and-mbig-endian.patch b/recipes-devtools/binutils/files/Add-mlittle-endian-and-mbig-endian.patch
new file mode 100644
index 00000000..984fda3f
--- /dev/null
+++ b/recipes-devtools/binutils/files/Add-mlittle-endian-and-mbig-endian.patch
@@ -0,0 +1,64 @@
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-devtools/binutils/files/Add-wdc.ext.clear-and-wdc.ext.flush.patch b/recipes-devtools/binutils/files/Add-wdc.ext.clear-and-wdc.ext.flush.patch
new file mode 100644
index 00000000..cb58f603
--- /dev/null
+++ b/recipes-devtools/binutils/files/Add-wdc.ext.clear-and-wdc.ext.flush.patch
@@ -0,0 +1,67 @@
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-devtools/binutils/files/Disable-the-warning-message-for-eh_frame_hdr.patch b/recipes-devtools/binutils/files/Disable-the-warning-message-for-eh_frame_hdr.patch
new file mode 100644
index 00000000..f6616a1b
--- /dev/null
+++ b/recipes-devtools/binutils/files/Disable-the-warning-message-for-eh_frame_hdr.patch
@@ -0,0 +1,33 @@
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-devtools/binutils/files/Fix-relaxation-of-assembler-resolved-reference.patch b/recipes-devtools/binutils/files/Fix-relaxation-of-assembler-resolved-reference.patch
new file mode 100644
index 00000000..fb3ff355
--- /dev/null
+++ b/recipes-devtools/binutils/files/Fix-relaxation-of-assembler-resolved-reference.patch
@@ -0,0 +1,75 @@
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-devtools/binutils/files/Fixup-debug_loc-sections-after-linker-relaxati.patch b/recipes-devtools/binutils/files/Fixup-debug_loc-sections-after-linker-relaxati.patch
new file mode 100644
index 00000000..51ba11c4
--- /dev/null
+++ b/recipes-devtools/binutils/files/Fixup-debug_loc-sections-after-linker-relaxati.patch
@@ -0,0 +1,228 @@
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 41f7a68..b8c73b0 100644
27--- a/bfd/bfd-in2.h
28+++ b/bfd/bfd-in2.h
29@@ -5190,6 +5190,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 d94ac32..7cd0195 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@@ -1851,14 +1868,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, 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@@ -1906,12 +1931,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@@ -1936,15 +1965,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, 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@@ -2004,7 +2033,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 1381803..034efb8 100644
151--- a/bfd/libbfd.h
152+++ b/bfd/libbfd.h
153@@ -2513,6 +2513,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 25c089c..3d2a8a8 100644
163--- a/bfd/reloc.c
164+++ b/bfd/reloc.c
165@@ -6048,6 +6048,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 19b46c9..81a027c 100644
180--- a/binutils/readelf.c
181+++ b/binutils/readelf.c
182@@ -10547,6 +10547,10 @@ is_none_reloc (unsigned int reloc_type)
183 return reloc_type == 0;
184 case EM_AARCH64:
185 return reloc_type == 0 || reloc_type == 256;
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 case EM_XTENSA_OLD:
191 case EM_XTENSA:
192 return (reloc_type == 0 /* R_XTENSA_NONE. */
193diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
194index 7dd5895..884819f 100644
195--- a/gas/config/tc-microblaze.c
196+++ b/gas/config/tc-microblaze.c
197@@ -2166,6 +2166,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@@ -2387,6 +2389,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 c4d9821..72771e8 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.8.5.1
228
diff --git a/recipes-devtools/binutils/files/upstream-change-to-garbage-collection-s.patch b/recipes-devtools/binutils/files/upstream-change-to-garbage-collection-s.patch
new file mode 100644
index 00000000..aa571d45
--- /dev/null
+++ b/recipes-devtools/binutils/files/upstream-change-to-garbage-collection-s.patch
@@ -0,0 +1,38 @@
1From: David Holsgrove <david.holsgrove@xilinx.com>
2Date: Wed, 27 Feb 2013 13:56:11 +1000
3Subject: upstream change to garbage collection sweep causes mb regression
4
5Upstream change for PR13177 now clears the def_regular during gc_sweep of a
6section. (All other archs in binutils/bfd/elf32-*.c received an update
7to a warning about unresolvable relocations - this warning is not present
8in binutils/bfd/elf32-microblaze.c, but this warning check would not
9prevent the error being seen)
10
11The visible issue with this change is when running a c++ application
12in Petalinux which links libstdc++.so for exception handling it segfaults
13on execution.
14
15This does not occur if static linking libstdc++.a, so its during the
16relocations for a shared lib with garbage collection this occurs
17
18Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
19Upstream-Status: Pending
20---
21 bfd/elflink.c | 1 -
22 1 file changed, 1 deletion(-)
23
24diff --git a/bfd/elflink.c b/bfd/elflink.c
25index 99b7ca1..415d714 100644
26--- a/bfd/elflink.c
27+++ b/bfd/elflink.c
28@@ -11909,7 +11909,6 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
29
30 inf = (struct elf_gc_sweep_symbol_info *) data;
31 (*inf->hide_symbol) (inf->info, h, TRUE);
32- h->def_regular = 0;
33 h->ref_regular = 0;
34 h->ref_regular_nonweak = 0;
35 }
36--
371.8.5.1
38