diff options
author | Mark Hatle <mark.hatle@xilinx.com> | 2020-12-03 16:47:57 -0800 |
---|---|---|
committer | Mark Hatle <mark.hatle@xilinx.com> | 2020-12-04 16:23:55 -0800 |
commit | c9bf136ef42d5672a645c3caed23e1f99ac75a20 (patch) | |
tree | f4a9d489deea97f334cb98ba38233ebdeff9d9be /meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch | |
parent | 64c6e9b11168046c044d87f6fcefea3c86c2e613 (diff) | |
download | meta-xilinx-c9bf136ef42d5672a645c3caed23e1f99ac75a20.tar.gz |
gdb: update to early gatesgarth version
Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
Diffstat (limited to 'meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch')
-rw-r--r-- | meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch | 184 |
1 files changed, 0 insertions, 184 deletions
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch deleted file mode 100644 index eea29059..00000000 --- a/meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch +++ /dev/null | |||
@@ -1,184 +0,0 @@ | |||
1 | From d2aee40b9753b783853bf38d36d9b6e50d16cc20 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nagaraju Mekala <nmekala@xilix.com> | ||
3 | Date: Mon, 6 Feb 2017 15:53:08 +0530 | ||
4 | Subject: [PATCH 06/40] microblaze: Fixup debug_loc sections after linker | ||
5 | relaxation | ||
6 | |||
7 | Adds a new reloctype R_MICROBLAZE_32_NONE, used for passing | ||
8 | reloc info from the assembler to the linker when the linker | ||
9 | manages to fully resolve a local symbol reference. | ||
10 | |||
11 | This is a workaround for design flaws in the assembler to | ||
12 | linker interface with regards to linker relaxation. | ||
13 | |||
14 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> | ||
15 | Signed-off-by: Nagaraju Mekala <nmekala@xilinx.com> | ||
16 | --- | ||
17 | bfd/bfd-in2.h | 5 +++++ | ||
18 | bfd/elf32-microblaze.c | 39 +++++++++++++++++++++++++++++++------- | ||
19 | bfd/libbfd.h | 1 + | ||
20 | bfd/reloc.c | 6 ++++++ | ||
21 | include/elf/microblaze.h | 1 + | ||
22 | 7 files changed, 52 insertions(+), 7 deletions(-) | ||
23 | |||
24 | diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h | ||
25 | index 6f3e41da376..52c81b10b6d 100644 | ||
26 | --- a/bfd/bfd-in2.h | ||
27 | +++ b/bfd/bfd-in2.h | ||
28 | @@ -5363,6 +5363,11 @@ value relative to the read-write small data area anchor */ | ||
29 | expressions of the form "Symbol Op Symbol" */ | ||
30 | BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM, | ||
31 | |||
32 | +/* This is a 32 bit reloc that stores the 32 bit pc relative | ||
33 | +value in two words (with an imm instruction). No relocation is | ||
34 | +done here - only used for relaxing */ | ||
35 | + BFD_RELOC_MICROBLAZE_32_NONE, | ||
36 | + | ||
37 | /* This is a 64 bit reloc that stores the 32 bit pc relative | ||
38 | value in two words (with an imm instruction). No relocation is | ||
39 | done here - only used for relaxing */ | ||
40 | diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c | ||
41 | index dfd82438e35..cbba704e691 100644 | ||
42 | --- a/bfd/elf32-microblaze.c | ||
43 | +++ b/bfd/elf32-microblaze.c | ||
44 | @@ -176,6 +176,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] = | ||
45 | 0x0000ffff, /* Dest Mask. */ | ||
46 | FALSE), /* PC relative offset? */ | ||
47 | |||
48 | + HOWTO (R_MICROBLAZE_32_NONE, /* Type. */ | ||
49 | + 0, /* Rightshift. */ | ||
50 | + 2, /* Size (0 = byte, 1 = short, 2 = long). */ | ||
51 | + 32, /* Bitsize. */ | ||
52 | + TRUE, /* PC_relative. */ | ||
53 | + 0, /* Bitpos. */ | ||
54 | + complain_overflow_bitfield, /* Complain on overflow. */ | ||
55 | + NULL, /* Special Function. */ | ||
56 | + "R_MICROBLAZE_32_NONE",/* Name. */ | ||
57 | + FALSE, /* Partial Inplace. */ | ||
58 | + 0, /* Source Mask. */ | ||
59 | + 0, /* Dest Mask. */ | ||
60 | + FALSE), /* PC relative offset? */ | ||
61 | + | ||
62 | /* This reloc does nothing. Used for relaxation. */ | ||
63 | HOWTO (R_MICROBLAZE_64_NONE, /* Type. */ | ||
64 | 0, /* Rightshift. */ | ||
65 | @@ -562,6 +576,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, | ||
66 | case BFD_RELOC_NONE: | ||
67 | microblaze_reloc = R_MICROBLAZE_NONE; | ||
68 | break; | ||
69 | + case BFD_RELOC_MICROBLAZE_32_NONE: | ||
70 | + microblaze_reloc = R_MICROBLAZE_32_NONE; | ||
71 | + break; | ||
72 | case BFD_RELOC_MICROBLAZE_64_NONE: | ||
73 | microblaze_reloc = R_MICROBLAZE_64_NONE; | ||
74 | break; | ||
75 | @@ -1918,14 +1935,22 @@ microblaze_elf_relax_section (bfd *abfd, | ||
76 | } | ||
77 | break; | ||
78 | case R_MICROBLAZE_NONE: | ||
79 | + case R_MICROBLAZE_32_NONE: | ||
80 | { | ||
81 | /* This was a PC-relative instruction that was | ||
82 | completely resolved. */ | ||
83 | int sfix, efix; | ||
84 | + unsigned int val; | ||
85 | bfd_vma target_address; | ||
86 | target_address = irel->r_addend + irel->r_offset; | ||
87 | sfix = calc_fixup (irel->r_offset, 0, sec); | ||
88 | efix = calc_fixup (target_address, 0, sec); | ||
89 | + | ||
90 | + /* Validate the in-band val. */ | ||
91 | + val = bfd_get_32 (abfd, contents + irel->r_offset); | ||
92 | + if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) { | ||
93 | + fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); | ||
94 | + } | ||
95 | irel->r_addend -= (efix - sfix); | ||
96 | /* Should use HOWTO. */ | ||
97 | microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset, | ||
98 | @@ -1973,12 +1998,16 @@ microblaze_elf_relax_section (bfd *abfd, | ||
99 | irelscanend = irelocs + o->reloc_count; | ||
100 | for (irelscan = irelocs; irelscan < irelscanend; irelscan++) | ||
101 | { | ||
102 | - if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE) | ||
103 | + if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE) | ||
104 | { | ||
105 | unsigned int val; | ||
106 | |||
107 | isym = isymbuf + ELF32_R_SYM (irelscan->r_info); | ||
108 | |||
109 | + /* hax: We only do the following fixup for debug location lists. */ | ||
110 | + if (strcmp(".debug_loc", o->name)) | ||
111 | + continue; | ||
112 | + | ||
113 | /* This was a PC-relative instruction that was completely resolved. */ | ||
114 | if (ocontents == NULL) | ||
115 | { | ||
116 | @@ -2006,14 +2035,10 @@ microblaze_elf_relax_section (bfd *abfd, | ||
117 | if (val != irelscan->r_addend) { | ||
118 | fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend); | ||
119 | } | ||
120 | - irelscan->r_addend -= calc_fixup (irelscan->r_addend | ||
121 | - + isym->st_value, 0, sec); | ||
122 | + irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec); | ||
123 | microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, | ||
124 | irelscan->r_addend); | ||
125 | } | ||
126 | - if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) { | ||
127 | - fprintf(stderr, "Unhandled NONE 64\n"); | ||
128 | - } | ||
129 | if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) | ||
130 | { | ||
131 | isym = isymbuf + ELF32_R_SYM (irelscan->r_info); | ||
132 | @@ -2073,7 +2098,7 @@ microblaze_elf_relax_section (bfd *abfd, | ||
133 | elf_section_data (o)->this_hdr.contents = ocontents; | ||
134 | } | ||
135 | } | ||
136 | - irelscan->r_addend -= calc_fixup (irel->r_addend | ||
137 | + irelscan->r_addend -= calc_fixup (irelscan->r_addend | ||
138 | + isym->st_value, | ||
139 | 0, | ||
140 | sec); | ||
141 | diff --git a/bfd/libbfd.h b/bfd/libbfd.h | ||
142 | index 44cefbd66d4..a01891f3423 100644 | ||
143 | --- a/bfd/libbfd.h | ||
144 | +++ b/bfd/libbfd.h | ||
145 | @@ -2903,6 +2903,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", | ||
146 | "BFD_RELOC_MICROBLAZE_32_ROSDA", | ||
147 | "BFD_RELOC_MICROBLAZE_32_RWSDA", | ||
148 | "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", | ||
149 | + "BFD_RELOC_MICROBLAZE_32_NONE", | ||
150 | "BFD_RELOC_MICROBLAZE_64_NONE", | ||
151 | "BFD_RELOC_MICROBLAZE_64_GOTPC", | ||
152 | "BFD_RELOC_MICROBLAZE_64_GOT", | ||
153 | diff --git a/bfd/reloc.c b/bfd/reloc.c | ||
154 | index b00b79f3190..78f13180c71 100644 | ||
155 | --- a/bfd/reloc.c | ||
156 | +++ b/bfd/reloc.c | ||
157 | @@ -6806,6 +6806,12 @@ ENUM | ||
158 | ENUMDOC | ||
159 | This is a 32 bit reloc for the microblaze to handle | ||
160 | expressions of the form "Symbol Op Symbol" | ||
161 | +ENUM | ||
162 | + BFD_RELOC_MICROBLAZE_32_NONE | ||
163 | +ENUMDOC | ||
164 | + This is a 32 bit reloc that stores the 32 bit pc relative | ||
165 | + value in two words (with an imm instruction). No relocation is | ||
166 | + done here - only used for relaxing | ||
167 | ENUM | ||
168 | BFD_RELOC_MICROBLAZE_64_NONE | ||
169 | ENUMDOC | ||
170 | diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h | ||
171 | index 830b5ad4461..0dba2c0f44f 100644 | ||
172 | --- a/include/elf/microblaze.h | ||
173 | +++ b/include/elf/microblaze.h | ||
174 | @@ -61,6 +61,7 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type) | ||
175 | RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */ | ||
176 | RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */ | ||
177 | RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */ | ||
178 | + RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33) | ||
179 | END_RELOC_NUMBERS (R_MICROBLAZE_max) | ||
180 | |||
181 | /* Global base address names. */ | ||
182 | -- | ||
183 | 2.17.1 | ||
184 | |||