diff options
author | Alan Modra <amodra@bigpond.net.au> | 2001-09-18 09:57:26 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2001-09-18 09:57:26 +0000 |
commit | 439c22790eb92fc38c0c4e91bc343ef8d0e55427 (patch) | |
tree | eb49f3489bb7e104ca1c425d07d5d954ab03148f /bfd/syms.c | |
parent | 8ff532ca9bf72656df68051c20729d9fdec919b9 (diff) | |
download | gdb-439c22790eb92fc38c0c4e91bc343ef8d0e55427.tar.gz |
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
Diffstat (limited to 'bfd/syms.c')
-rw-r--r-- | bfd/syms.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/bfd/syms.c b/bfd/syms.c index 5d885a467ae..9c8922b3cfd 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -197,7 +197,7 @@ CODE_FRAGMENT . . {* The text of the symbol. The name is left alone, and not copied; the . application may not alter it. *} -. CONST char *name; +. const char *name; . . {* The value of the symbol. This really should be a union of a . numeric value with a pointer, since some flags indicate that @@ -508,14 +508,14 @@ DESCRIPTION struct section_to_type { - CONST char *section; + const char *section; char type; }; /* Map section names to POSIX/BSD single-character symbol types. This table is probably incomplete. It is sorted for convenience of adding entries. Since it is so short, a linear search is used. */ -static CONST struct section_to_type stt[] = +static const struct section_to_type stt[] = { {"*DEBUG*", 'N'}, {".bss", 'b'}, @@ -547,7 +547,7 @@ static char coff_section_type (s) const char *s; { - CONST struct section_to_type *t; + const struct section_to_type *t; for (t = &stt[0]; t->section; t++) if (!strncmp (s, t->section, strlen (t->section))) @@ -722,7 +722,7 @@ _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep) if (storage < 0) goto error_return; - syms = (asymbol **) bfd_malloc ((size_t) storage); + syms = (asymbol **) bfd_malloc ((bfd_size_type) storage); if (syms == NULL) goto error_return; @@ -852,7 +852,8 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, bfd_byte *last_stab = NULL; bfd_size_type stroff; struct indexentry *indexentry; - char *directory_name, *file_name; + char *file_name; + char *directory_name; int saw_fun; *pfound = false; @@ -898,11 +899,10 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, arelent **reloc_vector; int i; char *name; - char *file_name; - char *directory_name; char *function_name; + bfd_size_type amt = sizeof *info; - info = (struct stab_find_info *) bfd_zalloc (abfd, sizeof *info); + info = (struct stab_find_info *) bfd_zalloc (abfd, amt); if (info == NULL) return false; @@ -929,10 +929,10 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, if (info->stabs == NULL || info->strs == NULL) return false; - if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs, 0, - stabsize) - || ! bfd_get_section_contents (abfd, info->strsec, info->strs, 0, - strsize)) + if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs, + (bfd_vma) 0, stabsize) + || ! bfd_get_section_contents (abfd, info->strsec, info->strs, + (bfd_vma) 0, strsize)) return false; /* If this is a relocateable object file, we have to relocate @@ -942,7 +942,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, reloc_size = bfd_get_reloc_upper_bound (abfd, info->stabsec); if (reloc_size < 0) return false; - reloc_vector = (arelent **) bfd_malloc (reloc_size); + reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); if (reloc_vector == NULL && reloc_size != 0) return false; reloc_count = bfd_canonicalize_reloc (abfd, info->stabsec, reloc_vector, @@ -983,7 +983,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, val &= r->howto->src_mask; sym = *r->sym_ptr_ptr; val += sym->value + sym->section->vma + r->addend; - bfd_put_32 (abfd, val, info->stabs + r->address); + bfd_put_32 (abfd, (bfd_vma) val, info->stabs + r->address); } } @@ -1033,10 +1033,9 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, return true; ++info->indextablesize; - info->indextable = ((struct indexentry *) - bfd_alloc (abfd, - (sizeof (struct indexentry) - * info->indextablesize))); + amt = info->indextablesize; + amt *= sizeof (struct indexentry); + info->indextable = (struct indexentry *) bfd_alloc (abfd, amt); if (info->indextable == NULL) return false; @@ -1154,7 +1153,8 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, ++i; info->indextablesize = i; - qsort (info->indextable, i, sizeof (struct indexentry), cmpindexentry); + qsort (info->indextable, (size_t) i, sizeof (struct indexentry), + cmpindexentry); *pinfo = (PTR) info; } @@ -1276,9 +1276,8 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, { if (info->filename != NULL) free (info->filename); - info->filename = (char *) bfd_malloc (dirlen + - strlen (file_name) - + 1); + info->filename = (char *) bfd_malloc ((bfd_size_type) dirlen + + strlen (file_name) + 1); if (info->filename == NULL) return false; strcpy (info->filename, directory_name); |