diff options
author | Alan Modra <amodra@gmail.com> | 2002-11-30 08:39:46 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2002-11-30 08:39:46 +0000 |
commit | b34976b65aea8f33690229600bbf4527ec3118e1 (patch) | |
tree | 6411348664ef81ca2aa2e3ff325116e6e6502edf /bfd/oasys.c | |
parent | 583d52d728c60410c0d39bae68ee536a7b9e7a6c (diff) | |
download | fsf-binutils-gdb-b34976b65aea8f33690229600bbf4527ec3118e1.zip fsf-binutils-gdb-b34976b65aea8f33690229600bbf4527ec3118e1.tar.gz fsf-binutils-gdb-b34976b65aea8f33690229600bbf4527ec3118e1.tar.bz2 |
s/boolean/bfd_boolean/ s/true/TRUE/ s/false/FALSE/. Simplify
comparisons of bfd_boolean vars with TRUE/FALSE. Formatting.
Diffstat (limited to 'bfd/oasys.c')
-rw-r--r-- | bfd/oasys.c | 237 |
1 files changed, 130 insertions, 107 deletions
diff --git a/bfd/oasys.c b/bfd/oasys.c index 9035a4f..494e155 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -27,62 +27,85 @@ #include "oasys.h" #include "liboasys.h" -static boolean oasys_slurp_section_data PARAMS ((bfd * const)); -static boolean oasys_read_record PARAMS ((bfd *, oasys_record_union_type *)); -static boolean oasys_write_sections PARAMS ((bfd *)); -static boolean oasys_write_record +static bfd_boolean oasys_slurp_section_data + PARAMS ((bfd * const)); +static bfd_boolean oasys_read_record + PARAMS ((bfd *, oasys_record_union_type *)); +static bfd_boolean oasys_write_sections + PARAMS ((bfd *)); +static bfd_boolean oasys_write_record PARAMS ((bfd *, oasys_record_enum_type, oasys_record_union_type *, size_t)); -static boolean oasys_write_syms PARAMS ((bfd *)); -static boolean oasys_write_header PARAMS ((bfd *)); -static boolean oasys_write_end PARAMS ((bfd *)); -static boolean oasys_write_data PARAMS ((bfd *)); -static size_t oasys_string_length PARAMS ((oasys_record_union_type *)); -static boolean oasys_slurp_symbol_table PARAMS ((bfd *const)); -static long int oasys_get_symtab_upper_bound PARAMS ((bfd *const)); -static const bfd_target *oasys_archive_p PARAMS ((bfd *)); -static boolean oasys_mkobject PARAMS ((bfd *)); -static const bfd_target *oasys_object_p PARAMS ((bfd *)); -static void oasys_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); +static bfd_boolean oasys_write_syms + PARAMS ((bfd *)); +static bfd_boolean oasys_write_header + PARAMS ((bfd *)); +static bfd_boolean oasys_write_end + PARAMS ((bfd *)); +static bfd_boolean oasys_write_data + PARAMS ((bfd *)); +static size_t oasys_string_length + PARAMS ((oasys_record_union_type *)); +static bfd_boolean oasys_slurp_symbol_table + PARAMS ((bfd *const)); +static long int oasys_get_symtab_upper_bound + PARAMS ((bfd *const)); +static const bfd_target *oasys_archive_p + PARAMS ((bfd *)); +static bfd_boolean oasys_mkobject + PARAMS ((bfd *)); +static const bfd_target *oasys_object_p + PARAMS ((bfd *)); +static void oasys_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *)); static void oasys_print_symbol PARAMS ((bfd *, void *, asymbol *, bfd_print_symbol_type)); -static boolean oasys_new_section_hook PARAMS ((bfd *, asection *)); -static long int oasys_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); -static boolean oasys_get_section_contents +static bfd_boolean oasys_new_section_hook + PARAMS ((bfd *, asection *)); +static long int oasys_get_reloc_upper_bound + PARAMS ((bfd *, sec_ptr)); +static bfd_boolean oasys_get_section_contents PARAMS ((bfd *, sec_ptr, void *, file_ptr, bfd_size_type)); -static int comp PARAMS ((const void *, const void *)); -static boolean oasys_write_object_contents PARAMS ((bfd *)); -static boolean oasys_set_section_contents +static int comp + PARAMS ((const void *, const void *)); +static bfd_boolean oasys_write_object_contents + PARAMS ((bfd *)); +static bfd_boolean oasys_set_section_contents PARAMS ((bfd *, sec_ptr, void *, file_ptr, bfd_size_type)); -static asymbol *oasys_make_empty_symbol PARAMS ((bfd *)); -static bfd *oasys_openr_next_archived_file PARAMS ((bfd *, bfd *)); -static boolean oasys_find_nearest_line +static asymbol *oasys_make_empty_symbol + PARAMS ((bfd *)); +static bfd *oasys_openr_next_archived_file + PARAMS ((bfd *, bfd *)); +static bfd_boolean oasys_find_nearest_line PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *)); -static int oasys_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); -static int oasys_sizeof_headers PARAMS ((bfd *, boolean)); +static int oasys_generic_stat_arch_elt + PARAMS ((bfd *, struct stat *)); +static int oasys_sizeof_headers + PARAMS ((bfd *, bfd_boolean)); -long oasys_get_symtab PARAMS ((bfd *, asymbol **)); +long oasys_get_symtab + PARAMS ((bfd *, asymbol **)); long oasys_canonicalize_reloc PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); /* Read in all the section data and relocation stuff too. */ -static boolean +static bfd_boolean oasys_read_record (abfd, record) bfd *abfd; oasys_record_union_type *record; { bfd_size_type amt = sizeof (record->header); if (bfd_bread ((PTR) record, amt, abfd) != amt) - return false; + return FALSE; amt = record->header.length - sizeof (record->header); if ((long) amt <= 0) - return true; + return TRUE; if (bfd_bread ((PTR) ((char *) record + sizeof (record->header)), amt, abfd) != amt) - return false; - return true; + return FALSE; + return TRUE; } static size_t @@ -109,13 +132,13 @@ moving in, and the defined symbols at the end of the table moving back. */ -static boolean +static bfd_boolean oasys_slurp_symbol_table (abfd) bfd *const abfd; { oasys_record_union_type record; oasys_data_type *data = OASYS_DATA (abfd); - boolean loop = true; + bfd_boolean loop = TRUE; asymbol *dest_defined; asymbol *dest; char *string_ptr; @@ -123,7 +146,7 @@ oasys_slurp_symbol_table (abfd) if (data->symbols != (asymbol *) NULL) { - return true; + return TRUE; } /* Buy enough memory for all the symbols and all the names */ amt = abfd->symcount; @@ -138,18 +161,18 @@ oasys_slurp_symbol_table (abfd) data->strings = bfd_alloc (abfd, amt); if (!data->symbols || !data->strings) - return false; + return FALSE; dest_defined = data->symbols + abfd->symcount - 1; string_ptr = data->strings; if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - return false; + return FALSE; while (loop) { if (! oasys_read_record (abfd, &record)) - return false; + return FALSE; switch (record.header.type) { case oasys_record_is_header_enum: @@ -229,10 +252,10 @@ oasys_slurp_symbol_table (abfd) } break; default: - loop = false; + loop = FALSE; } } - return true; + return TRUE; } static long @@ -405,7 +428,7 @@ oasys_archive_p (abfd) return abfd->xvec; } -static boolean +static bfd_boolean oasys_mkobject (abfd) bfd *abfd; { @@ -421,8 +444,8 @@ oasys_object_p (abfd) { oasys_data_type *oasys; oasys_data_type *save = OASYS_DATA (abfd); - boolean loop = true; - boolean had_usefull = false; + bfd_boolean loop = TRUE; + bfd_boolean had_usefull = FALSE; abfd->tdata.oasys_obj_data = 0; oasys_mkobject (abfd); @@ -449,14 +472,14 @@ oasys_object_p (abfd) switch ((oasys_record_enum_type) (record.header.type)) { case oasys_record_is_header_enum: - had_usefull = true; + had_usefull = TRUE; break; case oasys_record_is_symbol_enum: case oasys_record_is_local_enum: /* Count symbols and remember their size for a future malloc */ abfd->symcount++; oasys->symbol_string_length += 1 + oasys_string_length (&record); - had_usefull = true; + had_usefull = TRUE; break; case oasys_record_is_section_enum: { @@ -487,7 +510,7 @@ oasys_object_p (abfd) s->_raw_size = H_GET_32 (abfd, record.section.value); s->vma = H_GET_32 (abfd, record.section.vma); s->flags = 0; - had_usefull = true; + had_usefull = TRUE; } break; case oasys_record_is_data_enum: @@ -498,7 +521,7 @@ oasys_object_p (abfd) case oasys_record_is_end_enum: if (! had_usefull) goto fail; - loop = false; + loop = FALSE; break; default: goto fail; @@ -578,20 +601,20 @@ oasys_print_symbol (abfd, afile, symbol, how) static reloc_howto_type howto_table[] = { - HOWTO (0, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "abs16", true, 0x0000ffff, 0x0000ffff, false), - HOWTO (0, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "abs32", true, 0xffffffff, 0xffffffff, false), - HOWTO (0, 0, 1, 16, true, 0, complain_overflow_signed, 0, "pcrel16", true, 0x0000ffff, 0x0000ffff, false), - HOWTO (0, 0, 2, 32, true, 0, complain_overflow_signed, 0, "pcrel32", true, 0xffffffff, 0xffffffff, false) + HOWTO (0, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "abs16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (0, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "abs32", TRUE, 0xffffffff, 0xffffffff, FALSE), + HOWTO (0, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "pcrel16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (0, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "pcrel32", TRUE, 0xffffffff, 0xffffffff, FALSE) }; /* Read in all the section data and relocation stuff too */ -static boolean +static bfd_boolean oasys_slurp_section_data (abfd) bfd *const abfd; { oasys_record_union_type record; oasys_data_type *data = OASYS_DATA (abfd); - boolean loop = true; + bfd_boolean loop = TRUE; oasys_per_section_type *per; asection *s; bfd_size_type amt; @@ -601,18 +624,18 @@ oasys_slurp_section_data (abfd) { per = oasys_per_section (s); if (per->initialized) - return true; + return TRUE; } if (data->first_data_record == 0) - return true; + return TRUE; if (bfd_seek (abfd, data->first_data_record, SEEK_SET) != 0) - return false; + return FALSE; while (loop) { if (! oasys_read_record (abfd, &record)) - return false; + return FALSE; switch (record.header.type) { case oasys_record_is_header_enum: @@ -636,11 +659,11 @@ oasys_slurp_section_data (abfd) { per->data = (bfd_byte *) bfd_zalloc (abfd, section->_raw_size); if (!per->data) - return false; + return FALSE; per->reloc_tail_ptr = (oasys_reloc_type **) §ion->relocation; - per->had_vma = false; - per->initialized = true; + per->had_vma = FALSE; + per->initialized = TRUE; section->reloc_count = 0; section->flags = SEC_ALLOC; } @@ -650,7 +673,7 @@ oasys_slurp_section_data (abfd) { /* Take the first vma we see as the base */ section->vma = dst_offset; - per->had_vma = true; + per->had_vma = TRUE; } dst_offset -= section->vma; @@ -705,7 +728,7 @@ oasys_slurp_section_data (abfd) r = (oasys_reloc_type *) bfd_alloc (abfd, amt); if (!r) - return false; + return FALSE; *(per->reloc_tail_ptr) = r; per->reloc_tail_ptr = &r->next; r->next = (oasys_reloc_type *) NULL; @@ -747,7 +770,7 @@ oasys_slurp_section_data (abfd) r = (oasys_reloc_type *) bfd_alloc (abfd, amt); if (!r) - return false; + return FALSE; *(per->reloc_tail_ptr) = r; per->reloc_tail_ptr = &r->next; r->next = (oasys_reloc_type *) NULL; @@ -793,15 +816,15 @@ oasys_slurp_section_data (abfd) case oasys_record_is_section_enum: break; default: - loop = false; + loop = FALSE; } } - return true; + return TRUE; } -static boolean +static bfd_boolean oasys_new_section_hook (abfd, newsect) bfd *abfd; asection *newsect; @@ -809,17 +832,17 @@ oasys_new_section_hook (abfd, newsect) newsect->used_by_bfd = (PTR) bfd_alloc (abfd, (bfd_size_type) sizeof (oasys_per_section_type)); if (!newsect->used_by_bfd) - return false; + return FALSE; oasys_per_section (newsect)->data = (bfd_byte *) NULL; oasys_per_section (newsect)->section = newsect; oasys_per_section (newsect)->offset = 0; - oasys_per_section (newsect)->initialized = false; + oasys_per_section (newsect)->initialized = FALSE; newsect->alignment_power = 1; /* Turn the section string into an index */ sscanf (newsect->name, "%u", &newsect->target_index); - return true; + return TRUE; } @@ -833,7 +856,7 @@ oasys_get_reloc_upper_bound (abfd, asect) return (asect->reloc_count + 1) * sizeof (arelent *); } -static boolean +static bfd_boolean oasys_get_section_contents (abfd, section, location, offset, count) bfd *abfd; sec_ptr section; @@ -851,7 +874,7 @@ oasys_get_section_contents (abfd, section, location, offset, count) { (void) memcpy (location, (PTR) (p->data + offset), (size_t) count); } - return true; + return TRUE; } @@ -890,7 +913,7 @@ oasys_canonicalize_reloc (ignore_abfd, section, relptr, symbols) /* Calculate the checksum and write one record */ -static boolean +static bfd_boolean oasys_write_record (abfd, type, record, size) bfd *abfd; oasys_record_enum_type type; @@ -913,13 +936,13 @@ oasys_write_record (abfd, type, record, size) } record->header.check_sum = 0xff & (-checksum); if (bfd_bwrite ((PTR) record, (bfd_size_type) size, abfd) != size) - return false; - return true; + return FALSE; + return TRUE; } /* Write out all the symbols */ -static boolean +static bfd_boolean oasys_write_syms (abfd) bfd *abfd; { @@ -995,7 +1018,7 @@ oasys_write_syms (abfd) (oasys_record_union_type *) & symbol, offsetof (oasys_symbol_record_type, name[0]) + l)) - return false; + return FALSE; } else { @@ -1004,17 +1027,17 @@ oasys_write_syms (abfd) (oasys_record_union_type *) & symbol, offsetof (oasys_symbol_record_type, name[0]) + l)) - return false; + return FALSE; } g->value = index - 1; } - return true; + return TRUE; } /* Write a section header for each section */ -static boolean +static bfd_boolean oasys_write_sections (abfd) bfd *abfd; { @@ -1029,7 +1052,7 @@ oasys_write_sections (abfd) (_("%s: can not represent section `%s' in oasys"), bfd_get_filename (abfd), s->name); bfd_set_error (bfd_error_nonrepresentable_section); - return false; + return FALSE; } out.relb = RELOCATION_TYPE_REL | s->target_index; H_PUT_32 (abfd, s->_cooked_size, out.value); @@ -1039,12 +1062,12 @@ oasys_write_sections (abfd) oasys_record_is_section_enum, (oasys_record_union_type *) & out, sizeof (out))) - return false; + return FALSE; } - return true; + return TRUE; } -static boolean +static bfd_boolean oasys_write_header (abfd) bfd *abfd; { @@ -1070,12 +1093,12 @@ oasys_write_header (abfd) (oasys_record_union_type *) & r, offsetof (oasys_header_record_type, description[0]))) - return false; + return FALSE; - return true; + return TRUE; } -static boolean +static bfd_boolean oasys_write_end (abfd) bfd *abfd; { @@ -1089,10 +1112,10 @@ oasys_write_end (abfd) oasys_record_is_end_enum, (oasys_record_union_type *) & end, sizeof (end))) - return false; + return FALSE; if (bfd_bwrite ((PTR) &null, (bfd_size_type) 1, abfd) != 1) - return false; - return true; + return FALSE; + return TRUE; } static int @@ -1109,7 +1132,7 @@ comp (ap, bp) Writing data.. */ -static boolean +static bfd_boolean oasys_write_data (abfd) bfd *abfd; { @@ -1286,29 +1309,29 @@ oasys_write_data (abfd) (abfd, oasys_record_is_data_enum, ((oasys_record_union_type *) &processed_data), (size_t) (dst - (bfd_byte *) &processed_data)))) - return false; + return FALSE; } } } - return true; + return TRUE; } -static boolean +static bfd_boolean oasys_write_object_contents (abfd) bfd *abfd; { if (! oasys_write_header (abfd)) - return false; + return FALSE; if (! oasys_write_syms (abfd)) - return false; + return FALSE; if (! oasys_write_sections (abfd)) - return false; + return FALSE; if (! oasys_write_data (abfd)) - return false; + return FALSE; if (! oasys_write_end (abfd)) - return false; - return true; + return FALSE; + return TRUE; } @@ -1319,7 +1342,7 @@ oasys_write_object_contents (abfd) /* set section contents is complicated with OASYS since the format is * not a byte image, but a record stream. */ -static boolean +static bfd_boolean oasys_set_section_contents (abfd, section, location, offset, count) bfd *abfd; sec_ptr section; @@ -1334,13 +1357,13 @@ oasys_set_section_contents (abfd, section, location, offset, count) oasys_per_section (section)->data = (bfd_byte *) (bfd_alloc (abfd, section->_cooked_size)); if (!oasys_per_section (section)->data) - return false; + return FALSE; } (void) memcpy ((PTR) (oasys_per_section (section)->data + offset), location, (size_t) count); } - return true; + return TRUE; } @@ -1406,7 +1429,7 @@ oasys_openr_next_archived_file (arch, prev) } } -static boolean +static bfd_boolean oasys_find_nearest_line (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr) bfd *abfd ATTRIBUTE_UNUSED; @@ -1417,7 +1440,7 @@ oasys_find_nearest_line (abfd, section, symbols, offset, const char **functionname_ptr ATTRIBUTE_UNUSED; unsigned int *line_ptr ATTRIBUTE_UNUSED; { - return false; + return FALSE; } @@ -1443,7 +1466,7 @@ oasys_generic_stat_arch_elt (abfd, buf) static int oasys_sizeof_headers (abfd, exec) bfd *abfd ATTRIBUTE_UNUSED; - boolean exec ATTRIBUTE_UNUSED; + bfd_boolean exec ATTRIBUTE_UNUSED; { return 0; } @@ -1454,11 +1477,11 @@ oasys_sizeof_headers (abfd, exec) #define oasys_slurp_armap bfd_true #define oasys_slurp_extended_name_table bfd_true #define oasys_construct_extended_name_table \ - ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ + ((bfd_boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ bfd_true) #define oasys_truncate_arname bfd_dont_truncate_arname #define oasys_write_armap \ - ((boolean (*) \ + ((bfd_boolean (*) \ PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \ bfd_true) #define oasys_read_ar_hdr bfd_nullvoidptr |