summaryrefslogtreecommitdiffstats
path: root/recipes-devtools
diff options
context:
space:
mode:
authorNathan Rossi <nathan.rossi@xilinx.com>2015-04-17 15:38:04 +1000
committerNathan Rossi <nathan.rossi@xilinx.com>2015-04-17 15:38:04 +1000
commitf80dac49ecbd4b3de0abc6e89bb1ed04d5c67b24 (patch)
treeb97875886e89d162febb57d5a49453bdd7d1b9ba /recipes-devtools
parent1207db6f96a0c1bd0fb95a176cc8d5627dd406ed (diff)
downloadmeta-xilinx-f80dac49ecbd4b3de0abc6e89bb1ed04d5c67b24.tar.gz
recipes-microblaze: Move all MicroBlaze appends
* Move recipes that are specifically for MicroBlaze support into the recipes-microblaze directory Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
Diffstat (limited to 'recipes-devtools')
-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
-rw-r--r--recipes-devtools/gcc/files/0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch158
-rw-r--r--recipes-devtools/gcc/files/0002-Patch-microblaze-Add-4-byte-implementation-for-atomi.patch157
-rw-r--r--recipes-devtools/gcc/files/0003-Patch-microblaze-Extend-jump-insn-to-accept-bri-to-S.patch35
-rw-r--r--recipes-devtools/gcc/files/0005-Patch-microblaze-Add-fstack-usage-support.patch30
-rw-r--r--recipes-devtools/gcc/files/0006-Patch-microblaze-Remove-SECONDARY_MEMORY_NEEDED.patch35
-rw-r--r--recipes-devtools/gcc/files/0007-Patch-microblaze-Add-SIZE_TYPE-and-PTRDIFF_TYPE-to-m.patch39
-rw-r--r--recipes-devtools/gcc/files/0008-Patch-microblaze-Add-branch_compare-instruction.patch224
-rw-r--r--recipes-devtools/gcc/files/0462b5f-2014-02-23-David-Holsgrove-david.holsgrove.patch108
-rw-r--r--recipes-devtools/gcc/files/Patch-microblaze-Fix-bswaphi2-implementation.patch44
-rw-r--r--recipes-devtools/gcc/files/Patch-microblaze-cstoresf4-add-mode-and-ordered_comp.patch44
-rw-r--r--recipes-devtools/gcc/files/gcc-Cherry-pick-mainline-patch-to-resolve-MB-k.patch110
-rw-r--r--recipes-devtools/gcc/gcc-microblaze-4.8.inc16
-rw-r--r--recipes-devtools/gcc/gcc-source_4.8.bbappend1
-rw-r--r--recipes-devtools/gdb/files/0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch69
-rw-r--r--recipes-devtools/gdb/files/0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch384
-rw-r--r--recipes-devtools/gdb/files/0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch67
-rw-r--r--recipes-devtools/gdb/files/0005-Patch-microblaze-Add-mb-singlestepping.patch200
-rw-r--r--recipes-devtools/gdb/files/0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch553
-rw-r--r--recipes-devtools/gdb/files/0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch82
-rw-r--r--recipes-devtools/gdb/files/0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch156
-rw-r--r--recipes-devtools/gdb/files/0009-Patch-microblaze-Initial-support-for-native-gdb.patch495
-rw-r--r--recipes-devtools/gdb/files/0010-Patch-gdb-Robustify-inline-function-support.patch43
-rw-r--r--recipes-devtools/gdb/files/0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch43
-rw-r--r--recipes-devtools/gdb/files/0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch34
-rw-r--r--recipes-devtools/gdb/files/0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch64
-rw-r--r--recipes-devtools/gdb/files/0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch192
-rw-r--r--recipes-devtools/gdb/files/0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch40
-rw-r--r--recipes-devtools/gdb/gdb-7.7.1.inc11
-rw-r--r--recipes-devtools/gdb/gdb-cross-canadian_7.7.1.bb4
-rw-r--r--recipes-devtools/gdb/gdb-cross_7.7.1.bb3
-rw-r--r--recipes-devtools/gdb/gdb-microblaze-7.7.inc22
-rw-r--r--recipes-devtools/gdb/gdb_7.7.1.bb29
-rw-r--r--recipes-devtools/gnu-config/files/microblazeel.patch68
-rw-r--r--recipes-devtools/gnu-config/gnu-config_20120814.bbappend6
-rw-r--r--recipes-devtools/qemu/qemu_%.bbappend2
46 files changed, 0 insertions, 4088 deletions
diff --git a/recipes-devtools/binutils/binutils-cross-canadian_2.24.bbappend b/recipes-devtools/binutils/binutils-cross-canadian_2.24.bbappend
deleted file mode 100644
index e42e7a60..00000000
--- a/recipes-devtools/binutils/binutils-cross-canadian_2.24.bbappend
+++ /dev/null
@@ -1 +0,0 @@
1require binutils-microblaze-${PV}.inc
diff --git a/recipes-devtools/binutils/binutils-cross_2.24.bbappend b/recipes-devtools/binutils/binutils-cross_2.24.bbappend
deleted file mode 100644
index e42e7a60..00000000
--- a/recipes-devtools/binutils/binutils-cross_2.24.bbappend
+++ /dev/null
@@ -1 +0,0 @@
1require binutils-microblaze-${PV}.inc
diff --git a/recipes-devtools/binutils/binutils-crosssdk_2.24.bbappend b/recipes-devtools/binutils/binutils-crosssdk_2.24.bbappend
deleted file mode 100644
index e42e7a60..00000000
--- a/recipes-devtools/binutils/binutils-crosssdk_2.24.bbappend
+++ /dev/null
@@ -1 +0,0 @@
1require binutils-microblaze-${PV}.inc
diff --git a/recipes-devtools/binutils/binutils-microblaze-2.24.inc b/recipes-devtools/binutils/binutils-microblaze-2.24.inc
deleted file mode 100644
index 71b50ee8..00000000
--- a/recipes-devtools/binutils/binutils-microblaze-2.24.inc
+++ /dev/null
@@ -1,11 +0,0 @@
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
deleted file mode 100644
index e42e7a60..00000000
--- a/recipes-devtools/binutils/binutils_2.24.bbappend
+++ /dev/null
@@ -1 +0,0 @@
1require 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
deleted file mode 100644
index 984fda3f..00000000
--- a/recipes-devtools/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-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
deleted file mode 100644
index cb58f603..00000000
--- a/recipes-devtools/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-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
deleted file mode 100644
index f6616a1b..00000000
--- a/recipes-devtools/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-devtools/binutils/files/Fix-relaxation-of-assembler-resolved-reference.patch b/recipes-devtools/binutils/files/Fix-relaxation-of-assembler-resolved-reference.patch
deleted file mode 100644
index fb3ff355..00000000
--- a/recipes-devtools/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-devtools/binutils/files/Fixup-debug_loc-sections-after-linker-relaxati.patch b/recipes-devtools/binutils/files/Fixup-debug_loc-sections-after-linker-relaxati.patch
deleted file mode 100644
index 0623e945..00000000
--- a/recipes-devtools/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
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
deleted file mode 100644
index aa571d45..00000000
--- a/recipes-devtools/binutils/files/upstream-change-to-garbage-collection-s.patch
+++ /dev/null
@@ -1,38 +0,0 @@
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
diff --git a/recipes-devtools/gcc/files/0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch b/recipes-devtools/gcc/files/0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch
deleted file mode 100644
index d6549cad..00000000
--- a/recipes-devtools/gcc/files/0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch
+++ /dev/null
@@ -1,158 +0,0 @@
1From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
2Subject: [PATCH 1/8] [Patch, microblaze]: Enable DWARF exception handling
3 support.
4
5Changelog
6
72013-03-18 Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8 David Holsgrove <david.holsgrove@xilinx.com>
9
10 * common/config/microblaze/microblaze-common.c: Remove
11 TARGET_EXCEPT_UNWIND_INFO definition.
12 * config/microblaze/microblaze-protos.h: Add
13 microblaze_eh_return prototype.
14 * gcc/config/microblaze/microblaze.c: (microblaze_must_save_register,
15 microblaze_expand_epilogue, microblaze_return_addr): Handle
16 calls_eh_return
17 (microblaze_eh_return): New function.
18 * gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET,
19 EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM, EH_RETURN_STACKADJ_RTX,
20 ASM_PREFERRED_EH_DATA_FORMAT
21 * gcc/config/microblaze/microblaze.md: Define eh_return pattern.
22
23Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
24Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
25Upstream-Status: Pending
26
27diff --git a/gcc/common/config/microblaze/microblaze-common.c b/gcc/common/config/microblaze/microblaze-common.c
28index 07a71fb..6c25a76 100644
29--- a/gcc/common/config/microblaze/microblaze-common.c
30+++ b/gcc/common/config/microblaze/microblaze-common.c
31@@ -37,7 +37,4 @@ static const struct default_options microblaze_option_optimization_table[] =
32 #undef TARGET_OPTION_OPTIMIZATION_TABLE
33 #define TARGET_OPTION_OPTIMIZATION_TABLE microblaze_option_optimization_table
34
35-#undef TARGET_EXCEPT_UNWIND_INFO
36-#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info
37-
38 struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
39diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h
40index 34be76f..201390b 100644
41--- a/gcc/config/microblaze/microblaze-protos.h
42+++ b/gcc/config/microblaze/microblaze-protos.h
43@@ -54,6 +54,7 @@ extern bool microblaze_tls_referenced_p (rtx);
44 extern int symbol_mentioned_p (rtx);
45 extern int label_mentioned_p (rtx);
46 extern bool microblaze_cannot_force_const_mem (enum machine_mode, rtx);
47+extern void microblaze_eh_return (rtx op0);
48 #endif /* RTX_CODE */
49
50 /* Declare functions in microblaze-c.c. */
51diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
52index c121c2b..5f4bc60 100644
53--- a/gcc/config/microblaze/microblaze.c
54+++ b/gcc/config/microblaze/microblaze.c
55@@ -1896,6 +1896,11 @@ microblaze_must_save_register (int regno)
56 if (frame_pointer_needed && (regno == HARD_FRAME_POINTER_REGNUM))
57 return 1;
58
59+ if (crtl->calls_eh_return
60+ && regno == MB_ABI_SUB_RETURN_ADDR_REGNUM) {
61+ return 1;
62+ }
63+
64 if (!crtl->is_leaf)
65 {
66 if (regno == MB_ABI_SUB_RETURN_ADDR_REGNUM)
67@@ -1923,6 +1928,13 @@ microblaze_must_save_register (int regno)
68 return 1;
69 }
70
71+ if (crtl->calls_eh_return
72+ && (regno == EH_RETURN_DATA_REGNO (0)
73+ || regno == EH_RETURN_DATA_REGNO (1)))
74+ {
75+ return 1;
76+ }
77+
78 return 0;
79 }
80
81@@ -2939,6 +2951,12 @@ microblaze_expand_epilogue (void)
82 emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx));
83 }
84
85+ if (crtl->calls_eh_return)
86+ emit_insn (gen_addsi3 (stack_pointer_rtx,
87+ stack_pointer_rtx,
88+ gen_rtx_raw_REG (SImode,
89+ MB_EH_STACKADJ_REGNUM)));
90+
91 emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST +
92 MB_ABI_SUB_RETURN_ADDR_REGNUM)));
93 }
94@@ -3166,10 +3184,13 @@ microblaze_return_addr (int count, rtx frame ATTRIBUTE_UNUSED)
95 if (count != 0)
96 return NULL_RTX;
97
98- return gen_rtx_PLUS (Pmode,
99- get_hard_reg_initial_val (Pmode,
100- MB_ABI_SUB_RETURN_ADDR_REGNUM),
101- GEN_INT (8));
102+ return get_hard_reg_initial_val (Pmode,
103+ MB_ABI_SUB_RETURN_ADDR_REGNUM);
104+}
105+
106+void microblaze_eh_return (rtx op0)
107+{
108+ emit_insn (gen_movsi(gen_rtx_MEM(Pmode, stack_pointer_rtx), op0));
109 }
110
111 /* Queue an .ident string in the queue of top-level asm statements.
112diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
113index bc4d9a1..074b78e 100644
114--- a/gcc/config/microblaze/microblaze.h
115+++ b/gcc/config/microblaze/microblaze.h
116@@ -184,6 +184,21 @@ extern enum pipeline_type microblaze_pipe;
117 #define INCOMING_RETURN_ADDR_RTX \
118 gen_rtx_REG (VOIDmode, GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM)
119
120+/* Specifies the offset from INCOMING_RETURN_ADDR_RTX and the actual return PC. */
121+#define RETURN_ADDR_OFFSET (8)
122+
123+/* Describe how we implement __builtin_eh_return. */
124+#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? MB_ABI_FIRST_ARG_REGNUM + (N) : INVALID_REGNUM)
125+
126+#define MB_EH_STACKADJ_REGNUM MB_ABI_INT_RETURN_VAL2_REGNUM
127+#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, MB_EH_STACKADJ_REGNUM)
128+
129+/* Select a format to encode pointers in exception handling data. CODE
130+ is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
131+ true if the symbol may be affected by dynamic relocations. */
132+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
133+ ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
134+
135 /* Use DWARF 2 debugging information by default. */
136 #define DWARF2_DEBUGGING_INFO
137 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
138diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
139index 3618cad..4e7fe3b 100644
140--- a/gcc/config/microblaze/microblaze.md
141+++ b/gcc/config/microblaze/microblaze.md
142@@ -2221,3 +2221,13 @@
143 [(set_attr "type" "arith")
144 (set_attr "mode" "SI")
145 (set_attr "length" "4")])
146+
147+; This is used in compiling the unwind routines.
148+(define_expand "eh_return"
149+ [(use (match_operand 0 "general_operand" ""))]
150+ ""
151+ "
152+{
153+ microblaze_eh_return(operands[0]);
154+ DONE;
155+}")
156--
1571.7.5.4
158
diff --git a/recipes-devtools/gcc/files/0002-Patch-microblaze-Add-4-byte-implementation-for-atomi.patch b/recipes-devtools/gcc/files/0002-Patch-microblaze-Add-4-byte-implementation-for-atomi.patch
deleted file mode 100644
index aefa13b0..00000000
--- a/recipes-devtools/gcc/files/0002-Patch-microblaze-Add-4-byte-implementation-for-atomi.patch
+++ /dev/null
@@ -1,157 +0,0 @@
1From: David Holsgrove <david.holsgrove@xilinx.com>
2Subject: [PATCH 2/8] [Patch, microblaze]: Add 4 byte implementation for
3 atomic builtin
4
5By providing this initial atomic implementation, gcc is able to generate the other atomic
6builtins by using a __sync_compare_and_swap loop
7
8Add __sync_lock_test_and_set 4 byte atomic builtin
9
10Changelog
11
122013-03-18 David Holsgrove <david.holsgrove@xilinx.com>
13
14 * gcc/config/microblaze/sync.md: New file.
15 * gcc/config/microblaze/microblaze.md: Add UNSPEC_SYNC_CAS,
16 UNSPEC_SYNC_XCHG and include sync.md.
17 * gcc/config/microblaze/microblaze.c: Add print_operand 'y'.
18 * gcc/config/microblaze/constraints.md: Add memory_contraint
19 'Q' which is a single register.
20
21Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
22Upstream-Status: Pending
23
24diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md
25index c6fbc98..c9c1649 100644
26--- a/gcc/config/microblaze/constraints.md
27+++ b/gcc/config/microblaze/constraints.md
28@@ -70,3 +70,8 @@
29 "Double word operand."
30 (and (match_code "mem")
31 (match_test "double_memory_operand (op, GET_MODE (op))")))
32+
33+(define_memory_constraint "Q"
34+ "Memory operand which is a single register."
35+ (and (match_code "mem")
36+ (match_test "GET_CODE ( XEXP (op, 0)) == REG")))
37diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
38index 5f4bc60..1562e60 100644
39--- a/gcc/config/microblaze/microblaze.c
40+++ b/gcc/config/microblaze/microblaze.c
41@@ -2130,6 +2130,7 @@ microblaze_initial_elimination_offset (int from, int to)
42 't' print 't' for EQ, 'f' for NE
43 'm' Print 1<<operand.
44 'i' Print 'i' if MEM operand has immediate value
45+ 'y' Print 'y' if MEM operand is single register
46 'o' Print operand address+4
47 '?' Print 'd' if we use a branch with delay slot instead of normal branch.
48 'h' Print high word of const_double (int or float) value as hex
49@@ -2300,6 +2301,15 @@ print_operand (FILE * file, rtx op, int letter)
50 rtx op4 = adjust_address (op, GET_MODE (op), 4);
51 output_address (XEXP (op4, 0));
52 }
53+ else if (letter == 'y')
54+ {
55+ rtx mem_reg = XEXP (op, 0);
56+ if (GET_CODE (mem_reg) == REG)
57+ {
58+ register int regnum = REGNO (mem_reg);
59+ fprintf (file, "%s", reg_names[regnum]);
60+ }
61+ }
62 else
63 output_address (XEXP (op, 0));
64
65diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
66index 4e7fe3b..55cc730 100644
67--- a/gcc/config/microblaze/microblaze.md
68+++ b/gcc/config/microblaze/microblaze.md
69@@ -41,6 +41,8 @@
70 (UNSPEC_CMP 104) ;; signed compare
71 (UNSPEC_CMPU 105) ;; unsigned compare
72 (UNSPEC_TLS 106) ;; jump table
73+ (UNSPEC_SYNC_CAS 107) ;; Represent atomic compare swap.
74+ (UNSPEC_SYNC_XCHG 108) ;; Represent atomic exchange.
75 ])
76
77
78@@ -2231,3 +2233,5 @@
79 microblaze_eh_return(operands[0]);
80 DONE;
81 }")
82+
83+(include "sync.md")
84diff --git a/gcc/config/microblaze/sync.md b/gcc/config/microblaze/sync.md
85new file mode 100644
86index 0000000..0923825
87--- /dev/null
88+++ b/gcc/config/microblaze/sync.md
89@@ -0,0 +1,65 @@
90+;; Machine description for Xilinx MicroBlaze synchronization instructions.
91+;; Copyright (C) 2011, 2012
92+;; Free Software Foundation, Inc.
93+;;
94+;; This file is part of GCC.
95+;;
96+;; GCC is free software; you can redistribute it and/or modify
97+;; it under the terms of the GNU General Public License as published by
98+;; the Free Software Foundation; either version 3, or (at your option)
99+;; any later version.
100+;;
101+;; GCC is distributed in the hope that it will be useful,
102+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
103+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
104+;; GNU General Public License for more details.
105+;;
106+;; You should have received a copy of the GNU General Public License
107+;; along with GCC; see the file COPYING3. If not see
108+;; <http://www.gnu.org/licenses/>.
109+
110+
111+(define_insn "sync_compare_and_swapsi"
112+ [(set (match_operand:SI 0 "register_operand" "=&d") ;; retval
113+ (match_operand:SI 1 "nonimmediate_operand" "+Q")) ;; mem
114+ (set (match_dup 1)
115+ (unspec
116+ [(match_operand:SI 2 "register_operand" "d") ;; oldval
117+ (match_operand:SI 3 "register_operand" "d")] ;; newval
118+ UNSPEC_SYNC_CAS))
119+ (clobber (match_scratch:SI 4 "=&d"))] ;; scratch
120+ ""
121+ {
122+ output_asm_insn ("addc \tr0,r0,r0", operands);
123+ output_asm_insn ("lwx \t%0,%y1,r0", operands);
124+ output_asm_insn ("addic\t%4,r0,0", operands);
125+ output_asm_insn ("bnei \t%4,.-8", operands);
126+ output_asm_insn ("cmp \t%4,%0,%2", operands);
127+ output_asm_insn ("bnei \t%4,.+16", operands);
128+ output_asm_insn ("swx \t%3,%y1,r0", operands);
129+ output_asm_insn ("addic\t%4,r0,0", operands);
130+ output_asm_insn ("bnei \t%4,.-28", operands);
131+ return "";
132+ }
133+)
134+
135+(define_insn "sync_test_and_setsi"
136+ [(set (match_operand:SI 0 "register_operand" "=&d") ;; retval
137+ (match_operand:SI 1 "nonimmediate_operand" "+Q")) ;; mem
138+ (set (match_dup 1)
139+ (unspec
140+ [(match_operand:SI 2 "register_operand" "d")] ;; value
141+ UNSPEC_SYNC_XCHG))
142+ (clobber (match_scratch:SI 3 "=&d"))] ;; scratch
143+ ""
144+ {
145+ output_asm_insn ("addc \tr0,r0,r0", operands);
146+ output_asm_insn ("lwx \t%0,%y1,r0", operands);
147+ output_asm_insn ("addic\t%3,r0,0", operands);
148+ output_asm_insn ("bnei \t%3,.-8", operands);
149+ output_asm_insn ("swx \t%2,%y1,r0", operands);
150+ output_asm_insn ("addic\t%3,r0,0", operands);
151+ output_asm_insn ("bnei \t%3,.-20", operands);
152+ return "";
153+ }
154+)
155--
1561.7.5.4
157
diff --git a/recipes-devtools/gcc/files/0003-Patch-microblaze-Extend-jump-insn-to-accept-bri-to-S.patch b/recipes-devtools/gcc/files/0003-Patch-microblaze-Extend-jump-insn-to-accept-bri-to-S.patch
deleted file mode 100644
index 998dfa03..00000000
--- a/recipes-devtools/gcc/files/0003-Patch-microblaze-Extend-jump-insn-to-accept-bri-to-S.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From: David Holsgrove <david.holsgrove@xilinx.com>
2Subject: [PATCH 3/8] [Patch, microblaze]: Extend jump insn to accept bri to
3 SYMBOL_REFS
4
5Current insn checks if operand is a REG - if so, uses br
6else it bri to %l0 - using a label_ref print operand
7
8Check if operand is a SYMBOL_REF, and if so, use %0
9
10Changelog
11
122013-03-18 David Holsgrove <david.holsgrove@xilinx.com>
13
14 * gcc/config/microblaze/microblaze.md (jump):
15 Account for jumps to SYMBOL_REFs.
16
17Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
18Upstream-Status: Pending
19
20diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
21index 55cc730..49d8f01 100644
22--- a/gcc/config/microblaze/microblaze.md
23+++ b/gcc/config/microblaze/microblaze.md
24@@ -1729,6 +1729,8 @@
25 {
26 if (GET_CODE (operands[0]) == REG)
27 return "br%?\t%0";
28+ else if (GET_CODE (operands[0]) == SYMBOL_REF)
29+ return "bri%?\t%0";
30 else
31 return "bri%?\t%l0";
32 }
33--
341.7.5.4
35
diff --git a/recipes-devtools/gcc/files/0005-Patch-microblaze-Add-fstack-usage-support.patch b/recipes-devtools/gcc/files/0005-Patch-microblaze-Add-fstack-usage-support.patch
deleted file mode 100644
index ee3cb9db..00000000
--- a/recipes-devtools/gcc/files/0005-Patch-microblaze-Add-fstack-usage-support.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From: David Holsgrove <david.holsgrove@xilinx.com>
2Subject: [PATCH 5/8] [Patch, microblaze]: Add -fstack-usage support
3
4Changelog
5
62013-03-18 David Holsgrove <david.holsgrove@xilinx.com>
7
8 * gcc/config/microblaze/microblaze.c (microblaze_expand_prologue):
9 Add check for flag_stack_usage to enable -fstack-usage support
10
11Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
12Upstream-Status: Pending
13
14diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
15index 7418e49..4417289 100644
16--- a/gcc/config/microblaze/microblaze.c
17+++ b/gcc/config/microblaze/microblaze.c
18@@ -2790,6 +2790,9 @@ microblaze_expand_prologue (void)
19
20 fsiz = compute_frame_size (get_frame_size ());
21
22+ if (flag_stack_usage)
23+ current_function_static_stack_size = fsiz;
24+
25 /* If this function is a varargs function, store any registers that
26 would normally hold arguments ($5 - $10) on the stack. */
27 if (((TYPE_ARG_TYPES (fntype) != 0
28--
291.7.5.4
30
diff --git a/recipes-devtools/gcc/files/0006-Patch-microblaze-Remove-SECONDARY_MEMORY_NEEDED.patch b/recipes-devtools/gcc/files/0006-Patch-microblaze-Remove-SECONDARY_MEMORY_NEEDED.patch
deleted file mode 100644
index 923756a5..00000000
--- a/recipes-devtools/gcc/files/0006-Patch-microblaze-Remove-SECONDARY_MEMORY_NEEDED.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
2Subject: [PATCH 6/8] [Patch, microblaze]: Remove SECONDARY_MEMORY_NEEDED
3
4MicroBlaze doesn't have restrictions that would force us to
5reload regs via memory. Don't define SECONDARY_MEMORY_NEEDED.
6Fixes an ICE when compiling OpenSSL for linux.
7
8Changelog
9
102013-03-18 Edgar E. Iglesias <edgar.iglesias@xilinx.com>
11
12 * gcc/config/microblaze/microblaze.h: Remove SECONDARY_MEMORY_NEEDED
13 definition.
14
15Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
16Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@xilinx.com>
17Upstream-Status: Pending
18
19diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
20index 074b78e..add69e8 100644
21--- a/gcc/config/microblaze/microblaze.h
22+++ b/gcc/config/microblaze/microblaze.h
23@@ -422,9 +422,6 @@ extern enum reg_class microblaze_regno_to_class[];
24 || GET_MODE (X) == VOIDmode) \
25 ? (GR_REGS) : (CLASS))))
26
27-#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
28- (GET_MODE_CLASS (MODE) == MODE_INT)
29-
30 /* Stack layout; function entry, exit and calling. */
31
32 #define STACK_GROWS_DOWNWARD
33--
341.7.5.4
35
diff --git a/recipes-devtools/gcc/files/0007-Patch-microblaze-Add-SIZE_TYPE-and-PTRDIFF_TYPE-to-m.patch b/recipes-devtools/gcc/files/0007-Patch-microblaze-Add-SIZE_TYPE-and-PTRDIFF_TYPE-to-m.patch
deleted file mode 100644
index 33aee3a7..00000000
--- a/recipes-devtools/gcc/files/0007-Patch-microblaze-Add-SIZE_TYPE-and-PTRDIFF_TYPE-to-m.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From: David Holsgrove <david.holsgrove@xilinx.com>
2Subject: [PATCH 7/8] [Patch, microblaze]: Add SIZE_TYPE and PTRDIFF_TYPE to
3 microblaze.h
4
5Fixes warnings like;
6
7warning: format '%zX' expects argument of type 'size_t',
8but argument 3 has type 'unsigned int' [-Wformat]
9
10Changelog
11
122013-03-18 David Holsgrove <david.holsgrove@xilinx.com>
13
14 * gcc/config/microblaze/microblaze.h: Define SIZE_TYPE
15 and PTRDIFF_TYPE.
16
17Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
18Upstream-Status: Pending
19
20diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
21index add69e8..367e986 100644
22--- a/gcc/config/microblaze/microblaze.h
23+++ b/gcc/config/microblaze/microblaze.h
24@@ -228,6 +228,12 @@ extern enum pipeline_type microblaze_pipe;
25 #define STRICT_ALIGNMENT 1
26 #define PCC_BITFIELD_TYPE_MATTERS 1
27
28+#undef SIZE_TYPE
29+#define SIZE_TYPE "unsigned int"
30+
31+#undef PTRDIFF_TYPE
32+#define PTRDIFF_TYPE "int"
33+
34 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
35 ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \
36 && (ALIGN) < BITS_PER_WORD \
37--
381.7.5.4
39
diff --git a/recipes-devtools/gcc/files/0008-Patch-microblaze-Add-branch_compare-instruction.patch b/recipes-devtools/gcc/files/0008-Patch-microblaze-Add-branch_compare-instruction.patch
deleted file mode 100644
index 4da74f3f..00000000
--- a/recipes-devtools/gcc/files/0008-Patch-microblaze-Add-branch_compare-instruction.patch
+++ /dev/null
@@ -1,224 +0,0 @@
1From: David Holsgrove <david.holsgrove@xilinx.com>
2Subject: [PATCH 8/8] [Patch, microblaze]: Add branch_compare instruction
3
4To facilitate optimization pass understanding of the conditional
5branch for microblaze, remove the UNSPEC'd signed_compare /
6unsigned_compare instructions, and replace with a complete
7branch_compare which will output_asm_insn the correct cmp/cmpu
8depending on comparison code and signed / unsigned.
9
10We then return the correct branch instruction.
11
12cbranchsi now calls an expanded microblaze_expand_conditional_branch
13function which will carry out compare against zero, compare EQ/NE,
14and all other compares appropriately.
15
16-funroll-loops optimization pass can now proceed
17
18Changelog
19
202013-03-19 David Holsgrove <david.holsgrove@xilinx.com>
21
22 * gcc/config/microblaze/predicates.md: Add cmp_op predicate.
23 * gcc/config/microblaze/microblaze.md: Add branch_compare
24 instruction which uses cmp_op predicate and emits cmp insn
25 before branch.
26 * gcc/config/microblaze/microblaze.c
27 (microblaze_emit_compare): Rename to
28 microblaze_expand_conditional_branch and consolidate logic.
29 (microblaze_expand_conditional_branch): emit branch_compare
30 insn instead of handling cmp op separate from branch insn.
31
32Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
33Upstream-Status: Pending
34
35diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
36index 4417289..84b58bf 100644
37--- a/gcc/config/microblaze/microblaze.c
38+++ b/gcc/config/microblaze/microblaze.c
39@@ -3336,65 +3336,45 @@ microblaze_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
40 emit_move_insn (mem, fnaddr);
41 }
42
43-/* Emit instruction to perform compare.
44- cmp is (compare_op op0 op1). */
45-static rtx
46-microblaze_emit_compare (enum machine_mode mode, rtx cmp, enum rtx_code *cmp_code)
47+/* Generate conditional branch -- first, generate test condition,
48+ second, generate correct branch instruction. */
49+
50+void
51+microblaze_expand_conditional_branch (enum machine_mode mode, rtx operands[])
52 {
53- rtx cmp_op0 = XEXP (cmp, 0);
54- rtx cmp_op1 = XEXP (cmp, 1);
55+ enum rtx_code code = GET_CODE (operands[0]);
56+ rtx cmp_op0 = operands[1];
57+ rtx cmp_op1 = operands[2];
58+ rtx label1 = operands[3];
59 rtx comp_reg = gen_reg_rtx (SImode);
60- enum rtx_code code = *cmp_code;
61-
62+ rtx condition;
63+
64 gcc_assert ((GET_CODE (cmp_op0) == REG) || (GET_CODE (cmp_op0) == SUBREG));
65
66 /* If comparing against zero, just test source reg. */
67- if (cmp_op1 == const0_rtx)
68- return cmp_op0;
69+ if (cmp_op1 == const0_rtx)
70+ {
71+ comp_reg = cmp_op0;
72+ condition = gen_rtx_fmt_ee (signed_condition (code), SImode, comp_reg, const0_rtx);
73+ emit_jump_insn (gen_condjump (condition, label1));
74+ }
75
76- if (code == EQ || code == NE)
77+ else if (code == EQ || code == NE)
78 {
79 /* Use xor for equal/not-equal comparison. */
80 emit_insn (gen_xorsi3 (comp_reg, cmp_op0, cmp_op1));
81+ condition = gen_rtx_fmt_ee (signed_condition (code), SImode, comp_reg, const0_rtx);
82+ emit_jump_insn (gen_condjump (condition, label1));
83 }
84- else if (code == GT || code == GTU || code == LE || code == LEU)
85- {
86- /* MicroBlaze compare is not symmetrical. */
87- /* Swap argument order. */
88- cmp_op1 = force_reg (mode, cmp_op1);
89- if (code == GT || code == LE)
90- emit_insn (gen_signed_compare (comp_reg, cmp_op0, cmp_op1));
91- else
92- emit_insn (gen_unsigned_compare (comp_reg, cmp_op0, cmp_op1));
93- /* Translate test condition. */
94- *cmp_code = swap_condition (code);
95- }
96- else /* if (code == GE || code == GEU || code == LT || code == LTU) */
97+ else
98 {
99+ /* Generate compare and branch in single instruction. */
100 cmp_op1 = force_reg (mode, cmp_op1);
101- if (code == GE || code == LT)
102- emit_insn (gen_signed_compare (comp_reg, cmp_op1, cmp_op0));
103- else
104- emit_insn (gen_unsigned_compare (comp_reg, cmp_op1, cmp_op0));
105+ condition = gen_rtx_fmt_ee (code, mode, cmp_op0, cmp_op1);
106+ emit_jump_insn (gen_branch_compare(condition, cmp_op0, cmp_op1, label1));
107 }
108-
109- return comp_reg;
110 }
111
112-/* Generate conditional branch -- first, generate test condition,
113- second, generate correct branch instruction. */
114-
115-void
116-microblaze_expand_conditional_branch (enum machine_mode mode, rtx operands[])
117-{
118- enum rtx_code code = GET_CODE (operands[0]);
119- rtx comp;
120- rtx condition;
121-
122- comp = microblaze_emit_compare (mode, operands[0], &code);
123- condition = gen_rtx_fmt_ee (signed_condition (code), SImode, comp, const0_rtx);
124- emit_jump_insn (gen_condjump (condition, operands[3]));
125-}
126
127 void
128 microblaze_expand_conditional_branch_sf (rtx operands[])
129diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
130index 49d8f01..9c1e1a3 100644
131--- a/gcc/config/microblaze/microblaze.md
132+++ b/gcc/config/microblaze/microblaze.md
133@@ -1624,28 +1624,6 @@
134 (set_attr "length" "4")]
135 )
136
137-(define_insn "signed_compare"
138- [(set (match_operand:SI 0 "register_operand" "=d")
139- (unspec
140- [(match_operand:SI 1 "register_operand" "d")
141- (match_operand:SI 2 "register_operand" "d")] UNSPEC_CMP))]
142- ""
143- "cmp\t%0,%1,%2"
144- [(set_attr "type" "arith")
145- (set_attr "mode" "SI")
146- (set_attr "length" "4")])
147-
148-(define_insn "unsigned_compare"
149- [(set (match_operand:SI 0 "register_operand" "=d")
150- (unspec
151- [(match_operand:SI 1 "register_operand" "d")
152- (match_operand:SI 2 "register_operand" "d")] UNSPEC_CMPU))]
153- ""
154- "cmpu\t%0,%1,%2"
155- [(set_attr "type" "arith")
156- (set_attr "mode" "SI")
157- (set_attr "length" "4")])
158-
159 ;;----------------------------------------------------------------
160 ;; Setting a register from an floating point comparison.
161 ;;----------------------------------------------------------------
162@@ -1719,6 +1697,47 @@
163 (set_attr "length" "4")]
164 )
165
166+(define_insn "branch_compare"
167+ [(set (pc)
168+ (if_then_else (match_operator:SI 0 "cmp_op"
169+ [(match_operand:SI 1 "register_operand" "d")
170+ (match_operand:SI 2 "register_operand" "d")
171+ ])
172+ (label_ref (match_operand 3))
173+ (pc)))
174+ (clobber(reg:SI R_TMP))]
175+ ""
176+ {
177+ operands[4] = gen_rtx_REG (SImode, MB_ABI_ASM_TEMP_REGNUM);
178+ enum rtx_code code = GET_CODE (operands[0]);
179+
180+ if (code == GT || code == LE)
181+ {
182+ output_asm_insn ("cmp\tr18,%z1,%z2", operands);
183+ code = swap_condition (code);
184+ }
185+ else if (code == GTU || code == LEU)
186+ {
187+ output_asm_insn ("cmpu\tr18,%z1,%z2", operands);
188+ code = swap_condition (code);
189+ }
190+ else if (code == GE || code == LT)
191+ {
192+ output_asm_insn ("cmp\tr18,%z2,%z1", operands);
193+ }
194+ else if (code == GEU || code == LTU)
195+ {
196+ output_asm_insn ("cmpu\tr18,%z2,%z1", operands);
197+ }
198+
199+ operands[0] = gen_rtx_fmt_ee (signed_condition (code), SImode, operands[4], const0_rtx);
200+ return "b%C0i%?\tr18,%3";
201+ }
202+ [(set_attr "type" "branch")
203+ (set_attr "mode" "none")
204+ (set_attr "length" "12")]
205+)
206+
207 ;;----------------------------------------------------------------
208 ;; Unconditional branches
209 ;;----------------------------------------------------------------
210diff --git a/gcc/config/microblaze/predicates.md b/gcc/config/microblaze/predicates.md
211index 5fd1bd4..2c23291 100644
212--- a/gcc/config/microblaze/predicates.md
213+++ b/gcc/config/microblaze/predicates.md
214@@ -119,3 +119,7 @@
215 ;; Test for valid PIC call operand
216 (define_predicate "call_insn_plt_operand"
217 (match_test "PLT_ADDR_P (op)"))
218+
219+;; Return if the code of this rtx pattern is a comparison.
220+(define_predicate "cmp_op"
221+ (match_code "gt,ge,gtu,geu,lt,le,ltu,leu"))
222--
2231.7.5.4
224
diff --git a/recipes-devtools/gcc/files/0462b5f-2014-02-23-David-Holsgrove-david.holsgrove.patch b/recipes-devtools/gcc/files/0462b5f-2014-02-23-David-Holsgrove-david.holsgrove.patch
deleted file mode 100644
index efd127de..00000000
--- a/recipes-devtools/gcc/files/0462b5f-2014-02-23-David-Holsgrove-david.holsgrove.patch
+++ /dev/null
@@ -1,108 +0,0 @@
1From 0462b5fb1e91183c16e204e1a6cf436ef0d8d0f8 Mon Sep 17 00:00:00 2001
2From: eager <eager@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Sun, 23 Feb 2014 18:44:27 +0000
4Subject: [PATCH] 2014-02-23 David Holsgrove <david.holsgrove@xilinx.com>
5
6 * /config/microblaze/microblaze.c: Add microblaze_asm_output_mi_thunk
7 and define TARGET_ASM_OUTPUT_MI_THUNK and
8 TARGET_ASM_CAN_OUTPUT_MI_THUNK.
9
10Upstream-Status: Backport
11---
12 gcc/config/microblaze/microblaze.c | 73 ++++++++++++++++++++++++++++++++++++++
13 2 files changed, 79 insertions(+)
14
15diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
16index 985d26a..ba8109b 100644
17--- a/gcc/config/microblaze/microblaze.c
18+++ b/gcc/config/microblaze/microblaze.c
19@@ -3087,6 +3087,73 @@ expand_pic_symbol_ref (enum machine_mode mode ATTRIBUTE_UNUSED, rtx op)
20 return result;
21 }
22
23+static void
24+microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
25+ HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset,
26+ tree function)
27+{
28+ rtx this_rtx, insn, funexp;
29+
30+ reload_completed = 1;
31+ epilogue_completed = 1;
32+
33+ /* Mark the end of the (empty) prologue. */
34+ emit_note (NOTE_INSN_PROLOGUE_END);
35+
36+ /* Find the "this" pointer. If the function returns a structure,
37+ the structure return pointer is in MB_ABI_FIRST_ARG_REGNUM. */
38+ if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function))
39+ this_rtx = gen_rtx_REG (Pmode, (MB_ABI_FIRST_ARG_REGNUM + 1));
40+ else
41+ this_rtx = gen_rtx_REG (Pmode, MB_ABI_FIRST_ARG_REGNUM);
42+
43+ /* Apply the constant offset, if required. */
44+ if (delta)
45+ emit_insn (gen_addsi3 (this_rtx, this_rtx, GEN_INT (delta)));
46+
47+ /* Apply the offset from the vtable, if required. */
48+ if (vcall_offset)
49+ {
50+ rtx vcall_offset_rtx = GEN_INT (vcall_offset);
51+ rtx temp1 = gen_rtx_REG (Pmode, MB_ABI_TEMP1_REGNUM);
52+
53+ emit_move_insn (temp1, gen_rtx_MEM (Pmode, this_rtx));
54+
55+ rtx loc = gen_rtx_PLUS (Pmode, temp1, vcall_offset_rtx);
56+ emit_move_insn (temp1, gen_rtx_MEM (Pmode, loc));
57+
58+ emit_insn (gen_addsi3 (this_rtx, this_rtx, temp1));
59+ }
60+
61+ /* Generate a tail call to the target function. */
62+ if (!TREE_USED (function))
63+ {
64+ assemble_external (function);
65+ TREE_USED (function) = 1;
66+ }
67+
68+ funexp = XEXP (DECL_RTL (function), 0);
69+ rtx temp2 = gen_rtx_REG (Pmode, MB_ABI_TEMP2_REGNUM);
70+
71+ if (flag_pic)
72+ emit_move_insn (temp2, expand_pic_symbol_ref (Pmode, funexp));
73+ else
74+ emit_move_insn (temp2, funexp);
75+
76+ emit_insn (gen_indirect_jump (temp2));
77+
78+ /* Run just enough of rest_of_compilation. This sequence was
79+ "borrowed" from rs6000.c. */
80+ insn = get_insns ();
81+ shorten_branches (insn);
82+ final_start_function (insn, file, 1);
83+ final (insn, file, 1);
84+ final_end_function ();
85+
86+ reload_completed = 0;
87+ epilogue_completed = 0;
88+}
89+
90 bool
91 microblaze_expand_move (enum machine_mode mode, rtx operands[])
92 {
93@@ -3504,6 +3571,12 @@ microblaze_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x
94 #undef TARGET_SECONDARY_RELOAD
95 #define TARGET_SECONDARY_RELOAD microblaze_secondary_reload
96
97+#undef TARGET_ASM_OUTPUT_MI_THUNK
98+#define TARGET_ASM_OUTPUT_MI_THUNK microblaze_asm_output_mi_thunk
99+
100+#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
101+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
102+
103 #undef TARGET_SCHED_ADJUST_COST
104 #define TARGET_SCHED_ADJUST_COST microblaze_adjust_cost
105
106--
1071.9.0
108
diff --git a/recipes-devtools/gcc/files/Patch-microblaze-Fix-bswaphi2-implementation.patch b/recipes-devtools/gcc/files/Patch-microblaze-Fix-bswaphi2-implementation.patch
deleted file mode 100644
index b39dc4db..00000000
--- a/recipes-devtools/gcc/files/Patch-microblaze-Fix-bswaphi2-implementation.patch
+++ /dev/null
@@ -1,44 +0,0 @@
1From: David Holsgrove <david.holsgrove@xilinx.com>
2Subject: [PATCH] [Patch, microblaze]: Fix bswaphi2 implementation
3
4MicroBlaze insn swaph swaps the contents of register rA
5as two halfwords placing result in rD;
6
7(rD)[0:15] <- (rA)[16:31]
8(rD)[16:31] <- (rA)[0:15]
9
10gcc bswaphi2 is intended to reverse the order of the bytes
11in the half integer in rA
12
13(rD)[8:15] <- (rA)[0:7]
14(rD)[7:0] <- (rA)[8:15]
15(rD)[24:31] <- (rA)[16:23]
16(rD)[16:23] <- (rA)[24:31]
17
18Correct microblaze bswaphi2 insn pattern to be a
19swapb followed by swaph
20
21Reported-by: Nathan Rossi <nathan.rossi@xilinx.com>
22Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
23Upstream-Status: Pending
24---
25 gcc/config/microblaze/microblaze.md | 3 ++-
26 1 files changed, 2 insertions(+), 1 deletions(-)
27
28diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
29index ae4ade7..c7485fc 100644
30--- a/gcc/config/microblaze/microblaze.md
31+++ b/gcc/config/microblaze/microblaze.md
32@@ -367,7 +367,8 @@
33 [(set (match_operand:HI 0 "register_operand" "=r")
34 (bswap:HI (match_operand:HI 1 "register_operand" "r")))]
35 "TARGET_REORDER"
36- "swaph %0, %1"
37+ "swapb %0, %1
38+ swaph %0, %0"
39 )
40
41 ;;----------------------------------------------------------------
42--
431.7.1
44
diff --git a/recipes-devtools/gcc/files/Patch-microblaze-cstoresf4-add-mode-and-ordered_comp.patch b/recipes-devtools/gcc/files/Patch-microblaze-cstoresf4-add-mode-and-ordered_comp.patch
deleted file mode 100644
index 934e7fa9..00000000
--- a/recipes-devtools/gcc/files/Patch-microblaze-cstoresf4-add-mode-and-ordered_comp.patch
+++ /dev/null
@@ -1,44 +0,0 @@
1From: David Holsgrove <david.holsgrove@xilinx.com>
2Subject: [PATCH] [Patch, microblaze]: cstoresf4, add mode and
3 ordered_comparison_operator
4
5Add SImode to comparison operator, prevents ICE during combine
6rtl pass with error message;
7
8internal compiler error: in simplify_subreg, at simplify-rtx.c:5725
9
10Use ordered_comparison_operator predicate to limit operators to
11those fcmp can handle, and letting compiler reorder insns to
12accomodate unordered as necessary
13
14Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
15Upstream-Status: Pending
16---
17 gcc/config/microblaze/microblaze.md | 4 ++--
18 1 file changed, 2 insertions(+), 2 deletions(-)
19
20diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
21index 786dabb..e9b032b 100644
22--- a/gcc/config/microblaze/microblaze.md
23+++ b/gcc/config/microblaze/microblaze.md
24@@ -1650,7 +1650,7 @@
25 ;;----------------------------------------------------------------
26 (define_insn "cstoresf4"
27 [(set (match_operand:SI 0 "register_operand" "=r")
28- (match_operator 1 "comparison_operator"
29+ (match_operator:SI 1 "ordered_comparison_operator"
30 [(match_operand:SF 2 "register_operand" "r")
31 (match_operand:SF 3 "register_operand" "r")]))]
32 "TARGET_HARD_FLOAT"
33@@ -1679,7 +1679,7 @@
34
35 (define_expand "cbranchsf4"
36 [(set (pc)
37- (if_then_else (match_operator 0 "comparison_operator"
38+ (if_then_else (match_operator 0 "ordered_comparison_operator"
39 [(match_operand:SF 1 "register_operand")
40 (match_operand:SF 2 "register_operand")])
41 (label_ref (match_operand 3 ""))
42--
431.7.9.5
44
diff --git a/recipes-devtools/gcc/files/gcc-Cherry-pick-mainline-patch-to-resolve-MB-k.patch b/recipes-devtools/gcc/files/gcc-Cherry-pick-mainline-patch-to-resolve-MB-k.patch
deleted file mode 100644
index 1cdc4029..00000000
--- a/recipes-devtools/gcc/files/gcc-Cherry-pick-mainline-patch-to-resolve-MB-k.patch
+++ /dev/null
@@ -1,110 +0,0 @@
1Subject: Cherry-pick mainline patch to resolve MB kernel panic
2
3Cherry-pick backend optimization patch from gcc HEAD which 'resolves' a kernel
4panic for microblaze when compiled with -Os
5
6Upstream HEAD (soon to be gcc 4.9) does not exhibt this error any longer,
7and this patch when applied as a workaround on the 4.8 branch also hides the
8kernel panic resulting from incorrect branch-delay slot filling.
9
10 * tree-ssa-threadedge.c (thread_around_empty_block): Remove
11 checks for the number of predecessors and successors allowed.
12 * tree-ssa-threadupdate.c (mark_threaded_blocks): Ignore requests
13 which require copying a joiner block if there is a request which
14 is a subpath that requires no joiner block copying.
15
16Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
17Upstream-Status: Backport
18---
19 gcc/tree-ssa-threadedge.c | 8 -------
20 gcc/tree-ssa-threadupdate.c | 49 ++++++++++++++++++++++++++++++++++++++-----
21 2 files changed, 44 insertions(+), 13 deletions(-)
22
23diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
24index b31e961..ab58ae8 100644
25--- a/gcc/tree-ssa-threadedge.c
26+++ b/gcc/tree-ssa-threadedge.c
27@@ -761,14 +761,6 @@ thread_around_empty_block (edge taken_edge,
28 gimple stmt;
29 tree cond;
30
31- /* This block must have a single predecessor (E->dest). */
32- if (!single_pred_p (bb))
33- return NULL;
34-
35- /* This block must have more than one successor. */
36- if (single_succ_p (bb))
37- return NULL;
38-
39 /* This block can have no PHI nodes. This is overly conservative. */
40 if (!gsi_end_p (gsi_start_phis (bb)))
41 return NULL;
42diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
43index 0e4cbc9..cf8df8e 100644
44--- a/gcc/tree-ssa-threadupdate.c
45+++ b/gcc/tree-ssa-threadupdate.c
46@@ -1146,17 +1146,56 @@ mark_threaded_blocks (bitmap threaded_blocks)
47 edge e;
48 edge_iterator ei;
49
50+ /* It is possible to have jump threads in which one is a subpath
51+ of the other. ie, (A, B), (B, C), (C, D) where B is a joiner
52+ block and (B, C), (C, D) where no joiner block exists.
53+
54+ When this occurs ignore the jump thread request with the joiner
55+ block. It's totally subsumed by the simpler jump thread request.
56+
57+ This results in less block copying, simpler CFGs. More improtantly,
58+ when we duplicate the joiner block, B, in this case we will create
59+ a new threading opportunity that we wouldn't be able to optimize
60+ until the next jump threading iteration.
61+
62+ So first convert the jump thread requests which do not require a
63+ joiner block. */
64 for (i = 0; i < threaded_edges.length (); i += 3)
65 {
66 edge e = threaded_edges[i];
67- edge *x = XNEWVEC (edge, 2);
68
69- e->aux = x;
70- THREAD_TARGET (e) = threaded_edges[i + 1];
71- THREAD_TARGET2 (e) = threaded_edges[i + 2];
72- bitmap_set_bit (tmp, e->dest->index);
73+ if (threaded_edges[i + 2] == NULL)
74+ {
75+ edge *x = XNEWVEC (edge, 2);
76+
77+ e->aux = x;
78+ THREAD_TARGET (e) = threaded_edges[i + 1];
79+ THREAD_TARGET2 (e) = NULL;
80+ bitmap_set_bit (tmp, e->dest->index);
81+ }
82 }
83
84+
85+ /* Now iterate again, converting cases where we threaded through
86+ a joiner block, but ignoring those where we have already
87+ threaded through the joiner block. */
88+ for (i = 0; i < threaded_edges.length (); i += 3)
89+ {
90+ edge e = threaded_edges[i];
91+
92+ if (threaded_edges[i + 2] != NULL
93+ && threaded_edges[i + 1]->aux == NULL)
94+ {
95+ edge *x = XNEWVEC (edge, 2);
96+
97+ e->aux = x;
98+ THREAD_TARGET (e) = threaded_edges[i + 1];
99+ THREAD_TARGET2 (e) = threaded_edges[i + 2];
100+ bitmap_set_bit (tmp, e->dest->index);
101+ }
102+ }
103+
104+
105 /* If optimizing for size, only thread through block if we don't have
106 to duplicate it or it's an otherwise empty redirection block. */
107 if (optimize_function_for_size_p (cfun))
108--
1091.7.9.5
110
diff --git a/recipes-devtools/gcc/gcc-microblaze-4.8.inc b/recipes-devtools/gcc/gcc-microblaze-4.8.inc
deleted file mode 100644
index f0578dbd..00000000
--- a/recipes-devtools/gcc/gcc-microblaze-4.8.inc
+++ /dev/null
@@ -1,16 +0,0 @@
1
2# Add MicroBlaze Patches
3FILESEXTRAPATHS_append := "${THISDIR}/files:"
4SRC_URI_append += " \
5 file://0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch \
6 file://0002-Patch-microblaze-Add-4-byte-implementation-for-atomi.patch \
7 file://0003-Patch-microblaze-Extend-jump-insn-to-accept-bri-to-S.patch \
8 file://0462b5f-2014-02-23-David-Holsgrove-david.holsgrove.patch \
9 file://0005-Patch-microblaze-Add-fstack-usage-support.patch \
10 file://0006-Patch-microblaze-Remove-SECONDARY_MEMORY_NEEDED.patch \
11 file://0007-Patch-microblaze-Add-SIZE_TYPE-and-PTRDIFF_TYPE-to-m.patch \
12 file://0008-Patch-microblaze-Add-branch_compare-instruction.patch \
13 file://Patch-microblaze-Fix-bswaphi2-implementation.patch \
14 file://Patch-microblaze-cstoresf4-add-mode-and-ordered_comp.patch \
15 file://gcc-Cherry-pick-mainline-patch-to-resolve-MB-k.patch \
16 "
diff --git a/recipes-devtools/gcc/gcc-source_4.8.bbappend b/recipes-devtools/gcc/gcc-source_4.8.bbappend
deleted file mode 100644
index e28b4dd0..00000000
--- a/recipes-devtools/gcc/gcc-source_4.8.bbappend
+++ /dev/null
@@ -1 +0,0 @@
1require gcc-microblaze-4.8.inc
diff --git a/recipes-devtools/gdb/files/0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch b/recipes-devtools/gdb/files/0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch
deleted file mode 100644
index 3575cd7e..00000000
--- a/recipes-devtools/gdb/files/0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch
+++ /dev/null
@@ -1,69 +0,0 @@
1From 8ab9a20c73acedbb636a41842a681872af8ae1d6 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 8 May 2013 11:03:36 +1000
4Subject: [PATCH 01/16] [Patch, microblaze]: Add wdc.ext.clear and
5 wdc.ext.flush insns
6
7Added two new instructions, wdc.ext.clear and wdc.ext.flush,
8to enable MicroBlaze to flush an external cache, which is
9used with the new coherency support for multiprocessing.
10
11Signed-off-by:nagaraju <nmekala@xilix.com>
12Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
13Upstream-Status: Pending
14---
15 opcodes/microblaze-opc.h | 5 ++++-
16 opcodes/microblaze-opcm.h | 6 +++---
17 2 files changed, 7 insertions(+), 4 deletions(-)
18
19diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
20index e3cc1d9..f453097 100644
21--- a/opcodes/microblaze-opc.h
22+++ b/opcodes/microblaze-opc.h
23@@ -91,6 +91,7 @@
24 #define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
25 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
26 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
27+#define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
28 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
29
30 /* New Mask for msrset, msrclr insns. */
31@@ -101,7 +102,7 @@
32 #define DELAY_SLOT 1
33 #define NO_DELAY_SLOT 0
34
35-#define MAX_OPCODES 289
36+#define MAX_OPCODES 291
37
38 struct op_code_struct
39 {
40@@ -174,7 +175,9 @@ struct op_code_struct
41 {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst },
42 {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst },
43 {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst },
44+ {"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 },
45 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst },
46+ {"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 },
47 {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst },
48 {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst },
49 {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst },
50diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
51index 6868389..8f5c1cb 100644
52--- a/opcodes/microblaze-opcm.h
53+++ b/opcodes/microblaze-opcm.h
54@@ -31,9 +31,9 @@ enum microblaze_instr
55 idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
56 ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
57 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
58- wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd,
59- brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
60- bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
61+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, mts, mfs, mbar,
62+ br, brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned,
63+ blt, bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
64 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
65 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
66 bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh,
67--
681.9.0
69
diff --git a/recipes-devtools/gdb/files/0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch b/recipes-devtools/gdb/files/0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch
deleted file mode 100644
index 5d856408..00000000
--- a/recipes-devtools/gdb/files/0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch
+++ /dev/null
@@ -1,384 +0,0 @@
1From da27c7161c676550f5fe8a4e0f7f395e5e0d4770 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@petalogix.com>
3Date: Fri, 18 May 2012 11:49:50 +1000
4Subject: [PATCH 03/16] [Patch, microblaze]: Initial port of microblaze core
5 reading support
6
7Added support for reading notes in linux core dumps
8Support for reading of PRSTATUS and PSINFO information for rebuilding
9".reg" sections of core dumps at run time.
10
11Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
12Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
13Upstream-Status: Pending
14---
15 bfd/elf32-microblaze.c | 64 ++++++++++++++++++++++++++++++++
16 gdb/configure.tgt | 2 +-
17 gdb/microblaze-linux-tdep.c | 61 +++++++++++++++++++++++++++++++
18 gdb/microblaze-tdep.c | 89 +++++++++++++++++++++++++++++++++++++++++++++
19 gdb/microblaze-tdep.h | 28 ++++++++++++++
20 5 files changed, 243 insertions(+), 1 deletion(-)
21
22diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
23index 9837b18..cbd18f0 100644
24--- a/bfd/elf32-microblaze.c
25+++ b/bfd/elf32-microblaze.c
26@@ -668,6 +668,67 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
27 return _bfd_elf_is_local_label_name (abfd, name);
28 }
29
30+/* Support for core dump NOTE sections. */
31+static bfd_boolean
32+microblaze_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
33+{
34+ int offset;
35+ unsigned int size;
36+
37+ switch (note->descsz)
38+ {
39+ default:
40+ return FALSE;
41+
42+ case 228: /* Linux/MicroBlaze */
43+ /* pr_cursig */
44+ elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
45+
46+ /* pr_pid */
47+ elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24);
48+
49+ /* pr_reg */
50+ offset = 72;
51+ size = 50 * 4;
52+
53+ break;
54+ }
55+
56+ /* Make a ".reg/999" section. */
57+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
58+ size, note->descpos + offset);
59+}
60+
61+static bfd_boolean
62+microblaze_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
63+{
64+ switch (note->descsz)
65+ {
66+ default:
67+ return FALSE;
68+
69+ case 128: /* Linux/MicroBlaze elf_prpsinfo */
70+ elf_tdata (abfd)->core->program
71+ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
72+ elf_tdata (abfd)->core->command
73+ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
74+ }
75+
76+ /* Note that for some reason, a spurious space is tacked
77+ onto the end of the args in some (at least one anyway)
78+ implementations, so strip it off if it exists. */
79+
80+ {
81+ char *command = elf_tdata (abfd)->core->command;
82+ int n = strlen (command);
83+
84+ if (0 < n && command[n - 1] == ' ')
85+ command[n - 1] = '\0';
86+ }
87+
88+ return TRUE;
89+}
90+
91 /* The microblaze linker (like many others) needs to keep track of
92 the number of relocs that it decides to copy as dynamic relocs in
93 check_relocs for each symbol. This is so that it can later discard
94@@ -3506,4 +3567,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
95 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
96 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
97
98+#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
99+#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
100+
101 #include "elf32-target.h"
102diff --git a/gdb/configure.tgt b/gdb/configure.tgt
103index 01311b2..9297c56 100644
104--- a/gdb/configure.tgt
105+++ b/gdb/configure.tgt
106@@ -340,7 +340,7 @@ mep-*-*)
107
108 microblaze*-linux-*|microblaze*-*-linux*)
109 # Target: Xilinx MicroBlaze running Linux
110- gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o \
111+ gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o glibc-tdep.o \
112 monitor.o dsrec.o solib-svr4.o symfile-mem.o linux-tdep.o"
113 gdb_sim=../sim/microblaze/libsim.a
114 ;;
115diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
116index 8d360eb..7e6b61b 100644
117--- a/gdb/microblaze-linux-tdep.c
118+++ b/gdb/microblaze-linux-tdep.c
119@@ -32,6 +32,7 @@
120 #include "regset.h"
121 #include "solib-svr4.h"
122 #include "microblaze-tdep.h"
123+#include "glibc-tdep.h"
124 #include "trad-frame.h"
125 #include "frame-unwind.h"
126 #include "tramp-frame.h"
127@@ -116,6 +117,43 @@ static struct tramp_frame microblaze_linux_sighandler_tramp_frame =
128 microblaze_linux_sighandler_cache_init
129 };
130
131+const struct microblaze_gregset microblaze_linux_core_gregset;
132+
133+static void
134+microblaze_linux_supply_core_gregset (const struct regset *regset,
135+ struct regcache *regcache,
136+ int regnum, const void *gregs, size_t len)
137+{
138+ microblaze_supply_gregset (&microblaze_linux_core_gregset, regcache,
139+ regnum, gregs);
140+}
141+
142+static void
143+microblaze_linux_collect_core_gregset (const struct regset *regset,
144+ const struct regcache *regcache,
145+ int regnum, void *gregs, size_t len)
146+{
147+ microblaze_collect_gregset (&microblaze_linux_core_gregset, regcache,
148+ regnum, gregs);
149+}
150+
151+static void
152+microblaze_linux_supply_core_fpregset (const struct regset *regset,
153+ struct regcache *regcache,
154+ int regnum, const void *fpregs, size_t len)
155+{
156+ /* FIXME. */
157+ microblaze_supply_fpregset (regcache, regnum, fpregs);
158+}
159+
160+static void
161+microblaze_linux_collect_core_fpregset (const struct regset *regset,
162+ const struct regcache *regcache,
163+ int regnum, void *fpregs, size_t len)
164+{
165+ /* FIXME. */
166+ microblaze_collect_fpregset (regcache, regnum, fpregs);
167+}
168
169 static void
170 microblaze_linux_init_abi (struct gdbarch_info info,
171@@ -123,6 +161,10 @@ microblaze_linux_init_abi (struct gdbarch_info info,
172 {
173 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
174
175+ tdep->gregset = regset_alloc (gdbarch, microblaze_linux_supply_core_gregset,
176+ microblaze_linux_collect_core_gregset);
177+ tdep->sizeof_gregset = 200;
178+
179 linux_init_abi (info, gdbarch);
180
181 set_gdbarch_memory_remove_breakpoint (gdbarch,
182@@ -135,6 +177,25 @@ microblaze_linux_init_abi (struct gdbarch_info info,
183 /* Trampolines. */
184 tramp_frame_prepend_unwinder (gdbarch,
185 &microblaze_linux_sighandler_tramp_frame);
186+
187+ /* BFD target for core files. */
188+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
189+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
190+ else
191+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
192+
193+
194+ /* Shared library handling. */
195+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
196+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
197+
198+ set_gdbarch_regset_from_core_section (gdbarch,
199+ microblaze_regset_from_core_section);
200+
201+ /* Enable TLS support. */
202+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
203+ svr4_fetch_objfile_link_map);
204+
205 }
206
207 /* -Wmissing-prototypes */
208diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
209index 14c1b52..36cf1ca 100644
210--- a/gdb/microblaze-tdep.c
211+++ b/gdb/microblaze-tdep.c
212@@ -145,6 +145,14 @@ microblaze_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
213 return sp;
214 }
215
216+static CORE_ADDR
217+microblaze_store_arguments (struct regcache *regcache, int nargs,
218+ struct value **args, CORE_ADDR sp,
219+ int struct_return, CORE_ADDR struct_addr)
220+{
221+ error (_("store_arguments not implemented"));
222+ return sp;
223+}
224
225 static CORE_ADDR
226 microblaze_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
227@@ -536,6 +544,12 @@ microblaze_frame_base_address (struct frame_info *next_frame,
228 return cache->base;
229 }
230
231+static const struct frame_unwind *
232+microblaze_frame_sniffer (struct frame_info *next_frame)
233+{
234+ return &microblaze_frame_unwind;
235+}
236+
237 static const struct frame_base microblaze_frame_base =
238 {
239 &microblaze_frame_unwind,
240@@ -664,6 +678,70 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
241 return dwarf2_to_reg_map[reg];
242 }
243
244+
245+void
246+microblaze_supply_gregset (const struct microblaze_gregset *gregset,
247+ struct regcache *regcache,
248+ int regnum, const void *gregs)
249+{
250+ unsigned int *regs = gregs;
251+ if (regnum >= 0)
252+ regcache_raw_supply (regcache, regnum, regs + regnum);
253+
254+ if (regnum == -1) {
255+ int i;
256+
257+ for (i = 0; i < 50; i++) {
258+ regcache_raw_supply (regcache, i, regs + i);
259+ }
260+ }
261+}
262+
263+
264+void
265+microblaze_collect_gregset (const struct microblaze_gregset *gregset,
266+ const struct regcache *regcache,
267+ int regnum, void *gregs)
268+{
269+ /* FIXME. */
270+}
271+
272+void
273+microblaze_supply_fpregset (struct regcache *regcache,
274+ int regnum, const void *fpregs)
275+{
276+ /* FIXME. */
277+}
278+
279+void
280+microblaze_collect_fpregset (const struct regcache *regcache,
281+ int regnum, void *fpregs)
282+{
283+ /* FIXME. */
284+}
285+
286+
287+/* Return the appropriate register set for the core section identified
288+ by SECT_NAME and SECT_SIZE. */
289+
290+const struct regset *
291+microblaze_regset_from_core_section (struct gdbarch *gdbarch,
292+ const char *sect_name, size_t sect_size)
293+{
294+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
295+
296+ microblaze_debug ("microblaze_regset_from_core_section, sect_name = %s\n", sect_name);
297+
298+ if (strcmp (sect_name, ".reg") == 0 && sect_size >= tdep->sizeof_gregset)
299+ return tdep->gregset;
300+
301+ if (strcmp (sect_name, ".reg2") == 0 && sect_size >= tdep->sizeof_fpregset)
302+ return tdep->fpregset;
303+
304+ microblaze_debug ("microblaze_regset_from_core_section returning null :-( \n");
305+ return NULL;
306+}
307+
308 static struct gdbarch *
309 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
310 {
311@@ -679,6 +757,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
312 tdep = XNEW (struct gdbarch_tdep);
313 gdbarch = gdbarch_alloc (&info, tdep);
314
315+ tdep->gregset = NULL;
316+ tdep->sizeof_gregset = 0;
317+ tdep->fpregset = NULL;
318+ tdep->sizeof_fpregset = 0;
319+
320 set_gdbarch_long_double_bit (gdbarch, 128);
321
322 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS);
323@@ -726,6 +809,12 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
324 frame_unwind_append_unwinder (gdbarch, &microblaze_frame_unwind);
325 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
326
327+ /* If we have register sets, enable the generic core file support. */
328+ if (tdep->gregset) {
329+ set_gdbarch_regset_from_core_section (gdbarch,
330+ microblaze_regset_from_core_section);
331+ }
332+
333 return gdbarch;
334 }
335
336diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
337index a532092..fec24b9 100644
338--- a/gdb/microblaze-tdep.h
339+++ b/gdb/microblaze-tdep.h
340@@ -22,8 +22,22 @@
341
342
343 /* Microblaze architecture-specific information. */
344+struct microblaze_gregset
345+{
346+ unsigned int gregs[32];
347+ unsigned int fpregs[32];
348+ unsigned int pregs[16];
349+};
350+
351 struct gdbarch_tdep
352 {
353+ int dummy; // declare something.
354+
355+ /* Register sets. */
356+ struct regset *gregset;
357+ size_t sizeof_gregset;
358+ struct regset *fpregset;
359+ size_t sizeof_fpregset;
360 };
361
362 struct microblaze_frame_cache
363@@ -117,4 +131,18 @@ enum microblaze_regnum
364 Only used for native debugging. */
365 #define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60}
366
367+extern void microblaze_supply_gregset (const struct microblaze_gregset *gregset,
368+ struct regcache *regcache,
369+ int regnum, const void *gregs);
370+extern void microblaze_collect_gregset (const struct microblaze_gregset *gregset,
371+ const struct regcache *regcache,
372+ int regnum, void *gregs);
373+extern void microblaze_supply_fpregset (struct regcache *regcache,
374+ int regnum, const void *fpregs);
375+extern void microblaze_collect_fpregset (const struct regcache *regcache,
376+ int regnum, void *fpregs);
377+
378+extern const struct regset * microblaze_regset_from_core_section (struct gdbarch *gdbarch,
379+ const char *sect_name, size_t sect_size);
380+
381 #endif /* microblaze-tdep.h */
382--
3831.9.0
384
diff --git a/recipes-devtools/gdb/files/0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch b/recipes-devtools/gdb/files/0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch
deleted file mode 100644
index b14e4092..00000000
--- a/recipes-devtools/gdb/files/0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch
+++ /dev/null
@@ -1,67 +0,0 @@
1From 26e124f0d78233b1d976bd4b787f6a7866bcb7e7 Mon Sep 17 00:00:00 2001
2From: nagaraju <nmekala@xilix.com>
3Date: Wed, 4 Jan 2012 16:59:33 +0530
4Subject: [PATCH 04/16] [Patch, microblaze]: Communicate in larger blocks with
5 the target
6
7Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
8Upstream-Status: Pending
9---
10 gdb/microblaze-tdep.c | 25 ++++++++++++++++++++++---
11 1 file changed, 22 insertions(+), 3 deletions(-)
12
13diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
14index 36cf1ca..76e87b3 100644
15--- a/gdb/microblaze-tdep.c
16+++ b/gdb/microblaze-tdep.c
17@@ -242,6 +242,10 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
18 int flags = 0;
19 int save_hidden_pointer_found = 0;
20 int non_stack_instruction_found = 0;
21+ int n_insns;
22+ unsigned long *insn_block;
23+ gdb_byte *buf_block;
24+ int ti, tj;
25
26 /* Find the start of this function. */
27 find_pc_partial_function (pc, &name, &func_addr, &func_end);
28@@ -281,9 +285,23 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
29 name, paddress (gdbarch, func_addr),
30 paddress (gdbarch, stop));
31
32+/* Do a block read to minimize the transaction with the Debug Agent */
33+ n_insns = (stop == func_addr) ? 1 : ((stop - func_addr) / INST_WORD_SIZE);
34+ insn_block = (unsigned long *)calloc(n_insns, sizeof(unsigned long));
35+ buf_block = (gdb_byte *)calloc(n_insns * INST_WORD_SIZE, sizeof(gdb_byte));
36+
37+ target_read_memory (func_addr, buf_block, n_insns * INST_WORD_SIZE );
38+
39+ for(ti = 0; ti < n_insns; ti++){
40+ insn_block[ti] = 0;
41+ for( tj = ti * INST_WORD_SIZE; tj < (ti + 1) * INST_WORD_SIZE; tj++ )
42+ insn_block[ti] = (insn_block[ti] << 8) | buf_block[tj];
43+ }
44+
45 for (addr = func_addr; addr < stop; addr += INST_WORD_SIZE)
46 {
47- insn = microblaze_fetch_instruction (addr);
48+ //insn = microblaze_fetch_instruction (addr);
49+ insn = insn_block[(addr - func_addr) / INST_WORD_SIZE];
50 op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
51 microblaze_debug ("%s %08lx\n", paddress (gdbarch, pc), insn);
52
53@@ -409,8 +427,9 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
54 part of the prologue. */
55 if (save_hidden_pointer_found)
56 prologue_end_addr -= INST_WORD_SIZE;
57-
58- return prologue_end_addr;
59+ free(insn_block);
60+ free(buf_block);
61+ return prologue_end_addr;
62 }
63
64 static CORE_ADDR
65--
661.9.0
67
diff --git a/recipes-devtools/gdb/files/0005-Patch-microblaze-Add-mb-singlestepping.patch b/recipes-devtools/gdb/files/0005-Patch-microblaze-Add-mb-singlestepping.patch
deleted file mode 100644
index e490f02a..00000000
--- a/recipes-devtools/gdb/files/0005-Patch-microblaze-Add-mb-singlestepping.patch
+++ /dev/null
@@ -1,200 +0,0 @@
1From 5c3a08f407e1cbee5b0a4ca6092165b97acddda5 Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar@axis.com>
3Date: Fri, 24 Feb 2012 11:52:30 +0100
4Subject: [PATCH 05/16] [Patch, microblaze]: Add mb singlestepping.
5
6Fix prologue analysis for little-endian.
7Always provide a frame base.
8
9Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
10Upstream-Status: Pending
11---
12 gdb/microblaze-tdep.c | 123 ++++++++++++++++++++++++++++++++++++++++++++------
13 1 file changed, 108 insertions(+), 15 deletions(-)
14
15diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
16index 76e87b3..50b68d2 100644
17--- a/gdb/microblaze-tdep.c
18+++ b/gdb/microblaze-tdep.c
19@@ -243,9 +243,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
20 int save_hidden_pointer_found = 0;
21 int non_stack_instruction_found = 0;
22 int n_insns;
23- unsigned long *insn_block;
24- gdb_byte *buf_block;
25- int ti, tj;
26+ unsigned int *insn_block;
27
28 /* Find the start of this function. */
29 find_pc_partial_function (pc, &name, &func_addr, &func_end);
30@@ -287,23 +285,16 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
31
32 /* Do a block read to minimize the transaction with the Debug Agent */
33 n_insns = (stop == func_addr) ? 1 : ((stop - func_addr) / INST_WORD_SIZE);
34- insn_block = (unsigned long *)calloc(n_insns, sizeof(unsigned long));
35- buf_block = (gdb_byte *)calloc(n_insns * INST_WORD_SIZE, sizeof(gdb_byte));
36+ insn_block = calloc(n_insns, sizeof(unsigned long));
37
38- target_read_memory (func_addr, buf_block, n_insns * INST_WORD_SIZE );
39-
40- for(ti = 0; ti < n_insns; ti++){
41- insn_block[ti] = 0;
42- for( tj = ti * INST_WORD_SIZE; tj < (ti + 1) * INST_WORD_SIZE; tj++ )
43- insn_block[ti] = (insn_block[ti] << 8) | buf_block[tj];
44- }
45+ target_read_memory (func_addr, (void*) insn_block, n_insns * INST_WORD_SIZE );
46
47 for (addr = func_addr; addr < stop; addr += INST_WORD_SIZE)
48 {
49 //insn = microblaze_fetch_instruction (addr);
50 insn = insn_block[(addr - func_addr) / INST_WORD_SIZE];
51 op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
52- microblaze_debug ("%s %08lx\n", paddress (gdbarch, pc), insn);
53+ microblaze_debug ("%s %08lx op=%x r%d r%d imm=%d\n", paddress (gdbarch, addr), insn, op, rd, ra, imm);
54
55 /* This code is very sensitive to what functions are present in the
56 prologue. It assumes that the (addi, addik, swi, sw) can be the
57@@ -428,7 +419,6 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
58 if (save_hidden_pointer_found)
59 prologue_end_addr -= INST_WORD_SIZE;
60 free(insn_block);
61- free(buf_block);
62 return prologue_end_addr;
63 }
64
65@@ -502,6 +492,7 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache)
66
67 func = get_frame_func (next_frame);
68
69+ cache->base = get_frame_register_unsigned (next_frame, gdbarch_sp_regnum (gdbarch));
70 cache->pc = get_frame_address_in_block (next_frame);
71
72 return cache;
73@@ -518,7 +509,7 @@ microblaze_frame_this_id (struct frame_info *next_frame, void **this_cache,
74 if (cache->base == 0)
75 return;
76
77- (*this_id) = frame_id_build (cache->base, cache->pc);
78+ (*this_id) = frame_id_build (cache->base, get_frame_pc (next_frame));
79 }
80
81 static struct value *
82@@ -661,6 +652,107 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
83 return (TYPE_LENGTH (type) == 16);
84 }
85
86+int
87+microblaze_software_single_step (struct frame_info *frame)
88+{
89+ struct gdbarch *arch = get_frame_arch (frame);
90+ struct address_space *aspace = get_frame_address_space (frame);
91+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
92+ static char le_breakp[] = MICROBLAZE_BREAKPOINT_LE;
93+ static char be_breakp[] = MICROBLAZE_BREAKPOINT;
94+ enum bfd_endian byte_order = gdbarch_byte_order (arch);
95+ char *breakp = byte_order == BFD_ENDIAN_BIG ? be_breakp : le_breakp;
96+ int ret = 0;
97+
98+ /* Save the address and the values of the next_pc and the target */
99+ static struct sstep_breaks
100+ {
101+ CORE_ADDR address;
102+ bfd_boolean valid;
103+ /* Shadow contents. */
104+ char data[INST_WORD_SIZE];
105+ } stepbreaks[2];
106+ int ii;
107+
108+ if (1)
109+ {
110+ CORE_ADDR pc;
111+ long insn;
112+ enum microblaze_instr minstr;
113+ bfd_boolean isunsignednum;
114+ enum microblaze_instr_type insn_type;
115+ short delay_slots;
116+ int imm;
117+ bfd_boolean immfound = FALSE;
118+
119+ /* Set a breakpoint at the next instruction */
120+ /* If the current instruction is an imm, set it at the inst after */
121+ /* If the instruction has a delay slot, skip the delay slot */
122+ pc = get_frame_pc (frame);
123+ insn = microblaze_fetch_instruction (pc);
124+ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots);
125+ if (insn_type == immediate_inst)
126+ {
127+ int rd, ra, rb;
128+ immfound = TRUE;
129+ minstr = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
130+ pc = pc + INST_WORD_SIZE;
131+ insn = microblaze_fetch_instruction (pc);
132+ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots);
133+ }
134+ stepbreaks[0].address = pc + (delay_slots * INST_WORD_SIZE) + INST_WORD_SIZE;
135+ if (insn_type != return_inst) {
136+ stepbreaks[0].valid = TRUE;
137+ } else {
138+ stepbreaks[0].valid = FALSE;
139+ }
140+
141+ microblaze_debug ("single-step insn_type=%x insn=%x\n", insn_type, insn);
142+ /* Now check for branch or return instructions */
143+ if (insn_type == branch_inst || insn_type == return_inst) {
144+ int limm;
145+ int lrd, lra, lrb;
146+ int ra, rb;
147+ bfd_boolean targetvalid;
148+ bfd_boolean unconditionalbranch;
149+ microblaze_decode_insn(insn, &lrd, &lra, &lrb, &limm);
150+ if (lra >= 0 && lra < MICROBLAZE_NUM_REGS)
151+ ra = get_frame_register_unsigned (frame, lra);
152+ else
153+ ra = 0;
154+ if (lrb >= 0 && lrb < MICROBLAZE_NUM_REGS)
155+ rb = get_frame_register_unsigned (frame, lrb);
156+ else
157+ rb = 0;
158+ stepbreaks[1].address = microblaze_get_target_address (insn, immfound, imm, pc, ra, rb, &targetvalid, &unconditionalbranch);
159+ microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address);
160+ if (unconditionalbranch)
161+ stepbreaks[0].valid = FALSE; /* This is a unconditional branch: will not come to the next address */
162+ if (targetvalid && (stepbreaks[0].valid == FALSE ||
163+ (stepbreaks[0].address != stepbreaks[1].address))
164+ && (stepbreaks[1].address != pc)) {
165+ stepbreaks[1].valid = TRUE;
166+ } else {
167+ stepbreaks[1].valid = FALSE;
168+ }
169+ } else {
170+ stepbreaks[1].valid = FALSE;
171+ }
172+
173+ /* Insert the breakpoints */
174+ for (ii = 0; ii < 2; ++ii)
175+ {
176+
177+ /* ignore invalid breakpoint. */
178+ if (stepbreaks[ii].valid) {
179+ insert_single_step_breakpoint (arch, aspace, stepbreaks[ii].address);
180+ ret = 1;
181+ }
182+ }
183+ }
184+ return ret;
185+}
186+
187 static void
188 microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
189 {
190@@ -809,6 +901,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
191 set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
192
193 set_gdbarch_breakpoint_from_pc (gdbarch, microblaze_breakpoint_from_pc);
194+ set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
195
196 set_gdbarch_frame_args_skip (gdbarch, 8);
197
198--
1991.9.0
200
diff --git a/recipes-devtools/gdb/files/0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch b/recipes-devtools/gdb/files/0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch
deleted file mode 100644
index cb2eec18..00000000
--- a/recipes-devtools/gdb/files/0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch
+++ /dev/null
@@ -1,553 +0,0 @@
1From 2112c9ded01ddd08f0e31e5ce23eecac6c04e8c4 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@petalogix.com>
3Date: Mon, 6 Feb 2012 10:28:29 +1000
4Subject: [PATCH 06/16] [Patch, microblaze]: Add initial port of linux
5 gdbserver
6
7add gdb_proc_service_h to gdbserver microblaze-linux
8
9gdbserver needs to initialise the microblaze registers
10
11other archs use this step to run a *_arch_setup() to carry out all
12architecture specific setup - may need to add in future
13
14 * add linux-ptrace.o to gdbserver configure
15 * gdb/configure.tgt: Set build_gdbserver=yes
16 * Update breakpoint opcode
17 * fix segfault on connecting gdbserver
18 * add microblaze_linux_memory_remove_breakpoint
19 * add set_solib_svr4_fetch_link_map_offsets
20 * add set_gdbarch_fetch_tls_load_module_address
21 * Force reading of r0 as 0, prevent stores
22
23Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
24Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
25Upstream-Status: Pending
26---
27 gdb/configure.host | 3 +
28 gdb/configure.tgt | 1 +
29 gdb/gdbserver/Makefile.in | 4 +
30 gdb/gdbserver/configure.srv | 6 +
31 gdb/gdbserver/linux-microblaze-low.c | 228 +++++++++++++++++++++++++++++++++++
32 gdb/microblaze-linux-tdep.c | 25 +++-
33 gdb/microblaze-tdep.c | 45 ++++++-
34 gdb/microblaze-tdep.h | 3 +-
35 gdb/regformats/reg-microblaze.dat | 39 ++++++
36 9 files changed, 348 insertions(+), 6 deletions(-)
37 create mode 100644 gdb/gdbserver/linux-microblaze-low.c
38 create mode 100644 gdb/regformats/reg-microblaze.dat
39
40diff --git a/gdb/configure.host b/gdb/configure.host
41index 15a8288..76cc5fe 100644
42--- a/gdb/configure.host
43+++ b/gdb/configure.host
44@@ -59,6 +59,7 @@ i[34567]86*) gdb_host_cpu=i386 ;;
45 m68*) gdb_host_cpu=m68k ;;
46 m88*) gdb_host_cpu=m88k ;;
47 mips*) gdb_host_cpu=mips ;;
48+microblaze*) gdb_host_cpu=microblaze ;;
49 powerpc* | rs6000) gdb_host_cpu=powerpc ;;
50 sparcv9 | sparc64) gdb_host_cpu=sparc ;;
51 s390*) gdb_host_cpu=s390 ;;
52@@ -133,6 +134,8 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
53 gdb_host=nbsd ;;
54 mips64*-*-openbsd*) gdb_host=obsd64 ;;
55
56+microblaze*-*linux*) gdb_host=linux ;;
57+
58 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
59 gdb_host=aix ;;
60 powerpc*-*-freebsd*) gdb_host=fbsd ;;
61diff --git a/gdb/configure.tgt b/gdb/configure.tgt
62index 9297c56..3a7951a 100644
63--- a/gdb/configure.tgt
64+++ b/gdb/configure.tgt
65@@ -343,6 +343,7 @@ microblaze*-linux-*|microblaze*-*-linux*)
66 gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o glibc-tdep.o \
67 monitor.o dsrec.o solib-svr4.o symfile-mem.o linux-tdep.o"
68 gdb_sim=../sim/microblaze/libsim.a
69+ build_gdbserver=yes
70 ;;
71 microblaze*-*-*)
72 # Target: Xilinx MicroBlaze running standalone
73diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
74index f773fa2..a11ace1 100644
75--- a/gdb/gdbserver/Makefile.in
76+++ b/gdb/gdbserver/Makefile.in
77@@ -148,6 +148,7 @@ SFILES= $(srcdir)/gdbreplay.c $(srcdir)/inferiors.c $(srcdir)/dll.c \
78 $(srcdir)/linux-ia64-low.c $(srcdir)/linux-low.c \
79 $(srcdir)/linux-m32r-low.c \
80 $(srcdir)/linux-m68k-low.c $(srcdir)/linux-mips-low.c \
81+ $(srcdir)/linux-microblaze-low.c \
82 $(srcdir)/linux-nios2-low.c \
83 $(srcdir)/linux-ppc-low.c \
84 $(srcdir)/linux-s390-low.c \
85@@ -329,6 +330,7 @@ clean:
86 rm -f arm-with-iwmmxt.c
87 rm -f arm-with-vfpv2.c arm-with-vfpv3.c arm-with-neon.c
88 rm -f mips-linux.c mips64-linux.c
89+ rm -f microblaze-linux.c
90 rm -f nios2-linux.c
91 rm -f powerpc-32.c powerpc-32l.c powerpc-64l.c powerpc-e500l.c
92 rm -f powerpc-altivec32l.c powerpc-cell32l.c powerpc-vsx32l.c
93@@ -612,6 +614,8 @@ reg-m68k.c : $(srcdir)/../regformats/reg-m68k.dat $(regdat_sh)
94 $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-m68k.dat reg-m68k.c
95 reg-cf.c : $(srcdir)/../regformats/reg-cf.dat $(regdat_sh)
96 $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-cf.dat reg-cf.c
97+microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh)
98+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat microblaze-linux.c
99 mips-linux.c : $(srcdir)/../regformats/mips-linux.dat $(regdat_sh)
100 $(SHELL) $(regdat_sh) $(srcdir)/../regformats/mips-linux.dat mips-linux.c
101 mips-dsp-linux.c : $(srcdir)/../regformats/mips-dsp-linux.dat $(regdat_sh)
102diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
103index cc4f53d..359c756 100644
104--- a/gdb/gdbserver/configure.srv
105+++ b/gdb/gdbserver/configure.srv
106@@ -198,6 +198,12 @@ case "${target}" in
107 srv_linux_usrregs=yes
108 srv_linux_thread_db=yes
109 ;;
110+ microblaze*-*-linux*) srv_regobj=microblaze-linux.o
111+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o"
112+ srv_linux_usrregs=yes
113+ srv_linux_regsets=yes
114+ srv_linux_thread_db=yes
115+ ;;
116 nios2*-*-linux*) srv_regobj="nios2-linux.o"
117 srv_tgtobj="$srv_linux_obj linux-nios2-low.o"
118 srv_xmlfiles="nios2-linux.xml"
119diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
120new file mode 100644
121index 0000000..279df9f
122--- /dev/null
123+++ b/gdb/gdbserver/linux-microblaze-low.c
124@@ -0,0 +1,228 @@
125+/* GNU/Linux/Microblaze specific low level interface, for the remote server for
126+ GDB.
127+ Copyright (C) 1995-2013 Free Software Foundation, Inc.
128+
129+ This file is part of GDB.
130+
131+ This program is free software; you can redistribute it and/or modify
132+ it under the terms of the GNU General Public License as published by
133+ the Free Software Foundation; either version 3 of the License, or
134+ (at your option) any later version.
135+
136+ This program is distributed in the hope that it will be useful,
137+ but WITHOUT ANY WARRANTY; without even the implied warranty of
138+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
139+ GNU General Public License for more details.
140+
141+ You should have received a copy of the GNU General Public License
142+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
143+
144+#include "server.h"
145+#include "linux-low.h"
146+
147+#include <asm/ptrace.h>
148+#include <sys/procfs.h>
149+#include <sys/ptrace.h>
150+
151+#include "gdb_proc_service.h"
152+
153+static int microblaze_regmap[] =
154+ {PT_GPR(0), PT_GPR(1), PT_GPR(2), PT_GPR(3),
155+ PT_GPR(4), PT_GPR(5), PT_GPR(6), PT_GPR(7),
156+ PT_GPR(8), PT_GPR(9), PT_GPR(10), PT_GPR(11),
157+ PT_GPR(12), PT_GPR(13), PT_GPR(14), PT_GPR(15),
158+ PT_GPR(16), PT_GPR(17), PT_GPR(18), PT_GPR(19),
159+ PT_GPR(20), PT_GPR(21), PT_GPR(22), PT_GPR(23),
160+ PT_GPR(24), PT_GPR(25), PT_GPR(26), PT_GPR(27),
161+ PT_GPR(28), PT_GPR(29), PT_GPR(30), PT_GPR(31),
162+ PT_PC, PT_MSR, PT_EAR, PT_ESR,
163+ PT_FSR
164+ };
165+
166+#define microblaze_num_regs (sizeof microblaze_regmap / sizeof microblaze_regmap[0])
167+
168+/* Defined in auto-generated file microblaze-linux.c. */
169+void init_registers_microblaze (void);
170+extern const struct target_desc *tdesc_microblaze;
171+
172+static int
173+microblaze_cannot_store_register (int regno)
174+{
175+ if (microblaze_regmap[regno] == -1 || regno == 0)
176+ return 1;
177+
178+ return 0;
179+}
180+
181+static int
182+microblaze_cannot_fetch_register (int regno)
183+{
184+ return 0;
185+}
186+
187+static CORE_ADDR
188+microblaze_get_pc (struct regcache *regcache)
189+{
190+ unsigned long pc;
191+
192+ collect_register_by_name (regcache, "pc", &pc);
193+ return (CORE_ADDR) pc;
194+}
195+
196+static void
197+microblaze_set_pc (struct regcache *regcache, CORE_ADDR pc)
198+{
199+ unsigned long newpc = pc;
200+
201+ supply_register_by_name (regcache, "pc", &newpc);
202+}
203+
204+/* dbtrap insn */
205+/* brki r16, 0x18; */
206+static const unsigned long microblaze_breakpoint = 0xba0c0018;
207+#define microblaze_breakpoint_len 4
208+
209+static int
210+microblaze_breakpoint_at (CORE_ADDR where)
211+{
212+ unsigned long insn;
213+
214+ (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
215+ if (insn == microblaze_breakpoint)
216+ return 1;
217+ /* If necessary, recognize more trap instructions here. GDB only uses the
218+ one. */
219+ return 0;
220+}
221+
222+static CORE_ADDR
223+microblaze_reinsert_addr (struct regcache *regcache)
224+{
225+ unsigned long pc;
226+ collect_register_by_name (regcache, "r15", &pc);
227+ return pc;
228+}
229+
230+#ifdef HAVE_PTRACE_GETREGS
231+
232+static void
233+microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
234+{
235+ int size = register_size (regcache->tdesc, regno);
236+
237+ memset (buf, 0, sizeof (long));
238+
239+ if (size < sizeof (long))
240+ collect_register (regcache, regno, buf + sizeof (long) - size);
241+ else
242+ collect_register (regcache, regno, buf);
243+}
244+
245+static void
246+microblaze_supply_ptrace_register (struct regcache *regcache,
247+ int regno, const char *buf)
248+{
249+ int size = register_size (regcache->tdesc, regno);
250+
251+ if (regno == 0) {
252+ unsigned long regbuf_0 = 0;
253+ /* clobbering r0 so that it is always 0 as enforced by hardware */
254+ supply_register (regcache, regno, (const char*)&regbuf_0);
255+ } else {
256+ if (size < sizeof (long))
257+ supply_register (regcache, regno, buf + sizeof (long) - size);
258+ else
259+ supply_register (regcache, regno, buf);
260+ }
261+}
262+
263+/* Provide only a fill function for the general register set. ps_lgetregs
264+ will use this for NPTL support. */
265+
266+static void microblaze_fill_gregset (struct regcache *regcache, void *buf)
267+{
268+ int i;
269+
270+ for (i = 0; i < 32; i++)
271+ microblaze_collect_ptrace_register (regcache, i, (char *) buf + microblaze_regmap[i]);
272+}
273+
274+static void
275+microblaze_store_gregset (struct regcache *regcache, const void *buf)
276+{
277+ int i;
278+
279+ for (i = 0; i < 32; i++)
280+ supply_register (regcache, i, (char *) buf + microblaze_regmap[i]);
281+}
282+
283+#endif /* HAVE_PTRACE_GETREGS */
284+
285+static struct regset_info microblaze_regsets[] = {
286+#ifdef HAVE_PTRACE_GETREGS
287+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), GENERAL_REGS, microblaze_fill_gregset, microblaze_store_gregset },
288+ { 0, 0, 0, -1, -1, NULL, NULL },
289+#endif /* HAVE_PTRACE_GETREGS */
290+ { 0, 0, 0, -1, -1, NULL, NULL }
291+};
292+
293+static struct regsets_info microblaze_regsets_info =
294+ {
295+ microblaze_regsets, /* regsets */
296+ 0, /* num_regsets */
297+ NULL, /* disabled_regsets */
298+ };
299+
300+static struct usrregs_info microblaze_usrregs_info =
301+ {
302+ microblaze_num_regs,
303+ microblaze_regmap,
304+ };
305+
306+static struct regs_info regs_info =
307+ {
308+ NULL, /* regset_bitmap */
309+ &microblaze_usrregs_info,
310+ &microblaze_regsets_info
311+ };
312+
313+static const struct regs_info *
314+microblaze_regs_info (void)
315+{
316+ return &regs_info;
317+}
318+
319+static void
320+microblaze_arch_setup (void)
321+{
322+ current_process ()->tdesc = tdesc_microblaze;
323+}
324+
325+struct linux_target_ops the_low_target = {
326+ microblaze_arch_setup,
327+ microblaze_regs_info,
328+ microblaze_cannot_fetch_register,
329+ microblaze_cannot_store_register,
330+ NULL, /* fetch_register */
331+ microblaze_get_pc,
332+ microblaze_set_pc,
333+ (const unsigned char *) &microblaze_breakpoint,
334+ microblaze_breakpoint_len,
335+ microblaze_reinsert_addr,
336+ 0,
337+ microblaze_breakpoint_at,
338+ NULL,
339+ NULL,
340+ NULL,
341+ NULL,
342+ microblaze_collect_ptrace_register,
343+ microblaze_supply_ptrace_register,
344+};
345+
346+void
347+initialize_low_arch (void)
348+{
349+ init_registers_microblaze ();
350+
351+ initialize_regsets_info (&microblaze_regsets_info);
352+}
353\ No newline at end of file
354diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
355index 7e6b61b..cf58e21 100644
356--- a/gdb/microblaze-linux-tdep.c
357+++ b/gdb/microblaze-linux-tdep.c
358@@ -38,6 +38,22 @@
359 #include "tramp-frame.h"
360 #include "linux-tdep.h"
361
362+static int microblaze_debug_flag = 0;
363+
364+static void
365+microblaze_debug (const char *fmt, ...)
366+{
367+ if (microblaze_debug_flag)
368+ {
369+ va_list args;
370+
371+ va_start (args, fmt);
372+ printf_unfiltered ("MICROBLAZE LINUX: ");
373+ vprintf_unfiltered (fmt, args);
374+ va_end (args);
375+ }
376+}
377+
378 static int
379 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
380 struct bp_target_info *bp_tgt)
381@@ -47,20 +63,27 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
382 int val;
383 int bplen;
384 gdb_byte old_contents[BREAKPOINT_MAX];
385+ struct cleanup *cleanup;
386
387 /* Determine appropriate breakpoint contents and size for this address. */
388 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
389 if (bp == NULL)
390 error (_("Software breakpoints not implemented for this target."));
391
392+ /* Make sure we see the memory breakpoints. */
393+ cleanup = make_show_memory_breakpoints_cleanup (1);
394 val = target_read_memory (addr, old_contents, bplen);
395
396 /* If our breakpoint is no longer at the address, this means that the
397 program modified the code on us, so it is wrong to put back the
398 old value. */
399 if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
400- val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
401+ {
402+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
403+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
404+ }
405
406+ do_cleanups (cleanup);
407 return val;
408 }
409
410diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
411index 50b68d2..1c6dbfe 100644
412--- a/gdb/microblaze-tdep.c
413+++ b/gdb/microblaze-tdep.c
414@@ -164,6 +164,39 @@ microblaze_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
415 return sp;
416 }
417
418+static int
419+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
420+ struct bp_target_info *bp_tgt)
421+{
422+ CORE_ADDR addr = bp_tgt->placed_address;
423+ const unsigned char *bp;
424+ int val;
425+ int bplen;
426+ gdb_byte old_contents[BREAKPOINT_MAX];
427+ struct cleanup *cleanup;
428+
429+ /* Determine appropriate breakpoint contents and size for this address. */
430+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
431+ if (bp == NULL)
432+ error (_("Software breakpoints not implemented for this target."));
433+
434+ /* Make sure we see the memory breakpoints. */
435+ cleanup = make_show_memory_breakpoints_cleanup (1);
436+ val = target_read_memory (addr, old_contents, bplen);
437+
438+ /* If our breakpoint is no longer at the address, this means that the
439+ program modified the code on us, so it is wrong to put back the
440+ old value. */
441+ if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
442+ {
443+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
444+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
445+ }
446+
447+ do_cleanups (cleanup);
448+ return val;
449+}
450+
451 static const gdb_byte *
452 microblaze_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc,
453 int *len)
454@@ -291,8 +324,8 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
455
456 for (addr = func_addr; addr < stop; addr += INST_WORD_SIZE)
457 {
458- //insn = microblaze_fetch_instruction (addr);
459- insn = insn_block[(addr - func_addr) / INST_WORD_SIZE];
460+ insn = microblaze_fetch_instruction (addr);
461+ //insn = insn_block[(addr - func_addr) / INST_WORD_SIZE];
462 op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
463 microblaze_debug ("%s %08lx op=%x r%d r%d imm=%d\n", paddress (gdbarch, addr), insn, op, rd, ra, imm);
464
465@@ -724,13 +757,15 @@ microblaze_software_single_step (struct frame_info *frame)
466 rb = get_frame_register_unsigned (frame, lrb);
467 else
468 rb = 0;
469+
470 stepbreaks[1].address = microblaze_get_target_address (insn, immfound, imm, pc, ra, rb, &targetvalid, &unconditionalbranch);
471- microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address);
472+ microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address);
473+
474 if (unconditionalbranch)
475 stepbreaks[0].valid = FALSE; /* This is a unconditional branch: will not come to the next address */
476 if (targetvalid && (stepbreaks[0].valid == FALSE ||
477 (stepbreaks[0].address != stepbreaks[1].address))
478- && (stepbreaks[1].address != pc)) {
479+ && (stepbreaks[1].address != pc)) {
480 stepbreaks[1].valid = TRUE;
481 } else {
482 stepbreaks[1].valid = FALSE;
483@@ -900,6 +935,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
484 /* Stack grows downward. */
485 set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
486
487+ set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
488+
489 set_gdbarch_breakpoint_from_pc (gdbarch, microblaze_breakpoint_from_pc);
490 set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
491
492diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
493index fec24b9..98aa0f5 100644
494--- a/gdb/microblaze-tdep.h
495+++ b/gdb/microblaze-tdep.h
496@@ -129,7 +129,8 @@ enum microblaze_regnum
497
498 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
499 Only used for native debugging. */
500-#define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60}
501+#define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
502+#define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
503
504 extern void microblaze_supply_gregset (const struct microblaze_gregset *gregset,
505 struct regcache *regcache,
506diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
507new file mode 100644
508index 0000000..a5dd0a0
509--- /dev/null
510+++ b/gdb/regformats/reg-microblaze.dat
511@@ -0,0 +1,39 @@
512+name:microblaze
513+expedite:r1,pc
514+32:r0
515+32:r1
516+32:r2
517+32:r3
518+32:r4
519+32:r5
520+32:r6
521+32:r7
522+32:r8
523+32:r9
524+32:r10
525+32:r11
526+32:r12
527+32:r13
528+32:r14
529+32:r15
530+32:r16
531+32:r17
532+32:r18
533+32:r19
534+32:r20
535+32:r21
536+32:r22
537+32:r23
538+32:r24
539+32:r25
540+32:r26
541+32:r27
542+32:r28
543+32:r29
544+32:r30
545+32:r31
546+32:pc
547+32:msr
548+32:ear
549+32:esr
550+32:fsr
551--
5521.9.0
553
diff --git a/recipes-devtools/gdb/files/0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch b/recipes-devtools/gdb/files/0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch
deleted file mode 100644
index 7cd11905..00000000
--- a/recipes-devtools/gdb/files/0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch
+++ /dev/null
@@ -1,82 +0,0 @@
1From fb2af2fffb673dbb14d743c8da94c4a83b71c792 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Mon, 26 Nov 2012 17:39:17 +1000
4Subject: [PATCH 07/16] [Patch, microblaze]: Add slr and shr regs and
5 little-endian breakpoint
6
7Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
8Upstream-Status: Pending
9---
10 gdb/microblaze-tdep.c | 10 ++++++++--
11 gdb/microblaze-tdep.h | 6 ++++--
12 gdb/regformats/reg-microblaze.dat | 2 ++
13 3 files changed, 14 insertions(+), 4 deletions(-)
14
15diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
16index 1c6dbfe..0ce4947 100644
17--- a/gdb/microblaze-tdep.c
18+++ b/gdb/microblaze-tdep.c
19@@ -73,7 +73,8 @@ static const char *microblaze_register_names[] =
20 "rpc", "rmsr", "rear", "resr", "rfsr", "rbtr",
21 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
22 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
23- "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi"
24+ "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
25+ "rslr", "rshr"
26 };
27
28 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
29@@ -201,10 +202,15 @@ static const gdb_byte *
30 microblaze_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc,
31 int *len)
32 {
33+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
34 static gdb_byte break_insn[] = MICROBLAZE_BREAKPOINT;
35+ static gdb_byte break_insn_le[] = MICROBLAZE_BREAKPOINT_LE;
36
37 *len = sizeof (break_insn);
38- return break_insn;
39+ if (byte_order == BFD_ENDIAN_BIG)
40+ return break_insn;
41+ else
42+ return break_insn_le;
43 }
44
45 /* Allocate and initialize a frame cache. */
46diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
47index 98aa0f5..cd32e9f 100644
48--- a/gdb/microblaze-tdep.h
49+++ b/gdb/microblaze-tdep.h
50@@ -56,7 +56,7 @@ struct microblaze_frame_cache
51 int fp_regnum;
52
53 /* Offsets to saved registers. */
54- int register_offsets[57]; /* Must match MICROBLAZE_NUM_REGS. */
55+ int register_offsets[59]; /* Must match MICROBLAZE_NUM_REGS. */
56
57 /* Table of saved registers. */
58 struct trad_frame_saved_reg *saved_regs;
59@@ -121,7 +121,9 @@ enum microblaze_regnum
60 MICROBLAZE_RTLBX_REGNUM,
61 MICROBLAZE_RTLBSX_REGNUM,
62 MICROBLAZE_RTLBLO_REGNUM,
63- MICROBLAZE_RTLBHI_REGNUM
64+ MICROBLAZE_RTLBHI_REGNUM,
65+ MICROBLAZE_SLR_REGNUM,
66+ MICROBLAZE_SHR_REGNUM
67 };
68
69 /* All registers are 32 bits. */
70diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
71index a5dd0a0..bd8a438 100644
72--- a/gdb/regformats/reg-microblaze.dat
73+++ b/gdb/regformats/reg-microblaze.dat
74@@ -37,3 +37,5 @@ expedite:r1,pc
75 32:ear
76 32:esr
77 32:fsr
78+32:slr
79+32:shr
80--
811.9.0
82
diff --git a/recipes-devtools/gdb/files/0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch b/recipes-devtools/gdb/files/0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch
deleted file mode 100644
index 7f075d55..00000000
--- a/recipes-devtools/gdb/files/0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch
+++ /dev/null
@@ -1,156 +0,0 @@
1From 7944750e435100e72913f01aa0a43b7d7cffd421 Mon Sep 17 00:00:00 2001
2From: nagaraju <nmekala@xilix.com>
3Date: Tue, 3 Sep 2013 12:09:47 +0530
4Subject: [PATCH 08/16] [Patch, microblaze]: Added Backtrace support to GDB
5
6Added backtrace support without debugging information.
7
8Earlier backtrace used to work only when debug information is available.
9Previous pc & sp values are calculated incorrectly due to which backtrace
10was failing.
11
12In this patch, previous frame sp & pc values are calculated correctly
13in microblaze_frame_cache function and supplied them to
14microblaze_frame_prev_register function
15
16Signed-off-by:nagaraju <nmekala@xilix.com>
17Upstream-Status: Pending
18---
19 gdb/microblaze-tdep.c | 42 ++++++++++++++++++++++++++++++++++--------
20 gdb/microblaze-tdep.h | 5 +++--
21 2 files changed, 37 insertions(+), 10 deletions(-)
22
23diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
24index 0ce4947..247740e 100644
25--- a/gdb/microblaze-tdep.c
26+++ b/gdb/microblaze-tdep.c
27@@ -225,6 +225,7 @@ microblaze_alloc_frame_cache (void)
28 /* Base address. */
29 cache->base = 0;
30 cache->pc = 0;
31+ cache->saved_sp = 0;
32
33 /* Frameless until proven otherwise. */
34 cache->frameless_p = 1;
35@@ -347,6 +348,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
36 cache->frameless_p = 0; /* Frame found. */
37 save_hidden_pointer_found = 0;
38 non_stack_instruction_found = 0;
39+ cache->register_offsets[rd] = -imm;
40 continue;
41 }
42 else if (IS_SPILL_SP(op, rd, ra))
43@@ -508,6 +510,7 @@ microblaze_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
44 return start_pc;
45 }
46
47+enum { REG_UNAVAIL = (CORE_ADDR) -1 };
48 /* Normal frames. */
49
50 static struct microblaze_frame_cache *
51@@ -515,7 +518,7 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache)
52 {
53 struct microblaze_frame_cache *cache;
54 struct gdbarch *gdbarch = get_frame_arch (next_frame);
55- CORE_ADDR func;
56+ CORE_ADDR current_pc;
57 int rn;
58
59 if (*this_cache)
60@@ -529,10 +532,18 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache)
61 for (rn = 0; rn < gdbarch_num_regs (gdbarch); rn++)
62 cache->register_offsets[rn] = -1;
63
64- func = get_frame_func (next_frame);
65+ cache->pc = get_frame_func (next_frame);
66+ current_pc = get_frame_pc (next_frame);
67+
68+ if (cache->pc)
69+ microblaze_analyze_prologue (gdbarch, cache->pc, current_pc,
70+ cache);
71
72 cache->base = get_frame_register_unsigned (next_frame, gdbarch_sp_regnum (gdbarch));
73- cache->pc = get_frame_address_in_block (next_frame);
74+ cache->saved_sp = cache->base + cache->framesize;
75+
76+ cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM] = cache->base;
77+ cache->register_offsets[MICROBLAZE_SP_REGNUM] = cache->saved_sp;
78
79 return cache;
80 }
81@@ -548,7 +559,7 @@ microblaze_frame_this_id (struct frame_info *next_frame, void **this_cache,
82 if (cache->base == 0)
83 return;
84
85- (*this_id) = frame_id_build (cache->base, get_frame_pc (next_frame));
86+ (*this_id) = frame_id_build (cache->base, cache->pc);
87 }
88
89 static struct value *
90@@ -558,6 +569,14 @@ microblaze_frame_prev_register (struct frame_info *this_frame,
91 struct microblaze_frame_cache *cache =
92 microblaze_frame_cache (this_frame, this_cache);
93
94+ if ((regnum == MICROBLAZE_SP_REGNUM &&
95+ cache->register_offsets[MICROBLAZE_SP_REGNUM])
96+ || (regnum == MICROBLAZE_FP_REGNUM &&
97+ cache->register_offsets[MICROBLAZE_SP_REGNUM]))
98+
99+ return frame_unwind_got_constant (this_frame, regnum,
100+ cache->register_offsets[MICROBLAZE_SP_REGNUM]);
101+
102 if (cache->frameless_p)
103 {
104 if (regnum == MICROBLAZE_PC_REGNUM)
105@@ -565,11 +584,18 @@ microblaze_frame_prev_register (struct frame_info *this_frame,
106 if (regnum == MICROBLAZE_SP_REGNUM)
107 regnum = 1;
108 return trad_frame_get_prev_register (this_frame,
109- cache->saved_regs, regnum);
110+ cache->saved_regs, regnum);
111 }
112- else
113- return trad_frame_get_prev_register (this_frame, cache->saved_regs,
114- regnum);
115+
116+ if (regnum == MICROBLAZE_PC_REGNUM)
117+ {
118+ regnum = 15;
119+ return frame_unwind_got_memory (this_frame, regnum,
120+ cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM]);
121+ }
122+
123+ return trad_frame_get_prev_register (this_frame, cache->saved_regs,
124+ regnum);
125
126 }
127
128diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
129index cd32e9f..14eb3ab 100644
130--- a/gdb/microblaze-tdep.h
131+++ b/gdb/microblaze-tdep.h
132@@ -57,6 +57,7 @@ struct microblaze_frame_cache
133
134 /* Offsets to saved registers. */
135 int register_offsets[59]; /* Must match MICROBLAZE_NUM_REGS. */
136+ CORE_ADDR saved_sp;
137
138 /* Table of saved registers. */
139 struct trad_frame_saved_reg *saved_regs;
140@@ -80,11 +81,11 @@ enum microblaze_regnum
141 MICROBLAZE_R12_REGNUM,
142 MICROBLAZE_R13_REGNUM,
143 MICROBLAZE_R14_REGNUM,
144- MICROBLAZE_R15_REGNUM,
145+ MICROBLAZE_R15_REGNUM, MICROBLAZE_PREV_PC_REGNUM = MICROBLAZE_R15_REGNUM,
146 MICROBLAZE_R16_REGNUM,
147 MICROBLAZE_R17_REGNUM,
148 MICROBLAZE_R18_REGNUM,
149- MICROBLAZE_R19_REGNUM,
150+ MICROBLAZE_R19_REGNUM, MICROBLAZE_FP_REGNUM = MICROBLAZE_R19_REGNUM,
151 MICROBLAZE_R20_REGNUM,
152 MICROBLAZE_R21_REGNUM,
153 MICROBLAZE_R22_REGNUM,
154--
1551.9.0
156
diff --git a/recipes-devtools/gdb/files/0009-Patch-microblaze-Initial-support-for-native-gdb.patch b/recipes-devtools/gdb/files/0009-Patch-microblaze-Initial-support-for-native-gdb.patch
deleted file mode 100644
index 1ad6b89c..00000000
--- a/recipes-devtools/gdb/files/0009-Patch-microblaze-Initial-support-for-native-gdb.patch
+++ /dev/null
@@ -1,495 +0,0 @@
1From c7b918283f2e438deef78aae84f6b748a7a1bb54 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@petalogix.com>
3Date: Fri, 20 Jul 2012 15:18:35 +1000
4Subject: [PATCH 09/16] [Patch, microblaze]: Initial support for native gdb
5
6microblaze: Follow PPC method of getting setting registers
7using PTRACE PEEK/POKE
8
9Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
10Upstream-Status: Pending
11---
12 gdb/Makefile.in | 4 +-
13 gdb/config/microblaze/linux.mh | 10 +
14 gdb/microblaze-linux-nat.c | 431 +++++++++++++++++++++++++++++++++++++++++
15 3 files changed, 443 insertions(+), 2 deletions(-)
16 create mode 100644 gdb/config/microblaze/linux.mh
17 create mode 100644 gdb/microblaze-linux-nat.c
18
19diff --git a/gdb/Makefile.in b/gdb/Makefile.in
20index f2c16ec..12870a4 100644
21--- a/gdb/Makefile.in
22+++ b/gdb/Makefile.in
23@@ -904,7 +904,7 @@ top.h bsd-kvm.h gdb-stabs.h reggroups.h \
24 annotate.h sim-regno.h dictionary.h dfp.h main.h frame-unwind.h \
25 remote-fileio.h i386-linux-tdep.h vax-tdep.h objc-lang.h \
26 sentinel-frame.h bcache.h symfile.h windows-tdep.h linux-tdep.h \
27-gdb_usleep.h jit.h xml-syscall.h microblaze-tdep.h \
28+gdb_usleep.h jit.h xml-syscall.h microblaze-tdep.h microblaze-linux-tdep.h \
29 psymtab.h psympriv.h progspace.h bfin-tdep.h ia64-hpux-tdep.h \
30 amd64-darwin-tdep.h charset-list.h \
31 config/djgpp/langinfo.h config/djgpp/nl_types.h darwin-nat.h \
32@@ -1631,7 +1631,7 @@ ALLDEPFILES = \
33 m68kbsd-nat.c m68kbsd-tdep.c \
34 m68klinux-nat.c m68klinux-tdep.c \
35 m88k-tdep.c m88kbsd-nat.c \
36- microblaze-tdep.c microblaze-linux-tdep.c \
37+ microblaze-tdep.c microblaze-linux-nat.c microblaze-linux-tdep.c \
38 mingw-hdep.c \
39 mips-linux-nat.c mips-linux-tdep.c \
40 mips-irix-tdep.c \
41diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
42new file mode 100644
43index 0000000..547d103
44--- /dev/null
45+++ b/gdb/config/microblaze/linux.mh
46@@ -0,0 +1,10 @@
47+# Host: Microblaze, running Linux
48+
49+NAT_FILE= config/nm-linux.h
50+NATDEPFILES= inf-ptrace.o fork-child.o \
51+ microblaze-linux-nat.o proc-service.o linux-thread-db.o \
52+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o \
53+ linux-waitpid.o
54+NAT_CDEPS = $(srcdir)/proc-service.list
55+
56+LOADLIBES = -ldl $(RDYNAMIC)
57diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
58new file mode 100644
59index 0000000..81f8346
60--- /dev/null
61+++ b/gdb/microblaze-linux-nat.c
62@@ -0,0 +1,431 @@
63+/* Microblaze GNU/Linux native support.
64+
65+ Copyright (C) 1988-1989, 1991-1992, 1994, 1996, 2000-2012 Free
66+ Software Foundation, Inc.
67+
68+ This file is part of GDB.
69+
70+ This program is free software; you can redistribute it and/or modify
71+ it under the terms of the GNU General Public License as published by
72+ the Free Software Foundation; either version 3 of the License, or
73+ (at your option) any later version.
74+
75+ This program is distributed in the hope that it will be useful,
76+ but WITHOUT ANY WARRANTY; without even the implied warranty of
77+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
78+ GNU General Public License for more details.
79+
80+ You should have received a copy of the GNU General Public License
81+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
82+
83+#include "defs.h"
84+#include "arch-utils.h"
85+#include "dis-asm.h"
86+#include "frame.h"
87+#include "trad-frame.h"
88+#include "symtab.h"
89+#include "value.h"
90+#include "gdbcmd.h"
91+#include "breakpoint.h"
92+#include "inferior.h"
93+#include "regcache.h"
94+#include "target.h"
95+#include "frame.h"
96+#include "frame-base.h"
97+#include "frame-unwind.h"
98+#include "dwarf2-frame.h"
99+#include "osabi.h"
100+
101+#include "gdb_assert.h"
102+#include <string.h>
103+#include "target-descriptions.h"
104+#include "opcodes/microblaze-opcm.h"
105+#include "opcodes/microblaze-dis.h"
106+
107+#include "linux-nat.h"
108+#include "target-descriptions.h"
109+
110+#include <sys/user.h>
111+#include <sys/utsname.h>
112+#include <sys/procfs.h>
113+#include <sys/ptrace.h>
114+
115+/* Prototypes for supply_gregset etc. */
116+#include "gregset.h"
117+
118+#include "microblaze-tdep.h"
119+
120+#include <elf/common.h>
121+#include "auxv.h"
122+
123+/* Defines ps_err_e, struct ps_prochandle. */
124+#include "gdb_proc_service.h"
125+
126+/* On GNU/Linux, threads are implemented as pseudo-processes, in which
127+ case we may be tracing more than one process at a time. In that
128+ case, inferior_ptid will contain the main process ID and the
129+ individual thread (process) ID. get_thread_id () is used to get
130+ the thread id if it's available, and the process id otherwise. */
131+
132+int
133+get_thread_id (ptid_t ptid)
134+{
135+ int tid = ptid_get_lwp (ptid);
136+ if (0 == tid)
137+ tid = ptid_get_pid (ptid);
138+ return tid;
139+}
140+
141+#define GET_THREAD_ID(PTID) get_thread_id (PTID)
142+
143+/* Non-zero if our kernel may support the PTRACE_GETREGS and
144+ PTRACE_SETREGS requests, for reading and writing the
145+ general-purpose registers. Zero if we've tried one of
146+ them and gotten an error. */
147+int have_ptrace_getsetregs = 1;
148+
149+static int
150+microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
151+{
152+ int u_addr = -1;
153+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
154+ /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
155+ interface, and not the wordsize of the program's ABI. */
156+ int wordsize = sizeof (long);
157+
158+ /* General purpose registers occupy 1 slot each in the buffer. */
159+ if (regno >= MICROBLAZE_R0_REGNUM
160+ && regno <= MICROBLAZE_FSR_REGNUM)
161+ u_addr = (regno * wordsize);
162+
163+ return u_addr;
164+}
165+
166+
167+static void
168+fetch_register (struct regcache *regcache, int tid, int regno)
169+{
170+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
171+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
172+ /* This isn't really an address. But ptrace thinks of it as one. */
173+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
174+ int bytes_transferred;
175+ unsigned int offset; /* Offset of registers within the u area. */
176+ char buf[MAX_REGISTER_SIZE];
177+
178+ if (regaddr == -1)
179+ {
180+ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
181+ regcache_raw_supply (regcache, regno, buf);
182+ return;
183+ }
184+
185+ /* Read the raw register using sizeof(long) sized chunks. On a
186+ 32-bit platform, 64-bit floating-point registers will require two
187+ transfers. */
188+ for (bytes_transferred = 0;
189+ bytes_transferred < register_size (gdbarch, regno);
190+ bytes_transferred += sizeof (long))
191+ {
192+ long l;
193+
194+ errno = 0;
195+ l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
196+ regaddr += sizeof (long);
197+ if (errno != 0)
198+ {
199+ char message[128];
200+ sprintf (message, "reading register %s (#%d)",
201+ gdbarch_register_name (gdbarch, regno), regno);
202+ perror_with_name (message);
203+ }
204+ memcpy (&buf[bytes_transferred], &l, sizeof (l));
205+ }
206+
207+ /* Now supply the register. Keep in mind that the regcache's idea
208+ of the register's size may not be a multiple of sizeof
209+ (long). */
210+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
211+ {
212+ /* Little-endian values are always found at the left end of the
213+ bytes transferred. */
214+ regcache_raw_supply (regcache, regno, buf);
215+ }
216+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
217+ {
218+ /* Big-endian values are found at the right end of the bytes
219+ transferred. */
220+ size_t padding = (bytes_transferred - register_size (gdbarch, regno));
221+ regcache_raw_supply (regcache, regno, buf + padding);
222+ }
223+ else
224+ internal_error (__FILE__, __LINE__,
225+ _("fetch_register: unexpected byte order: %d"),
226+ gdbarch_byte_order (gdbarch));
227+}
228+
229+/* This function actually issues the request to ptrace, telling
230+ it to get all general-purpose registers and put them into the
231+ specified regset.
232+
233+ If the ptrace request does not exist, this function returns 0
234+ and properly sets the have_ptrace_* flag. If the request fails,
235+ this function calls perror_with_name. Otherwise, if the request
236+ succeeds, then the regcache gets filled and 1 is returned. */
237+static int
238+fetch_all_gp_regs (struct regcache *regcache, int tid)
239+{
240+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
241+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
242+ gdb_gregset_t gregset;
243+
244+ if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
245+ {
246+ if (errno == EIO)
247+ {
248+ have_ptrace_getsetregs = 0;
249+ return 0;
250+ }
251+ perror_with_name (_("Couldn't get general-purpose registers."));
252+ }
253+
254+ supply_gregset (regcache, (const gdb_gregset_t *) &gregset);
255+
256+ return 1;
257+}
258+
259+
260+/* This is a wrapper for the fetch_all_gp_regs function. It is
261+ responsible for verifying if this target has the ptrace request
262+ that can be used to fetch all general-purpose registers at one
263+ shot. If it doesn't, then we should fetch them using the
264+ old-fashioned way, which is to iterate over the registers and
265+ request them one by one. */
266+static void
267+fetch_gp_regs (struct regcache *regcache, int tid)
268+{
269+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
270+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
271+ int i;
272+
273+ if (have_ptrace_getsetregs)
274+ if (fetch_all_gp_regs (regcache, tid))
275+ return;
276+
277+ /* If we've hit this point, it doesn't really matter which
278+ architecture we are using. We just need to read the
279+ registers in the "old-fashioned way". */
280+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++)
281+ fetch_register (regcache, tid, i);
282+}
283+
284+
285+static void
286+store_register (const struct regcache *regcache, int tid, int regno)
287+{
288+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
289+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
290+ /* This isn't really an address. But ptrace thinks of it as one. */
291+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
292+ int i;
293+ size_t bytes_to_transfer;
294+ char buf[MAX_REGISTER_SIZE];
295+
296+ if (regaddr == -1)
297+ return;
298+
299+ /* First collect the register. Keep in mind that the regcache's
300+ idea of the register's size may not be a multiple of sizeof
301+ (long). */
302+ memset (buf, 0, sizeof buf);
303+ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long));
304+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
305+ {
306+ /* Little-endian values always sit at the left end of the buffer. */
307+ regcache_raw_collect (regcache, regno, buf);
308+ }
309+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
310+ {
311+ /* Big-endian values sit at the right end of the buffer. */
312+ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
313+ regcache_raw_collect (regcache, regno, buf + padding);
314+ }
315+
316+ for (i = 0; i < bytes_to_transfer; i += sizeof (long))
317+ {
318+ long l;
319+
320+ memcpy (&l, &buf[i], sizeof (l));
321+ errno = 0;
322+ ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l);
323+ regaddr += sizeof (long);
324+
325+ if (errno != 0)
326+ {
327+ char message[128];
328+ sprintf (message, "writing register %s (#%d)",
329+ gdbarch_register_name (gdbarch, regno), regno);
330+ perror_with_name (message);
331+ }
332+ }
333+}
334+
335+/* This function actually issues the request to ptrace, telling
336+ it to store all general-purpose registers present in the specified
337+ regset.
338+
339+ If the ptrace request does not exist, this function returns 0
340+ and properly sets the have_ptrace_* flag. If the request fails,
341+ this function calls perror_with_name. Otherwise, if the request
342+ succeeds, then the regcache is stored and 1 is returned. */
343+static int
344+store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
345+{
346+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
347+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
348+ gdb_gregset_t gregset;
349+
350+ if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
351+ {
352+ if (errno == EIO)
353+ {
354+ have_ptrace_getsetregs = 0;
355+ return 0;
356+ }
357+ perror_with_name (_("Couldn't get general-purpose registers."));
358+ }
359+
360+ fill_gregset (regcache, &gregset, regno);
361+
362+ if (ptrace (PTRACE_SETREGS, tid, 0, (void *) &gregset) < 0)
363+ {
364+ if (errno == EIO)
365+ {
366+ have_ptrace_getsetregs = 0;
367+ return 0;
368+ }
369+ perror_with_name (_("Couldn't set general-purpose registers."));
370+ }
371+
372+ return 1;
373+}
374+
375+/* This is a wrapper for the store_all_gp_regs function. It is
376+ responsible for verifying if this target has the ptrace request
377+ that can be used to store all general-purpose registers at one
378+ shot. If it doesn't, then we should store them using the
379+ old-fashioned way, which is to iterate over the registers and
380+ store them one by one. */
381+static void
382+store_gp_regs (const struct regcache *regcache, int tid, int regno)
383+{
384+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
385+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
386+ int i;
387+
388+ if (have_ptrace_getsetregs)
389+ if (store_all_gp_regs (regcache, tid, regno))
390+ return;
391+
392+ /* If we hit this point, it doesn't really matter which
393+ architecture we are using. We just need to store the
394+ registers in the "old-fashioned way". */
395+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++)
396+ store_register (regcache, tid, i);
397+}
398+
399+
400+/* Fetch registers from the child process. Fetch all registers if
401+ regno == -1, otherwise fetch all general registers or all floating
402+ point registers depending upon the value of regno. */
403+
404+static void
405+microblaze_linux_fetch_inferior_registers (struct target_ops *ops,
406+ struct regcache *regcache, int regno)
407+{
408+ /* Get the thread id for the ptrace call. */
409+ int tid = GET_THREAD_ID (inferior_ptid);
410+
411+ if (regno == -1)
412+ fetch_gp_regs (regcache, tid);
413+ else
414+ fetch_register (regcache, tid, regno);
415+}
416+
417+/* Store registers back into the inferior. Store all registers if
418+ regno == -1, otherwise store all general registers or all floating
419+ point registers depending upon the value of regno. */
420+
421+static void
422+microblaze_linux_store_inferior_registers (struct target_ops *ops,
423+ struct regcache *regcache, int regno)
424+{
425+ /* Get the thread id for the ptrace call. */
426+ int tid = GET_THREAD_ID (inferior_ptid);
427+
428+ if (regno >= 0)
429+ store_register (regcache, tid, regno);
430+ else
431+ store_gp_regs (regcache, tid, -1);
432+}
433+
434+/* Wrapper functions for the standard regset handling, used by
435+ thread debugging. */
436+
437+void
438+fill_gregset (const struct regcache *regcache,
439+ gdb_gregset_t *gregsetp, int regno)
440+{
441+ microblaze_collect_gregset (NULL, regcache, regno, gregsetp);
442+}
443+
444+void
445+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
446+{
447+ microblaze_supply_gregset (NULL, regcache, -1, gregsetp);
448+}
449+
450+void
451+fill_fpregset (const struct regcache *regcache,
452+ gdb_fpregset_t *fpregsetp, int regno)
453+{
454+ /* FIXME. */
455+}
456+
457+void
458+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
459+{
460+ /* FIXME. */
461+}
462+
463+static const struct target_desc *
464+microblaze_linux_read_description (struct target_ops *ops)
465+{
466+ CORE_ADDR microblaze_hwcap = 0;
467+
468+ if (target_auxv_search (ops, AT_HWCAP, &microblaze_hwcap) != 1)
469+ return NULL;
470+
471+ return NULL;
472+}
473+
474+
475+void _initialize_microblaze_linux_nat (void);
476+
477+void
478+_initialize_microblaze_linux_nat (void)
479+{
480+ struct target_ops *t;
481+
482+ /* Fill in the generic GNU/Linux methods. */
483+ t = linux_target ();
484+
485+ /* Add our register access methods. */
486+ t->to_fetch_registers = microblaze_linux_fetch_inferior_registers;
487+ t->to_store_registers = microblaze_linux_store_inferior_registers;
488+
489+ t->to_read_description = microblaze_linux_read_description;
490+
491+ /* Register the target. */
492+ linux_nat_add_target (t);
493+}
494--
4951.9.0
diff --git a/recipes-devtools/gdb/files/0010-Patch-gdb-Robustify-inline-function-support.patch b/recipes-devtools/gdb/files/0010-Patch-gdb-Robustify-inline-function-support.patch
deleted file mode 100644
index 3912ca57..00000000
--- a/recipes-devtools/gdb/files/0010-Patch-gdb-Robustify-inline-function-support.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From a02963a97d7ce38b0af205f9e3e6dd7e0e06d9be Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar@axis.com>
3Date: Mon, 27 Feb 2012 06:28:00 +0100
4Subject: [PATCH 10/16] [Patch, gdb]: Robustify inline function support
5
6Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
7Upstream-Status: Pending
8---
9 gdb/blockframe.c | 3 ++-
10 gdb/inline-frame.c | 3 +++
11 2 files changed, 5 insertions(+), 1 deletion(-)
12
13diff --git a/gdb/blockframe.c b/gdb/blockframe.c
14index 0a9381e..ba41d85 100644
15--- a/gdb/blockframe.c
16+++ b/gdb/blockframe.c
17@@ -77,7 +77,8 @@ get_frame_block (struct frame_info *frame, CORE_ADDR *addr_in_block)
18 inline_count--;
19
20 bl = BLOCK_SUPERBLOCK (bl);
21- gdb_assert (bl != NULL);
22+ if (!bl)
23+ return NULL;
24 }
25
26 return bl;
27diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c
28index eb82143..a793390 100644
29--- a/gdb/inline-frame.c
30+++ b/gdb/inline-frame.c
31@@ -231,6 +231,9 @@ inline_frame_sniffer (const struct frame_unwind *self,
32 cur_block = BLOCK_SUPERBLOCK (cur_block);
33 }
34
35+ if (depth == 0)
36+ return 0;
37+
38 /* Check how many inlined functions already have frames. */
39 for (next_frame = get_next_frame (this_frame);
40 next_frame && get_frame_type (next_frame) == INLINE_FRAME;
41--
421.9.0
43
diff --git a/recipes-devtools/gdb/files/0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch b/recipes-devtools/gdb/files/0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch
deleted file mode 100644
index bdec77c5..00000000
--- a/recipes-devtools/gdb/files/0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From a05fb34192727fc1b63c827ed006ddde846ce6b8 Mon Sep 17 00:00:00 2001
2From: Nathan Rossi <nathan.rossi@petalogix.com>
3Date: Tue, 8 May 2012 18:11:17 +1000
4Subject: [PATCH 11/16] [Patch, gdb]: Fix debug message when register is
5 unavailable
6
7Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
8Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
9Upstream-Status: Pending
10---
11 gdb/frame.c | 13 ++++++++++---
12 1 file changed, 10 insertions(+), 3 deletions(-)
13
14diff --git a/gdb/frame.c b/gdb/frame.c
15index 013d602..4d0766f 100644
16--- a/gdb/frame.c
17+++ b/gdb/frame.c
18@@ -1134,12 +1134,19 @@ frame_unwind_register_value (struct frame_info *frame, int regnum)
19 else
20 {
21 int i;
22- const gdb_byte *buf = value_contents (value);
23+ const gdb_byte *buf = NULL;
24+ if (value_entirely_available(value)) {
25+ buf = value_contents (value);
26+ }
27
28 fprintf_unfiltered (gdb_stdlog, " bytes=");
29 fprintf_unfiltered (gdb_stdlog, "[");
30- for (i = 0; i < register_size (gdbarch, regnum); i++)
31- fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
32+ if (buf != NULL) {
33+ for (i = 0; i < register_size (gdbarch, regnum); i++)
34+ fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
35+ } else {
36+ fprintf_unfiltered (gdb_stdlog, "unavailable");
37+ }
38 fprintf_unfiltered (gdb_stdlog, "]");
39 }
40 }
41--
421.9.0
43
diff --git a/recipes-devtools/gdb/files/0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch b/recipes-devtools/gdb/files/0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch
deleted file mode 100644
index 819cd179..00000000
--- a/recipes-devtools/gdb/files/0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From f54d5334afe799e15ca21c5d83097a4c81bbab7e Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Fri, 22 Jun 2012 01:20:20 +0200
4Subject: [PATCH 12/16] [LOCAL]: Disable the warning message for eh_frame_hdr
5
6Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
7Upstream-Status: Pending
8---
9 bfd/elf-eh-frame.c | 9 ++++++---
10 1 file changed, 6 insertions(+), 3 deletions(-)
11
12diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
13index 0f0a563..7d8e047 100644
14--- a/bfd/elf-eh-frame.c
15+++ b/bfd/elf-eh-frame.c
16@@ -919,9 +919,12 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
17 goto success;
18
19 free_no_table:
20- (*info->callbacks->einfo)
21- (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"),
22- abfd, sec);
23+ /* FIXME: Remove the microblaze specifics when relaxing gets fixed. */
24+ if (bfd_get_arch(abfd) != bfd_arch_microblaze) {
25+ (*info->callbacks->einfo)
26+ (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"),
27+ abfd, sec);
28+ }
29 hdr_info->table = FALSE;
30 if (sec_info)
31 free (sec_info);
32--
331.9.0
34
diff --git a/recipes-devtools/gdb/files/0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch b/recipes-devtools/gdb/files/0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch
deleted file mode 100644
index 3a0eae83..00000000
--- a/recipes-devtools/gdb/files/0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch
+++ /dev/null
@@ -1,64 +0,0 @@
1From c9f1f07e5b0756069e3d4b04eb9505027f09677f 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 13/16] [LOCAL]: Fix relaxation of assembler resolved
5 references
6
7Upstream-Status: Pending
8---
9 bfd/elf32-microblaze.c | 39 +++++++++++++++++++++++++++++++++++++++
10 1 file changed, 39 insertions(+)
11
12diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
13index cbd18f0..f90df47 100644
14--- a/bfd/elf32-microblaze.c
15+++ b/bfd/elf32-microblaze.c
16@@ -1968,6 +1968,45 @@ microblaze_elf_relax_section (bfd *abfd,
17 irelscanend = irelocs + o->reloc_count;
18 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
19 {
20+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE)
21+ {
22+ unsigned int val;
23+
24+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
25+
26+ /* This was a PC-relative instruction that was completely resolved. */
27+ if (ocontents == NULL)
28+ {
29+ if (elf_section_data (o)->this_hdr.contents != NULL)
30+ ocontents = elf_section_data (o)->this_hdr.contents;
31+ else
32+ {
33+ /* We always cache the section contents.
34+ Perhaps, if info->keep_memory is FALSE, we
35+ should free them, if we are permitted to. */
36+
37+ if (o->rawsize == 0)
38+ o->rawsize = o->size;
39+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
40+ if (ocontents == NULL)
41+ goto error_return;
42+ if (!bfd_get_section_contents (abfd, o, ocontents,
43+ (file_ptr) 0,
44+ o->rawsize))
45+ goto error_return;
46+ elf_section_data (o)->this_hdr.contents = ocontents;
47+ }
48+ }
49+
50+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
51+ + isym->st_value, sec);
52+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
53+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
54+ irelscan->r_addend);
55+ }
56+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) {
57+ fprintf(stderr, "Unhandled NONE 64\n");
58+ }
59 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
60 {
61 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
62--
631.9.0
64
diff --git a/recipes-devtools/gdb/files/0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch b/recipes-devtools/gdb/files/0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch
deleted file mode 100644
index 85cee9d5..00000000
--- a/recipes-devtools/gdb/files/0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch
+++ /dev/null
@@ -1,192 +0,0 @@
1From aca2758cff1f8fdc5ad7b6076ef985ba9ec5f857 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Mon, 4 Feb 2013 12:15:22 +1000
4Subject: [PATCH 14/16] [LOCAL]: Fixup debug_loc sections after linker
5 relaxation
6
7Adds a new reloctype R_MICROBLAZE_32_NONE, used for passing
8reloc info from the assembler to the linker when the linker
9manages to fully resolve a local symbol reference.
10
11This is a workaround for design flaws in the assembler to
12linker interface with regards to linker relaxation.
13
14Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
16Upstream-Status: Pending
17---
18 bfd/bfd-in2.h | 5 +++++
19 bfd/elf32-microblaze.c | 45 +++++++++++++++++++++++++++++++++++++--------
20 bfd/libbfd.h | 1 +
21 bfd/reloc.c | 6 ++++++
22 include/elf/microblaze.h | 1 +
23 5 files changed, 50 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..a3f89b9 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, 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, 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/include/elf/microblaze.h b/include/elf/microblaze.h
179index effca20..f8420dc 100644
180--- a/include/elf/microblaze.h
181+++ b/include/elf/microblaze.h
182@@ -58,6 +58,7 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
183 RELOC_NUMBER (R_MICROBLAZE_TLSDTPREL64, 27) /* TLS Offset Within TLS Block */
184 RELOC_NUMBER (R_MICROBLAZE_TLSGOTTPREL32, 28) /* TLS Offset From Thread Pointer */
185 RELOC_NUMBER (R_MICROBLAZE_TLSTPREL32, 29) /* TLS Offset From Thread Pointer */
186+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 30)
187
188 END_RELOC_NUMBERS (R_MICROBLAZE_max)
189
190--
1911.9.0
192
diff --git a/recipes-devtools/gdb/files/0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch b/recipes-devtools/gdb/files/0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch
deleted file mode 100644
index 0bb66a94..00000000
--- a/recipes-devtools/gdb/files/0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From 22c63d4d79ac488403340470c14c73bad4984fa3 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 27 Feb 2013 13:56:11 +1000
4Subject: [PATCH 15/16] [LOCAL]: upstream change to garbage collection sweep
5 causes mb regression
6
7Upstream change for PR13177 now clears the def_regular during gc_sweep of a
8section. (All other archs in binutils/bfd/elf32-*.c received an update
9to a warning about unresolvable relocations - this warning is not present
10in binutils/bfd/elf32-microblaze.c, but this warning check would not
11prevent the error being seen)
12
13The visible issue with this change is when running a c++ application
14in Petalinux which links libstdc++.so for exception handling it segfaults
15on execution.
16
17This does not occur if static linking libstdc++.a, so its during the
18relocations for a shared lib with garbage collection this occurs
19
20Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
21Upstream-Status: Pending
22---
23 bfd/elflink.c | 1 -
24 1 file changed, 1 deletion(-)
25
26diff --git a/bfd/elflink.c b/bfd/elflink.c
27index 6756fb1..f21dc06 100644
28--- a/bfd/elflink.c
29+++ b/bfd/elflink.c
30@@ -11932,7 +11932,6 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
31
32 inf = (struct elf_gc_sweep_symbol_info *) data;
33 (*inf->hide_symbol) (inf->info, h, TRUE);
34- h->def_regular = 0;
35 h->ref_regular = 0;
36 h->ref_regular_nonweak = 0;
37 }
38--
391.9.0
40
diff --git a/recipes-devtools/gdb/gdb-7.7.1.inc b/recipes-devtools/gdb/gdb-7.7.1.inc
deleted file mode 100644
index 04488e9e..00000000
--- a/recipes-devtools/gdb/gdb-7.7.1.inc
+++ /dev/null
@@ -1,11 +0,0 @@
1LICENSE = "GPLv2 & GPLv3 & LGPLv2 & LGPLv3"
2LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
3 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
4 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
5 file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674"
6
7S = "${WORKDIR}/${BPN}-${PV}"
8
9SRC_URI[md5sum] = "45b07b53d81832d32ccd4829465d4886"
10SRC_URI[sha256sum] = "eefadb9831e3695d1eaef34e98b8f1fb441df6fe5071317ea49c6bd6ba213eff"
11
diff --git a/recipes-devtools/gdb/gdb-cross-canadian_7.7.1.bb b/recipes-devtools/gdb/gdb-cross-canadian_7.7.1.bb
deleted file mode 100644
index c349ebbb..00000000
--- a/recipes-devtools/gdb/gdb-cross-canadian_7.7.1.bb
+++ /dev/null
@@ -1,4 +0,0 @@
1require recipes-devtools/gdb/gdb-common.inc
2require recipes-devtools/gdb/gdb-cross-canadian.inc
3require gdb-${PV}.inc
4require gdb-microblaze-7.7.inc
diff --git a/recipes-devtools/gdb/gdb-cross_7.7.1.bb b/recipes-devtools/gdb/gdb-cross_7.7.1.bb
deleted file mode 100644
index 98b3359c..00000000
--- a/recipes-devtools/gdb/gdb-cross_7.7.1.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require recipes-devtools/gdb/gdb-cross.inc
2require gdb-${PV}.inc
3require gdb-microblaze-7.7.inc
diff --git a/recipes-devtools/gdb/gdb-microblaze-7.7.inc b/recipes-devtools/gdb/gdb-microblaze-7.7.inc
deleted file mode 100644
index 0b82bc67..00000000
--- a/recipes-devtools/gdb/gdb-microblaze-7.7.inc
+++ /dev/null
@@ -1,22 +0,0 @@
1
2# MicroBlaze does not support LTTng UST
3LTTNGUST_microblaze = ""
4
5# Add MicroBlaze Patches
6FILESEXTRAPATHS_append := "${THISDIR}/files:"
7SRC_URI_append += " \
8 file://0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch \
9 file://0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch \
10 file://0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch \
11 file://0005-Patch-microblaze-Add-mb-singlestepping.patch \
12 file://0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch \
13 file://0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch \
14 file://0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch \
15 file://0009-Patch-microblaze-Initial-support-for-native-gdb.patch \
16 file://0010-Patch-gdb-Robustify-inline-function-support.patch \
17 file://0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch \
18 file://0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch \
19 file://0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch \
20 file://0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch \
21 file://0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch \
22 "
diff --git a/recipes-devtools/gdb/gdb_7.7.1.bb b/recipes-devtools/gdb/gdb_7.7.1.bb
deleted file mode 100644
index 80b589a1..00000000
--- a/recipes-devtools/gdb/gdb_7.7.1.bb
+++ /dev/null
@@ -1,29 +0,0 @@
1require recipes-devtools/gdb/gdb-common.inc
2require gdb-${PV}.inc
3require gdb-microblaze-7.7.inc
4
5inherit gettext
6inherit python-dir
7
8PACKAGECONFIG ??= ""
9PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,python"
10PACKAGECONFIG[babeltrace] = "--with-babeltrace,--without-babeltrace,babeltrace"
11
12do_configure_prepend() {
13 if [ -n "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}" ]; then
14 cat > ${WORKDIR}/python << EOF
15#!/bin/sh
16case "\$2" in
17 --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}/" ;;
18 --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}" ;;
19 --exec-prefix) echo "${exec_prefix}" ;;
20 *) exit 1 ;;
21esac
22exit 0
23EOF
24 chmod +x ${WORKDIR}/python
25 fi
26}
27
28PACKAGES =+ "gdbserver"
29FILES_gdbserver = "${bindir}/gdbserver"
diff --git a/recipes-devtools/gnu-config/files/microblazeel.patch b/recipes-devtools/gnu-config/files/microblazeel.patch
deleted file mode 100644
index 2b8249d5..00000000
--- a/recipes-devtools/gnu-config/files/microblazeel.patch
+++ /dev/null
@@ -1,68 +0,0 @@
1From fb456b34ef4aa02b95dc6be69aaa66fa94a844fb Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 10 Oct 2012 04:33:17 +0000
4Subject: * config.sub (microblazeel): New.
5
6 * testsuite/config-sub.data: Add a test case.
7
8Signed-off-by: Ben Elliston <bje@gnu.org>
9Upstream-Status: Backport [Not part of 2012-08-14]
10---
11diff --git a/config.sub b/config.sub
12index bdda9e4..826e4c6 100755
13--- a/config.sub
14+++ b/config.sub
15@@ -156,7 +156,7 @@ case $os in
16 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
17 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
18 -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
19- -apple | -axis | -knuth | -cray | -microblaze)
20+ -apple | -axis | -knuth | -cray | -microblaze*)
21 os=
22 basic_machine=$1
23 ;;
24@@ -273,7 +273,7 @@ case $basic_machine in
25 | le32 | le64 \
26 | lm32 \
27 | m32c | m32r | m32rle | m68000 | m68k | m88k \
28- | maxq | mb | microblaze | mcore | mep | metag \
29+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
30 | mips | mipsbe | mipseb | mipsel | mipsle \
31 | mips16 \
32 | mips64 | mips64el \
33@@ -389,7 +389,8 @@ case $basic_machine in
34 | lm32-* \
35 | m32c-* | m32r-* | m32rle-* \
36 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
37- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
38+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
39+ | microblaze-* | microblazeel-* \
40 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
41 | mips16-* \
42 | mips64-* | mips64el-* \
43@@ -788,7 +789,7 @@ case $basic_machine in
44 basic_machine=ns32k-utek
45 os=-sysv
46 ;;
47- microblaze)
48+ microblaze*)
49 basic_machine=microblaze-xilinx
50 ;;
51 mingw64)
52diff --git a/testsuite/config-sub.data b/testsuite/config-sub.data
53index fafbca1..9bd2cd5 100644
54--- a/testsuite/config-sub.data
55+++ b/testsuite/config-sub.data
56@@ -99,8 +99,11 @@ mep mep-unknown-elf
57 metag-linux metag-unknown-linux-gnu
58 metag metag-unknown-none
59 microblaze-elf microblaze-unknown-elf
60+microblazeel-elf microblazeel-unknown-elf
61 microblaze-linux microblaze-unknown-linux-gnu
62+microblazeel-linux microblazeel-unknown-linux-gnu
63 microblaze microblaze-unknown-none
64+microblazeel microblazeel-unknown-none
65 mingw32ce arm-unknown-mingw32ce
66 mingw64 x86_64-pc-mingw64
67 mips64octeonel-elf mips64octeonel-unknown-elf
68---
diff --git a/recipes-devtools/gnu-config/gnu-config_20120814.bbappend b/recipes-devtools/gnu-config/gnu-config_20120814.bbappend
deleted file mode 100644
index 0a9331cb..00000000
--- a/recipes-devtools/gnu-config/gnu-config_20120814.bbappend
+++ /dev/null
@@ -1,6 +0,0 @@
1
2FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
3
4# Apply patch to add "microblazeel" support to gnu-config
5SRC_URI += "file://microblazeel.patch"
6
diff --git a/recipes-devtools/qemu/qemu_%.bbappend b/recipes-devtools/qemu/qemu_%.bbappend
deleted file mode 100644
index 4c37b1e0..00000000
--- a/recipes-devtools/qemu/qemu_%.bbappend
+++ /dev/null
@@ -1,2 +0,0 @@
1QEMU_TARGETS += "microblazeel"
2