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

Side by Side Diff: bfd/archive64.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 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/archive.c ('k') | bfd/archures.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* MIPS-specific support for 64-bit ELF 1 /* Support for 64-bit ELF archives.
2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2 Copyright 1996-2013 Free Software Foundation, Inc.
3 2010, 2012 Free Software Foundation, Inc.
4 Ian Lance Taylor, Cygnus Support 3 Ian Lance Taylor, Cygnus Support
5 Linker support added by Mark Mitchell, CodeSourcery, LLC. 4 Linker support added by Mark Mitchell, CodeSourcery, LLC.
6 <mark@codesourcery.com> 5 <mark@codesourcery.com>
7 6
8 This file is part of BFD, the Binary File Descriptor library. 7 This file is part of BFD, the Binary File Descriptor library.
9 8
10 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
11 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
12 the Free Software Foundation; either version 3 of the License, or 11 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version. 12 (at your option) any later version.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (! CONST_STRNEQ (nextname, "/SYM64/ ")) 69 if (! CONST_STRNEQ (nextname, "/SYM64/ "))
71 { 70 {
72 bfd_has_map (abfd) = FALSE; 71 bfd_has_map (abfd) = FALSE;
73 return TRUE; 72 return TRUE;
74 } 73 }
75 74
76 mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); 75 mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
77 if (mapdata == NULL) 76 if (mapdata == NULL)
78 return FALSE; 77 return FALSE;
79 parsed_size = mapdata->parsed_size; 78 parsed_size = mapdata->parsed_size;
80 bfd_release (abfd, mapdata); 79 free (mapdata);
81 80
82 if (bfd_bread (int_buf, 8, abfd) != 8) 81 if (bfd_bread (int_buf, 8, abfd) != 8)
83 { 82 {
84 if (bfd_get_error () != bfd_error_system_call) 83 if (bfd_get_error () != bfd_error_system_call)
85 bfd_set_error (bfd_error_malformed_archive); 84 bfd_set_error (bfd_error_malformed_archive);
86 return FALSE; 85 return FALSE;
87 } 86 }
88 87
89 nsymz = bfd_getb64 (int_buf); 88 nsymz = bfd_getb64 (int_buf);
90 stringsize = parsed_size - 8 * nsymz - 8; 89 stringsize = parsed_size - 8 * nsymz - 8;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 remembering that each offset is on a two byte boundary. */ 192 remembering that each offset is on a two byte boundary. */
194 193
195 /* Write out the file offset for the file associated with each 194 /* Write out the file offset for the file associated with each
196 symbol, and remember to keep the offsets padded out. */ 195 symbol, and remember to keep the offsets padded out. */
197 count = 0; 196 count = 0;
198 for (current = arch->archive_head; 197 for (current = arch->archive_head;
199 current != NULL && count < symbol_count; 198 current != NULL && count < symbol_count;
200 current = current->archive_next) 199 current = current->archive_next)
201 { 200 {
202 /* For each symbol which is used defined in this object, write out 201 /* For each symbol which is used defined in this object, write out
203 » the object file's address in the archive */ 202 » the object file's address in the archive. */
204 203
205 for (; 204 for (;
206 count < symbol_count && map[count].u.abfd == current; 205 count < symbol_count && map[count].u.abfd == current;
207 count++) 206 count++)
208 { 207 {
209 bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf); 208 bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf);
210 if (bfd_bwrite (buf, 8, arch) != 8) 209 if (bfd_bwrite (buf, 8, arch) != 8)
211 return FALSE; 210 return FALSE;
212 } 211 }
212
213 /* Add size of this archive entry */ 213 /* Add size of this archive entry */
214 archive_member_file_ptr += (arelt_size (current) 214 archive_member_file_ptr += sizeof (struct ar_hdr);
215 » » » » + sizeof (struct ar_hdr)); 215 if (! bfd_is_thin_archive (arch))
216 » archive_member_file_ptr += arelt_size (current);
216 /* remember about the even alignment */ 217 /* remember about the even alignment */
217 archive_member_file_ptr += archive_member_file_ptr % 2; 218 archive_member_file_ptr += archive_member_file_ptr % 2;
218 } 219 }
219 220
220 /* now write the strings themselves */ 221 /* now write the strings themselves */
221 for (count = 0; count < symbol_count; count++) 222 for (count = 0; count < symbol_count; count++)
222 { 223 {
223 size_t len = strlen (*map[count].name) + 1; 224 size_t len = strlen (*map[count].name) + 1;
224 225
225 if (bfd_bwrite (*map[count].name, len, arch) != len) 226 if (bfd_bwrite (*map[count].name, len, arch) != len)
226 return FALSE; 227 return FALSE;
227 } 228 }
228 229
229 /* The spec says that this should be padded to an 8 byte boundary. 230 /* The spec says that this should be padded to an 8 byte boundary.
230 However, the Irix 6.2 tools do not appear to do this. */ 231 However, the Irix 6.2 tools do not appear to do this. */
231 while (padding != 0) 232 while (padding != 0)
232 { 233 {
233 if (bfd_bwrite ("", 1, arch) != 1) 234 if (bfd_bwrite ("", 1, arch) != 1)
234 return FALSE; 235 return FALSE;
235 --padding; 236 --padding;
236 } 237 }
237 238
238 return TRUE; 239 return TRUE;
239 } 240 }
OLDNEW
« no previous file with comments | « bfd/archive.c ('k') | bfd/archures.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698