Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: bfd/elf64-mmix.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bfd/elf64-mips.c ('k') | bfd/elf64-ppc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
None
OLDNEW
1 /* MMIX-specific support for 64-bit ELF. 1 /* MMIX-specific support for 64-bit ELF.
2 Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 2 Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011,
3 2012
3 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
4 Contributed by Hans-Peter Nilsson <hp@bitrange.com> 5 Contributed by Hans-Peter Nilsson <hp@bitrange.com>
5 6
6 This file is part of BFD, the Binary File Descriptor library. 7 This file is part of BFD, the Binary File Descriptor library.
7 8
8 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or 11 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version. 12 (at your option) any later version.
12 13
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 160
160 /* Index into reloc_request[], sorted on increasing "value", secondary 161 /* Index into reloc_request[], sorted on increasing "value", secondary
161 by increasing index for strict sorting order. */ 162 by increasing index for strict sorting order. */
162 size_t *bpo_reloc_indexes; 163 size_t *bpo_reloc_indexes;
163 164
164 /* An array of all relocations, with the "value" member filled in by 165 /* An array of all relocations, with the "value" member filled in by
165 the relaxation function. */ 166 the relaxation function. */
166 struct bpo_reloc_request *reloc_request; 167 struct bpo_reloc_request *reloc_request;
167 }; 168 };
168 169
169 static int mmix_elf_link_output_symbol_hook
170 PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *,
171 asection *, struct elf_link_hash_entry *));
172 170
173 static bfd_reloc_status_type mmix_elf_reloc 171 extern bfd_boolean mmix_elf_final_link (bfd *, struct bfd_link_info *);
174 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
175 172
176 static reloc_howto_type *bfd_elf64_bfd_reloc_type_lookup 173 extern void mmix_elf_symbol_processing (bfd *, asymbol *);
177 PARAMS ((bfd *, bfd_reloc_code_real_type));
178
179 static void mmix_info_to_howto_rela
180 PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
181
182 static int mmix_elf_sort_relocs PARAMS ((const PTR, const PTR));
183
184 static bfd_boolean mmix_elf_new_section_hook
185 PARAMS ((bfd *, asection *));
186
187 static bfd_boolean mmix_elf_check_relocs
188 PARAMS ((bfd *, struct bfd_link_info *, asection *,
189 » const Elf_Internal_Rela *));
190
191 static bfd_boolean mmix_elf_check_common_relocs
192 PARAMS ((bfd *, struct bfd_link_info *, asection *,
193 » const Elf_Internal_Rela *));
194
195 static bfd_boolean mmix_elf_relocate_section
196 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
197 » Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
198
199 static bfd_reloc_status_type mmix_final_link_relocate
200 (reloc_howto_type *, asection *, bfd_byte *, bfd_vma, bfd_signed_vma,
201 bfd_vma, const char *, asection *, char **);
202
203 static bfd_reloc_status_type mmix_elf_perform_relocation
204 (asection *, reloc_howto_type *, void *, bfd_vma, bfd_vma, char **);
205
206 static bfd_boolean mmix_elf_section_from_bfd_section
207 PARAMS ((bfd *, asection *, int *));
208
209 static bfd_boolean mmix_elf_add_symbol_hook
210 PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *,
211 » const char **, flagword *, asection **, bfd_vma *));
212
213 static bfd_boolean mmix_elf_is_local_label_name
214 PARAMS ((bfd *, const char *));
215
216 static int bpo_reloc_request_sort_fn PARAMS ((const PTR, const PTR));
217
218 static bfd_boolean mmix_elf_relax_section
219 PARAMS ((bfd *abfd, asection *sec, struct bfd_link_info *link_info,
220 » bfd_boolean *again));
221
222 extern bfd_boolean mmix_elf_final_link PARAMS ((bfd *, struct bfd_link_info *));
223
224 extern void mmix_elf_symbol_processing PARAMS ((bfd *, asymbol *));
225 174
226 /* Only intended to be called from a debugger. */ 175 /* Only intended to be called from a debugger. */
227 extern void mmix_dump_bpo_gregs 176 extern void mmix_dump_bpo_gregs
228 PARAMS ((struct bfd_link_info *, bfd_error_handler_type)); 177 (struct bfd_link_info *, bfd_error_handler_type);
229 178
230 static void 179 static void
231 mmix_set_relaxable_size 180 mmix_set_relaxable_size (bfd *, asection *, void *);
232 PARAMS ((bfd *, asection *, void *)); 181 static bfd_reloc_status_type
182 mmix_elf_reloc (bfd *, arelent *, asymbol *, void *,
183 » » asection *, bfd *, char **);
184 static bfd_reloc_status_type
185 mmix_final_link_relocate (reloc_howto_type *, asection *, bfd_byte *, bfd_vma,
186 » » » bfd_signed_vma, bfd_vma, const char *, asection *,
187 » » » char **);
233 188
234 189
235 /* Watch out: this currently needs to have elements with the same index as 190 /* Watch out: this currently needs to have elements with the same index as
236 their R_MMIX_ number. */ 191 their R_MMIX_ number. */
237 static reloc_howto_type elf_mmix_howto_table[] = 192 static reloc_howto_type elf_mmix_howto_table[] =
238 { 193 {
239 /* This reloc does nothing. */ 194 /* This reloc does nothing. */
240 HOWTO (R_MMIX_NONE, /* type */ 195 HOWTO (R_MMIX_NONE, /* type */
241 0, /* rightshift */ 196 0, /* rightshift */
242 2, /* size (0 = byte, 1 = short, 2 = long) */ 197 2, /* size (0 = byte, 1 = short, 2 = long) */
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 {BFD_RELOC_MMIX_ADDR19, R_MMIX_ADDR19}, 788 {BFD_RELOC_MMIX_ADDR19, R_MMIX_ADDR19},
834 {BFD_RELOC_MMIX_ADDR27, R_MMIX_ADDR27}, 789 {BFD_RELOC_MMIX_ADDR27, R_MMIX_ADDR27},
835 {BFD_RELOC_MMIX_REG_OR_BYTE, R_MMIX_REG_OR_BYTE}, 790 {BFD_RELOC_MMIX_REG_OR_BYTE, R_MMIX_REG_OR_BYTE},
836 {BFD_RELOC_MMIX_REG, R_MMIX_REG}, 791 {BFD_RELOC_MMIX_REG, R_MMIX_REG},
837 {BFD_RELOC_MMIX_BASE_PLUS_OFFSET, R_MMIX_BASE_PLUS_OFFSET}, 792 {BFD_RELOC_MMIX_BASE_PLUS_OFFSET, R_MMIX_BASE_PLUS_OFFSET},
838 {BFD_RELOC_MMIX_LOCAL, R_MMIX_LOCAL}, 793 {BFD_RELOC_MMIX_LOCAL, R_MMIX_LOCAL},
839 {BFD_RELOC_MMIX_PUSHJ_STUBBABLE, R_MMIX_PUSHJ_STUBBABLE} 794 {BFD_RELOC_MMIX_PUSHJ_STUBBABLE, R_MMIX_PUSHJ_STUBBABLE}
840 }; 795 };
841 796
842 static reloc_howto_type * 797 static reloc_howto_type *
843 bfd_elf64_bfd_reloc_type_lookup (abfd, code) 798 bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
844 bfd *abfd ATTRIBUTE_UNUSED; 799 » » » » bfd_reloc_code_real_type code)
845 bfd_reloc_code_real_type code;
846 { 800 {
847 unsigned int i; 801 unsigned int i;
848 802
849 for (i = 0; 803 for (i = 0;
850 i < sizeof (mmix_reloc_map) / sizeof (mmix_reloc_map[0]); 804 i < sizeof (mmix_reloc_map) / sizeof (mmix_reloc_map[0]);
851 i++) 805 i++)
852 { 806 {
853 if (mmix_reloc_map[i].bfd_reloc_val == code) 807 if (mmix_reloc_map[i].bfd_reloc_val == code)
854 return &elf_mmix_howto_table[mmix_reloc_map[i].elf_reloc_val]; 808 return &elf_mmix_howto_table[mmix_reloc_map[i].elf_reloc_val];
855 } 809 }
(...skipping 11 matching lines...) Expand all
867 i < sizeof (elf_mmix_howto_table) / sizeof (elf_mmix_howto_table[0]); 821 i < sizeof (elf_mmix_howto_table) / sizeof (elf_mmix_howto_table[0]);
868 i++) 822 i++)
869 if (elf_mmix_howto_table[i].name != NULL 823 if (elf_mmix_howto_table[i].name != NULL
870 && strcasecmp (elf_mmix_howto_table[i].name, r_name) == 0) 824 && strcasecmp (elf_mmix_howto_table[i].name, r_name) == 0)
871 return &elf_mmix_howto_table[i]; 825 return &elf_mmix_howto_table[i];
872 826
873 return NULL; 827 return NULL;
874 } 828 }
875 829
876 static bfd_boolean 830 static bfd_boolean
877 mmix_elf_new_section_hook (abfd, sec) 831 mmix_elf_new_section_hook (bfd *abfd, asection *sec)
878 bfd *abfd;
879 asection *sec;
880 { 832 {
881 if (!sec->used_by_bfd) 833 if (!sec->used_by_bfd)
882 { 834 {
883 struct _mmix_elf_section_data *sdata; 835 struct _mmix_elf_section_data *sdata;
884 bfd_size_type amt = sizeof (*sdata); 836 bfd_size_type amt = sizeof (*sdata);
885 837
886 sdata = bfd_zalloc (abfd, amt); 838 sdata = bfd_zalloc (abfd, amt);
887 if (sdata == NULL) 839 if (sdata == NULL)
888 return FALSE; 840 return FALSE;
889 sec->used_by_bfd = sdata; 841 sec->used_by_bfd = sdata;
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 bfd_put_32 (abfd, 1247 bfd_put_32 (abfd,
1296 (INCH_INSN_BYTE << 24) | ((value >> 48) & 0xffff) | (reg << 16), 1248 (INCH_INSN_BYTE << 24) | ((value >> 48) & 0xffff) | (reg << 16),
1297 (bfd_byte *) datap + offs + 12); 1249 (bfd_byte *) datap + offs + 12);
1298 1250
1299 return flag; 1251 return flag;
1300 } 1252 }
1301 1253
1302 /* Set the howto pointer for an MMIX ELF reloc (type RELA). */ 1254 /* Set the howto pointer for an MMIX ELF reloc (type RELA). */
1303 1255
1304 static void 1256 static void
1305 mmix_info_to_howto_rela (abfd, cache_ptr, dst) 1257 mmix_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
1306 bfd *abfd ATTRIBUTE_UNUSED; 1258 » » » arelent *cache_ptr,
1307 arelent *cache_ptr; 1259 » » » Elf_Internal_Rela *dst)
1308 Elf_Internal_Rela *dst;
1309 { 1260 {
1310 unsigned int r_type; 1261 unsigned int r_type;
1311 1262
1312 r_type = ELF64_R_TYPE (dst->r_info); 1263 r_type = ELF64_R_TYPE (dst->r_info);
1313 BFD_ASSERT (r_type < (unsigned int) R_MMIX_max); 1264 BFD_ASSERT (r_type < (unsigned int) R_MMIX_max);
1314 cache_ptr->howto = &elf_mmix_howto_table[r_type]; 1265 cache_ptr->howto = &elf_mmix_howto_table[r_type];
1315 } 1266 }
1316 1267
1317 /* Any MMIX-specific relocation gets here at assembly time or when linking 1268 /* Any MMIX-specific relocation gets here at assembly time or when linking
1318 to other formats (such as mmo); this is the relocation function from 1269 to other formats (such as mmo); this is the relocation function from
1319 the reloc_table. We don't get here for final pure ELF linking. */ 1270 the reloc_table. We don't get here for final pure ELF linking. */
1320 1271
1321 static bfd_reloc_status_type 1272 static bfd_reloc_status_type
1322 mmix_elf_reloc (abfd, reloc_entry, symbol, data, input_section, 1273 mmix_elf_reloc (bfd *abfd,
1323 » » output_bfd, error_message) 1274 » » arelent *reloc_entry,
1324 bfd *abfd; 1275 » » asymbol *symbol,
1325 arelent *reloc_entry; 1276 » » void * data,
1326 asymbol *symbol; 1277 » » asection *input_section,
1327 PTR data; 1278 » » bfd *output_bfd,
1328 asection *input_section; 1279 » » char **error_message)
1329 bfd *output_bfd;
1330 char **error_message;
1331 { 1280 {
1332 bfd_vma relocation; 1281 bfd_vma relocation;
1333 bfd_reloc_status_type r; 1282 bfd_reloc_status_type r;
1334 asection *reloc_target_output_section; 1283 asection *reloc_target_output_section;
1335 bfd_reloc_status_type flag = bfd_reloc_ok; 1284 bfd_reloc_status_type flag = bfd_reloc_ok;
1336 bfd_vma output_base = 0; 1285 bfd_vma output_base = 0;
1337 1286
1338 r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, 1287 r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
1339 input_section, output_bfd, error_message); 1288 input_section, output_bfd, error_message);
1340 1289
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 1336
1388 return mmix_final_link_relocate (reloc_entry->howto, input_section, 1337 return mmix_final_link_relocate (reloc_entry->howto, input_section,
1389 data, reloc_entry->address, 1338 data, reloc_entry->address,
1390 reloc_entry->addend, relocation, 1339 reloc_entry->addend, relocation,
1391 bfd_asymbol_name (symbol), 1340 bfd_asymbol_name (symbol),
1392 reloc_target_output_section, 1341 reloc_target_output_section,
1393 error_message); 1342 error_message);
1394 } 1343 }
1395 1344
1396 1345

error: old chunk mismatch

OLDNEW
« no previous file with comments | « bfd/elf64-mips.c ('k') | bfd/elf64-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698