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

Side by Side Diff: bfd/elfxx-sparc.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/elfxx-mips.c ('k') | bfd/elfxx-target.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 /* SPARC-specific support for ELF 1 /* SPARC-specific support for ELF
2 Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011 2 Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5 This file is part of BFD, the Binary File Descriptor library. 5 This file is part of BFD, the Binary File Descriptor library.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 /* Utility for performing the standard initial work of an instruction 46 /* Utility for performing the standard initial work of an instruction
47 relocation. 47 relocation.
48 *PRELOCATION will contain the relocated item. 48 *PRELOCATION will contain the relocated item.
49 *PINSN will contain the instruction from the input stream. 49 *PINSN will contain the instruction from the input stream.
50 If the result is `bfd_reloc_other' the caller can continue with 50 If the result is `bfd_reloc_other' the caller can continue with
51 performing the relocation. Otherwise it must stop and return the 51 performing the relocation. Otherwise it must stop and return the
52 value to its caller. */ 52 value to its caller. */
53 53
54 static bfd_reloc_status_type 54 static bfd_reloc_status_type
55 init_insn_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, 55 init_insn_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
56 » » PTR data, asection *input_section, bfd *output_bfd, 56 » » void * data, asection *input_section, bfd *output_bfd,
57 bfd_vma *prelocation, bfd_vma *pinsn) 57 bfd_vma *prelocation, bfd_vma *pinsn)
58 { 58 {
59 bfd_vma relocation; 59 bfd_vma relocation;
60 reloc_howto_type *howto = reloc_entry->howto; 60 reloc_howto_type *howto = reloc_entry->howto;
61 61
62 if (output_bfd != (bfd *) NULL 62 if (output_bfd != (bfd *) NULL
63 && (symbol->flags & BSF_SECTION_SYM) == 0 63 && (symbol->flags & BSF_SECTION_SYM) == 0
64 && (! howto->partial_inplace 64 && (! howto->partial_inplace
65 || reloc_entry->addend == 0)) 65 || reloc_entry->addend == 0))
66 { 66 {
(...skipping 23 matching lines...) Expand all
90 *pinsn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); 90 *pinsn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
91 return bfd_reloc_other; 91 return bfd_reloc_other;
92 } 92 }
93 93
94 /* For unsupported relocs. */ 94 /* For unsupported relocs. */
95 95
96 static bfd_reloc_status_type 96 static bfd_reloc_status_type
97 sparc_elf_notsup_reloc (bfd *abfd ATTRIBUTE_UNUSED, 97 sparc_elf_notsup_reloc (bfd *abfd ATTRIBUTE_UNUSED,
98 arelent *reloc_entry ATTRIBUTE_UNUSED, 98 arelent *reloc_entry ATTRIBUTE_UNUSED,
99 asymbol *symbol ATTRIBUTE_UNUSED, 99 asymbol *symbol ATTRIBUTE_UNUSED,
100 » » » PTR data ATTRIBUTE_UNUSED, 100 » » » void * data ATTRIBUTE_UNUSED,
101 asection *input_section ATTRIBUTE_UNUSED, 101 asection *input_section ATTRIBUTE_UNUSED,
102 bfd *output_bfd ATTRIBUTE_UNUSED, 102 bfd *output_bfd ATTRIBUTE_UNUSED,
103 char **error_message ATTRIBUTE_UNUSED) 103 char **error_message ATTRIBUTE_UNUSED)
104 { 104 {
105 return bfd_reloc_notsupported; 105 return bfd_reloc_notsupported;
106 } 106 }
107 107
108 /* Handle the WDISP16 reloc. */ 108 /* Handle the WDISP16 reloc. */
109 109
110 static bfd_reloc_status_type 110 static bfd_reloc_status_type
111 sparc_elf_wdisp16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, 111 sparc_elf_wdisp16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
112 » » » PTR data, asection *input_section, bfd *output_bfd, 112 » » » void * data, asection *input_section, bfd *output_bfd,
113 char **error_message ATTRIBUTE_UNUSED) 113 char **error_message ATTRIBUTE_UNUSED)
114 { 114 {
115 bfd_vma relocation; 115 bfd_vma relocation;
116 bfd_vma insn; 116 bfd_vma insn;
117 bfd_reloc_status_type status; 117 bfd_reloc_status_type status;
118 118
119 status = init_insn_reloc (abfd, reloc_entry, symbol, data, 119 status = init_insn_reloc (abfd, reloc_entry, symbol, data,
120 input_section, output_bfd, &relocation, &insn); 120 input_section, output_bfd, &relocation, &insn);
121 if (status != bfd_reloc_other) 121 if (status != bfd_reloc_other)
122 return status; 122 return status;
123 123
124 insn &= ~ (bfd_vma) 0x303fff; 124 insn &= ~ (bfd_vma) 0x303fff;
125 insn |= (((relocation >> 2) & 0xc000) << 6) | ((relocation >> 2) & 0x3fff); 125 insn |= (((relocation >> 2) & 0xc000) << 6) | ((relocation >> 2) & 0x3fff);
126 bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); 126 bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
127 127
128 if ((bfd_signed_vma) relocation < - 0x40000 128 if ((bfd_signed_vma) relocation < - 0x40000
129 || (bfd_signed_vma) relocation > 0x3ffff) 129 || (bfd_signed_vma) relocation > 0x3ffff)
130 return bfd_reloc_overflow; 130 return bfd_reloc_overflow;
131 else 131 else
132 return bfd_reloc_ok; 132 return bfd_reloc_ok;
133 } 133 }
134 134
135 /* Handle the WDISP10 reloc. */
136
137 static bfd_reloc_status_type
138 sparc_elf_wdisp10_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
139 void * data, asection *input_section, bfd *output_bfd,
140 char **error_message ATTRIBUTE_UNUSED)
141 {
142 bfd_vma relocation;
143 bfd_vma insn;
144 bfd_reloc_status_type status;
145
146 status = init_insn_reloc (abfd, reloc_entry, symbol, data,
147 input_section, output_bfd, &relocation, &insn);
148 if (status != bfd_reloc_other)
149 return status;
150
151 insn &= ~ (bfd_vma) 0x181fe0;
152 insn |= (((relocation >> 2) & 0x300) << 11)
153 | (((relocation >> 2) & 0xff) << 5);
154 bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
155
156 if ((bfd_signed_vma) relocation < - 0x1000
157 || (bfd_signed_vma) relocation > 0xfff)
158 return bfd_reloc_overflow;
159 else
160 return bfd_reloc_ok;
161 }
162
135 /* Handle the HIX22 reloc. */ 163 /* Handle the HIX22 reloc. */
136 164
137 static bfd_reloc_status_type 165 static bfd_reloc_status_type
138 sparc_elf_hix22_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, 166 sparc_elf_hix22_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
139 » » PTR data, asection *input_section, bfd *output_bfd, 167 » » void * data, asection *input_section, bfd *output_bfd,
140 char **error_message ATTRIBUTE_UNUSED) 168 char **error_message ATTRIBUTE_UNUSED)
141 { 169 {
142 bfd_vma relocation; 170 bfd_vma relocation;
143 bfd_vma insn; 171 bfd_vma insn;
144 bfd_reloc_status_type status; 172 bfd_reloc_status_type status;
145 173
146 status = init_insn_reloc (abfd, reloc_entry, symbol, data, 174 status = init_insn_reloc (abfd, reloc_entry, symbol, data,
147 input_section, output_bfd, &relocation, &insn); 175 input_section, output_bfd, &relocation, &insn);
148 if (status != bfd_reloc_other) 176 if (status != bfd_reloc_other)
149 return status; 177 return status;
150 178
151 relocation ^= MINUS_ONE; 179 relocation ^= MINUS_ONE;
152 insn = (insn &~ (bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff); 180 insn = (insn &~ (bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff);
153 bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); 181 bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
154 182
155 if ((relocation & ~ (bfd_vma) 0xffffffff) != 0) 183 if ((relocation & ~ (bfd_vma) 0xffffffff) != 0)
156 return bfd_reloc_overflow; 184 return bfd_reloc_overflow;
157 else 185 else
158 return bfd_reloc_ok; 186 return bfd_reloc_ok;
159 } 187 }
160 188
161 /* Handle the LOX10 reloc. */ 189 /* Handle the LOX10 reloc. */
162 190
163 static bfd_reloc_status_type 191 static bfd_reloc_status_type
164 sparc_elf_lox10_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, 192 sparc_elf_lox10_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
165 » » PTR data, asection *input_section, bfd *output_bfd, 193 » » void * data, asection *input_section, bfd *output_bfd,
166 char **error_message ATTRIBUTE_UNUSED) 194 char **error_message ATTRIBUTE_UNUSED)
167 { 195 {
168 bfd_vma relocation; 196 bfd_vma relocation;
169 bfd_vma insn; 197 bfd_vma insn;
170 bfd_reloc_status_type status; 198 bfd_reloc_status_type status;
171 199
172 status = init_insn_reloc (abfd, reloc_entry, symbol, data, 200 status = init_insn_reloc (abfd, reloc_entry, symbol, data,
173 input_section, output_bfd, &relocation, &insn); 201 input_section, output_bfd, &relocation, &insn);
174 if (status != bfd_reloc_other) 202 if (status != bfd_reloc_other)
175 return status; 203 return status;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 HOWTO(R_SPARC_TLS_DTPMOD64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_gen eric_reloc, "R_SPARC_TLS_DTPMOD64",FALSE,0,0x00000000,TRUE), 288 HOWTO(R_SPARC_TLS_DTPMOD64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_gen eric_reloc, "R_SPARC_TLS_DTPMOD64",FALSE,0,0x00000000,TRUE),
261 HOWTO(R_SPARC_TLS_DTPOFF32,0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_g eneric_reloc,"R_SPARC_TLS_DTPOFF32",FALSE,0,0xffffffff,TRUE), 289 HOWTO(R_SPARC_TLS_DTPOFF32,0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_g eneric_reloc,"R_SPARC_TLS_DTPOFF32",FALSE,0,0xffffffff,TRUE),
262 HOWTO(R_SPARC_TLS_DTPOFF64,0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_g eneric_reloc,"R_SPARC_TLS_DTPOFF64",FALSE,0,MINUS_ONE,TRUE), 290 HOWTO(R_SPARC_TLS_DTPOFF64,0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_g eneric_reloc,"R_SPARC_TLS_DTPOFF64",FALSE,0,MINUS_ONE,TRUE),
263 HOWTO(R_SPARC_TLS_TPOFF32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_gen eric_reloc, "R_SPARC_TLS_TPOFF32",FALSE,0,0x00000000,TRUE), 291 HOWTO(R_SPARC_TLS_TPOFF32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_gen eric_reloc, "R_SPARC_TLS_TPOFF32",FALSE,0,0x00000000,TRUE),
264 HOWTO(R_SPARC_TLS_TPOFF64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_gen eric_reloc, "R_SPARC_TLS_TPOFF64",FALSE,0,0x00000000,TRUE), 292 HOWTO(R_SPARC_TLS_TPOFF64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_gen eric_reloc, "R_SPARC_TLS_TPOFF64",FALSE,0,0x00000000,TRUE),
265 HOWTO(R_SPARC_GOTDATA_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf _hix22_reloc,"R_SPARC_GOTDATA_HIX22",FALSE,0,0x003fffff, FALSE), 293 HOWTO(R_SPARC_GOTDATA_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf _hix22_reloc,"R_SPARC_GOTDATA_HIX22",FALSE,0,0x003fffff, FALSE),
266 HOWTO(R_SPARC_GOTDATA_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_l ox10_reloc, "R_SPARC_GOTDATA_LOX10",FALSE,0,0x000003ff, FALSE), 294 HOWTO(R_SPARC_GOTDATA_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_l ox10_reloc, "R_SPARC_GOTDATA_LOX10",FALSE,0,0x000003ff, FALSE),
267 HOWTO(R_SPARC_GOTDATA_OP_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_ elf_hix22_reloc,"R_SPARC_GOTDATA_OP_HIX22",FALSE,0,0x003fffff, FALSE), 295 HOWTO(R_SPARC_GOTDATA_OP_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_ elf_hix22_reloc,"R_SPARC_GOTDATA_OP_HIX22",FALSE,0,0x003fffff, FALSE),
268 HOWTO(R_SPARC_GOTDATA_OP_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_el f_lox10_reloc, "R_SPARC_GOTDATA_OP_LOX10",FALSE,0,0x000003ff, FALSE), 296 HOWTO(R_SPARC_GOTDATA_OP_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_el f_lox10_reloc, "R_SPARC_GOTDATA_OP_LOX10",FALSE,0,0x000003ff, FALSE),
269 HOWTO(R_SPARC_GOTDATA_OP,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_gene ric_reloc, "R_SPARC_GOTDATA_OP",FALSE,0,0x00000000,TRUE), 297 HOWTO(R_SPARC_GOTDATA_OP,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_gene ric_reloc, "R_SPARC_GOTDATA_OP",FALSE,0,0x00000000,TRUE),
298 HOWTO(R_SPARC_H34,12,2,22,FALSE,0,complain_overflow_unsigned,bfd_elf_generic_r eloc,"R_SPARC_H34",FALSE,0,0x003fffff,FALSE),
299 HOWTO(R_SPARC_SIZE32,0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic _reloc,"R_SPARC_SIZE32",FALSE,0,0xffffffff,TRUE),
300 HOWTO(R_SPARC_SIZE64,0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic _reloc,"R_SPARC_SIZE64",FALSE,0,MINUS_ONE, TRUE),
301 HOWTO(R_SPARC_WDISP10,2,2,10,TRUE, 0,complain_overflow_signed,sparc_elf_wdisp1 0_reloc,"R_SPARC_WDISP10",FALSE,0,0x00000000,TRUE),
270 }; 302 };
271 static reloc_howto_type sparc_jmp_irel_howto = 303 static reloc_howto_type sparc_jmp_irel_howto =
272 HOWTO(R_SPARC_JMP_IREL, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_gen eric_reloc, "R_SPARC_JMP_IREL",FALSE,0,0x00000000,TRUE); 304 HOWTO(R_SPARC_JMP_IREL, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_gen eric_reloc, "R_SPARC_JMP_IREL",FALSE,0,0x00000000,TRUE);
273 static reloc_howto_type sparc_irelative_howto = 305 static reloc_howto_type sparc_irelative_howto =
274 HOWTO(R_SPARC_IRELATIVE, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_ge neric_reloc, "R_SPARC_IRELATIVE",FALSE,0,0x00000000,TRUE); 306 HOWTO(R_SPARC_IRELATIVE, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_ge neric_reloc, "R_SPARC_IRELATIVE",FALSE,0,0x00000000,TRUE);
275 static reloc_howto_type sparc_vtinherit_howto = 307 static reloc_howto_type sparc_vtinherit_howto =
276 HOWTO (R_SPARC_GNU_VTINHERIT, 0,2,0,FALSE,0,complain_overflow_dont, NULL, "R_S PARC_GNU_VTINHERIT", FALSE,0, 0, FALSE); 308 HOWTO (R_SPARC_GNU_VTINHERIT, 0,2,0,FALSE,0,complain_overflow_dont, NULL, "R_S PARC_GNU_VTINHERIT", FALSE,0, 0, FALSE);
277 static reloc_howto_type sparc_vtentry_howto = 309 static reloc_howto_type sparc_vtentry_howto =
278 HOWTO (R_SPARC_GNU_VTENTRY, 0,2,0,FALSE,0,complain_overflow_dont, _bfd_elf_rel _vtable_reloc_fn,"R_SPARC_GNU_VTENTRY", FALSE,0,0, FALSE); 310 HOWTO (R_SPARC_GNU_VTENTRY, 0,2,0,FALSE,0,complain_overflow_dont, _bfd_elf_rel _vtable_reloc_fn,"R_SPARC_GNU_VTENTRY", FALSE,0,0, FALSE);
279 static reloc_howto_type sparc_rev32_howto = 311 static reloc_howto_type sparc_rev32_howto =
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 549
518 case BFD_RELOC_SPARC_GOTDATA_OP_HIX22: 550 case BFD_RELOC_SPARC_GOTDATA_OP_HIX22:
519 return &_bfd_sparc_elf_howto_table[R_SPARC_GOTDATA_OP_HIX22]; 551 return &_bfd_sparc_elf_howto_table[R_SPARC_GOTDATA_OP_HIX22];
520 552
521 case BFD_RELOC_SPARC_GOTDATA_OP_LOX10: 553 case BFD_RELOC_SPARC_GOTDATA_OP_LOX10:
522 return &_bfd_sparc_elf_howto_table[R_SPARC_GOTDATA_OP_LOX10]; 554 return &_bfd_sparc_elf_howto_table[R_SPARC_GOTDATA_OP_LOX10];
523 555
524 case BFD_RELOC_SPARC_GOTDATA_OP: 556 case BFD_RELOC_SPARC_GOTDATA_OP:
525 return &_bfd_sparc_elf_howto_table[R_SPARC_GOTDATA_OP]; 557 return &_bfd_sparc_elf_howto_table[R_SPARC_GOTDATA_OP];
526 558
559 case BFD_RELOC_SPARC_H34:
560 return &_bfd_sparc_elf_howto_table[R_SPARC_H34];
561
562 case BFD_RELOC_SPARC_SIZE32:
563 return &_bfd_sparc_elf_howto_table[R_SPARC_SIZE32];
564
565 case BFD_RELOC_SPARC_SIZE64:
566 return &_bfd_sparc_elf_howto_table[R_SPARC_SIZE64];
567
568 case BFD_RELOC_SPARC_WDISP10:
569 return &_bfd_sparc_elf_howto_table[R_SPARC_WDISP10];
570
527 case BFD_RELOC_SPARC_JMP_IREL: 571 case BFD_RELOC_SPARC_JMP_IREL:
528 return &sparc_jmp_irel_howto; 572 return &sparc_jmp_irel_howto;
529 573
530 case BFD_RELOC_SPARC_IRELATIVE: 574 case BFD_RELOC_SPARC_IRELATIVE:
531 return &sparc_irelative_howto; 575 return &sparc_irelative_howto;
532 576
533 case BFD_RELOC_VTABLE_INHERIT: 577 case BFD_RELOC_VTABLE_INHERIT:
534 return &sparc_vtinherit_howto; 578 return &sparc_vtinherit_howto;
535 579
536 case BFD_RELOC_VTABLE_ENTRY: 580 case BFD_RELOC_VTABLE_ENTRY:
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 hash table. */ 1197 hash table. */
1154 1198
1155 bfd_boolean 1199 bfd_boolean
1156 _bfd_sparc_elf_create_dynamic_sections (bfd *dynobj, 1200 _bfd_sparc_elf_create_dynamic_sections (bfd *dynobj,
1157 struct bfd_link_info *info) 1201 struct bfd_link_info *info)
1158 { 1202 {
1159 struct _bfd_sparc_elf_link_hash_table *htab; 1203 struct _bfd_sparc_elf_link_hash_table *htab;
1160 1204
1161 htab = _bfd_sparc_elf_hash_table (info); 1205 htab = _bfd_sparc_elf_hash_table (info);
1162 BFD_ASSERT (htab != NULL); 1206 BFD_ASSERT (htab != NULL);

error: old chunk mismatch

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

Powered by Google App Engine
This is Rietveld 408576698