summaryrefslogtreecommitdiffstats
path: root/recipes-devtools
diff options
context:
space:
mode:
authorNathan Rossi <nathan.rossi@xilinx.com>2013-12-16 15:01:13 +1000
committerNathan Rossi <nathan.rossi@xilinx.com>2013-12-16 15:28:13 +1000
commit3ec0d044ea0c5fca26eecc0335bb9847871255ea (patch)
treee658d8dcfbdb27880b844e320dfec03b2e582465 /recipes-devtools
parent82fcd5710441815ef5ab1677db7f724b84f2ae45 (diff)
downloadmeta-xilinx-3ec0d044ea0c5fca26eecc0335bb9847871255ea.tar.gz
binutils: Update binutils patches
* Update patches to match current Xilinx binutils work Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
Diffstat (limited to 'recipes-devtools')
-rw-r--r--recipes-devtools/binutils/binutils-microblaze-2.23.2.inc6
-rw-r--r--recipes-devtools/binutils/files/0014-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch67
-rw-r--r--recipes-devtools/binutils/files/0015-Patch-microblaze-Add-mlittle-endian-and-mbig-endian-.patch64
-rw-r--r--recipes-devtools/binutils/files/0016-Disable-the-warning-message-for-eh_frame_hdr.patch33
-rw-r--r--recipes-devtools/binutils/files/0017-Fix-relaxation-of-assembler-resolved-reference.patch75
-rw-r--r--recipes-devtools/binutils/files/0018-Fixup-debug_loc-sections-after-linker-relaxati.patch232
-rw-r--r--recipes-devtools/binutils/files/0019-upstream-change-to-garbage-collection-s.patch38
7 files changed, 515 insertions, 0 deletions
diff --git a/recipes-devtools/binutils/binutils-microblaze-2.23.2.inc b/recipes-devtools/binutils/binutils-microblaze-2.23.2.inc
index 71112efb..b75ed20d 100644
--- a/recipes-devtools/binutils/binutils-microblaze-2.23.2.inc
+++ b/recipes-devtools/binutils/binutils-microblaze-2.23.2.inc
@@ -15,4 +15,10 @@ SRC_URI_append += " \
15 file://0011-77625f8c77d14a67bc542bb790e6f826c725de4c.patch \ 15 file://0011-77625f8c77d14a67bc542bb790e6f826c725de4c.patch \
16 file://0012-b0ea811a61103f378351c9aa2cb16bd3010b0a31.patch \ 16 file://0012-b0ea811a61103f378351c9aa2cb16bd3010b0a31.patch \
17 file://0013-19e05575d97b6dc83dae1b8309624da3102d7a74.patch \ 17 file://0013-19e05575d97b6dc83dae1b8309624da3102d7a74.patch \
18 file://0014-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch \
19 file://0015-Patch-microblaze-Add-mlittle-endian-and-mbig-endian-.patch \
20 file://0016-Disable-the-warning-message-for-eh_frame_hdr.patch \
21 file://0017-Fix-relaxation-of-assembler-resolved-reference.patch \
22 file://0018-Fixup-debug_loc-sections-after-linker-relaxati.patch \
23 file://0019-upstream-change-to-garbage-collection-s.patch \
18 " 24 "
diff --git a/recipes-devtools/binutils/files/0014-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch b/recipes-devtools/binutils/files/0014-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch
new file mode 100644
index 00000000..cb58f603
--- /dev/null
+++ b/recipes-devtools/binutils/files/0014-Patch-microblaze-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/0015-Patch-microblaze-Add-mlittle-endian-and-mbig-endian-.patch b/recipes-devtools/binutils/files/0015-Patch-microblaze-Add-mlittle-endian-and-mbig-endian-.patch
new file mode 100644
index 00000000..984fda3f
--- /dev/null
+++ b/recipes-devtools/binutils/files/0015-Patch-microblaze-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/0016-Disable-the-warning-message-for-eh_frame_hdr.patch b/recipes-devtools/binutils/files/0016-Disable-the-warning-message-for-eh_frame_hdr.patch
new file mode 100644
index 00000000..f6616a1b
--- /dev/null
+++ b/recipes-devtools/binutils/files/0016-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/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 @@
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/0018-Fixup-debug_loc-sections-after-linker-relaxati.patch b/recipes-devtools/binutils/files/0018-Fixup-debug_loc-sections-after-linker-relaxati.patch
new file mode 100644
index 00000000..05a3e083
--- /dev/null
+++ b/recipes-devtools/binutils/files/0018-Fixup-debug_loc-sections-after-linker-relaxati.patch
@@ -0,0 +1,232 @@
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 | 7 ++++++-
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, 58 insertions(+), 9 deletions(-)
24
25diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
26index 1e47573..d50375e 100644
27--- a/bfd/bfd-in2.h
28+++ b/bfd/bfd-in2.h
29@@ -5035,9 +5035,14 @@ 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 64 bit reloc that stores the 32 bit pc relative
34+/* This is a 32 bit reloc that stores the 32 bit pc relative
35 value in two words (with an imm instruction). No relocation is
36 done here - only used for relaxing */
37+ BFD_RELOC_MICROBLAZE_32_NONE,
38+
39+/* This is a 64 bit reloc that stores the 32 bit pc relative
40+value in two words (with an imm instruction). No relocation is
41+done here - only used for relaxing */
42 BFD_RELOC_MICROBLAZE_64_NONE,
43
44 /* This is a 64 bit reloc that stores the 32 bit pc relative
45diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
46index 9de2479..1f20e23 100644
47--- a/bfd/elf32-microblaze.c
48+++ b/bfd/elf32-microblaze.c
49@@ -177,6 +177,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
50 FALSE), /* PC relative offset? */
51
52 /* This reloc does nothing. Used for relaxation. */
53+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
54+ 0, /* Rightshift. */
55+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
56+ 32, /* Bitsize. */
57+ TRUE, /* PC_relative. */
58+ 0, /* Bitpos. */
59+ complain_overflow_bitfield, /* Complain on overflow. */
60+ NULL, /* Special Function. */
61+ "R_MICROBLAZE_32_NONE",/* Name. */
62+ FALSE, /* Partial Inplace. */
63+ 0, /* Source Mask. */
64+ 0, /* Dest Mask. */
65+ FALSE), /* PC relative offset? */
66+
67 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
68 0, /* Rightshift. */
69 2, /* Size (0 = byte, 1 = short, 2 = long). */
70@@ -532,7 +546,10 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
71 case BFD_RELOC_NONE:
72 microblaze_reloc = R_MICROBLAZE_NONE;
73 break;
74- case BFD_RELOC_MICROBLAZE_64_NONE:
75+ case BFD_RELOC_MICROBLAZE_32_NONE:
76+ microblaze_reloc = R_MICROBLAZE_32_NONE;
77+ break;
78+ case BFD_RELOC_MICROBLAZE_64_NONE:
79 microblaze_reloc = R_MICROBLAZE_64_NONE;
80 break;
81 case BFD_RELOC_32:
82@@ -1851,14 +1868,22 @@ microblaze_elf_relax_section (bfd *abfd,
83 }
84 break;
85 case R_MICROBLAZE_NONE:
86+ case R_MICROBLAZE_32_NONE:
87 {
88 /* This was a PC-relative instruction that was
89 completely resolved. */
90 int sfix, efix;
91+ unsigned int val;
92 bfd_vma target_address;
93 target_address = irel->r_addend + irel->r_offset;
94 sfix = calc_fixup (irel->r_offset, 0, sec);
95 efix = calc_fixup (target_address, 0, sec);
96+
97+ /* Validate the in-band val. */
98+ val = bfd_get_32 (abfd, contents + irel->r_offset);
99+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
100+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
101+ }
102 irel->r_addend -= (efix - sfix);
103 /* Should use HOWTO. */
104 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
105@@ -1906,12 +1931,16 @@ microblaze_elf_relax_section (bfd *abfd,
106 irelscanend = irelocs + o->reloc_count;
107 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
108 {
109- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE)
110+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
111 {
112 unsigned int val;
113
114 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
115
116+ /* hax: We only do the following fixup for debug location lists. */
117+ if (strcmp(".debug_loc", o->name))
118+ continue;
119+
120 /* This was a PC-relative instruction that was completely resolved. */
121 if (ocontents == NULL)
122 {
123@@ -1936,15 +1965,15 @@ microblaze_elf_relax_section (bfd *abfd,
124 }
125 }
126
127- irelscan->r_addend -= calc_fixup (irelscan->r_addend
128- + isym->st_value, sec);
129 val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
130+ if (val != irelscan->r_addend) {
131+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
132+ }
133+
134+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
135 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
136 irelscan->r_addend);
137 }
138- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) {
139- fprintf(stderr, "Unhandled NONE 64\n");
140- }
141 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
142 {
143 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
144@@ -2004,7 +2033,7 @@ microblaze_elf_relax_section (bfd *abfd,
145 elf_section_data (o)->this_hdr.contents = ocontents;
146 }
147 }
148- irelscan->r_addend -= calc_fixup (irel->r_addend
149+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
150 + isym->st_value,
151 0,
152 sec);
153diff --git a/bfd/libbfd.h b/bfd/libbfd.h
154index e20013a..7a943eb 100644
155--- a/bfd/libbfd.h
156+++ b/bfd/libbfd.h
157@@ -2411,6 +2411,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
158 "BFD_RELOC_MICROBLAZE_32_ROSDA",
159 "BFD_RELOC_MICROBLAZE_32_RWSDA",
160 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
161+ "BFD_RELOC_MICROBLAZE_32_NONE",
162 "BFD_RELOC_MICROBLAZE_64_NONE",
163 "BFD_RELOC_MICROBLAZE_64_GOTPC",
164 "BFD_RELOC_MICROBLAZE_64_GOT",
165diff --git a/bfd/reloc.c b/bfd/reloc.c
166index 76669fa..99496d8 100644
167--- a/bfd/reloc.c
168+++ b/bfd/reloc.c
169@@ -5842,6 +5842,12 @@ ENUMDOC
170 This is a 32 bit reloc for the microblaze to handle
171 expressions of the form "Symbol Op Symbol"
172 ENUM
173+ BFD_RELOC_MICROBLAZE_32_NONE
174+ENUMDOC
175+ This is a 32 bit reloc that stores the 32 bit pc relative
176+ value in two words (with an imm instruction). No relocation is
177+ done here - only used for relaxing
178+ENUM
179 BFD_RELOC_MICROBLAZE_64_NONE
180 ENUMDOC
181 This is a 64 bit reloc that stores the 32 bit pc relative
182diff --git a/binutils/readelf.c b/binutils/readelf.c
183index d9ec436..df892de 100644
184--- a/binutils/readelf.c
185+++ b/binutils/readelf.c
186@@ -10207,6 +10207,10 @@ is_none_reloc (unsigned int reloc_type)
187 return reloc_type == 0;
188 case EM_AARCH64:
189 return reloc_type == 0 || reloc_type == 256;
190+ case EM_MICROBLAZE:
191+ return reloc_type == 30 /* R_MICROBLAZE_32_NONE. */
192+ || reloc_type == 0 /* R_MICROBLAZE_NONE. */
193+ || reloc_type == 9; /* R_MICROBLAZE_64_NONE. */
194 case EM_XTENSA_OLD:
195 case EM_XTENSA:
196 return (reloc_type == 0 /* R_XTENSA_NONE. */
197diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
198index 7dd5895..884819f 100644
199--- a/gas/config/tc-microblaze.c
200+++ b/gas/config/tc-microblaze.c
201@@ -2166,6 +2166,8 @@ md_apply_fix (fixS * fixP,
202 moves code around due to relaxing. */
203 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
204 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
205+ else if (fixP->fx_r_type == BFD_RELOC_32)
206+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
207 else
208 fixP->fx_r_type = BFD_RELOC_NONE;
209 fixP->fx_addsy = section_symbol (absolute_section);
210@@ -2387,6 +2389,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
211 switch (fixp->fx_r_type)
212 {
213 case BFD_RELOC_NONE:
214+ case BFD_RELOC_MICROBLAZE_32_NONE:
215 case BFD_RELOC_MICROBLAZE_64_NONE:
216 case BFD_RELOC_32:
217 case BFD_RELOC_MICROBLAZE_32_LO:
218diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
219index c4d9821..72771e8 100644
220--- a/include/elf/microblaze.h
221+++ b/include/elf/microblaze.h
222@@ -58,6 +58,7 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
223 RELOC_NUMBER (R_MICROBLAZE_TLSDTPREL64, 27) /* TLS Offset Within TLS Block */
224 RELOC_NUMBER (R_MICROBLAZE_TLSGOTTPREL32, 28) /* TLS Offset From Thread Pointer */
225 RELOC_NUMBER (R_MICROBLAZE_TLSTPREL32, 29) /* TLS Offset From Thread Pointer */
226+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 30)
227
228 END_RELOC_NUMBERS (R_MICROBLAZE_max)
229
230--
2311.7.9.5
232
diff --git a/recipes-devtools/binutils/files/0019-upstream-change-to-garbage-collection-s.patch b/recipes-devtools/binutils/files/0019-upstream-change-to-garbage-collection-s.patch
new file mode 100644
index 00000000..e062ef0e
--- /dev/null
+++ b/recipes-devtools/binutils/files/0019-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 bcd3add..e6d7bfb 100644
26--- a/bfd/elflink.c
27+++ b/bfd/elflink.c
28@@ -11870,7 +11870,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.7.9.5
38