From: Doug Evans Date: Tue, 5 Aug 2014 16:00:40 +0000 (-0700) Subject: Fix outputdots so that it doesn't errantly discard the first line of, e.g., X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aaffae57f3b2b2f3d353924934accffea527dc6e;p=binutils-gdb.git Fix outputdots so that it doesn't errantly discard the first line of, e.g., CODE_FRAGMENT. Also fix skip_past_newline to not skip past NUL. * bfd-in2.h: Regenerate. * libcoff.h: Regenerate. doc/ * chew.c (skip_past_newline_1): New function. (outputdots): Call it. (skip_past_newline): Ditto. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 679edd4138c..d553a9bf322 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2014-08-05 Doug Evans + + * bfd-in2.h: Regenerate. + * libcoff.h: Regenerate. + 2014-08-05 Maciej W. Rozycki * elfxx-mips.c (_bfd_mips_elf_discard_info): Set section's diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 3886adc7e83..8c77c813093 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1022,6 +1022,7 @@ extern struct coff_comdat_info * bfd_coff_get_comdat_section void bfd_init (void); /* Extracted from opncls.c. */ +/* Set to N to open the next N BFDs using an alternate id space. */ extern unsigned int bfd_use_reserved_id; bfd *bfd_fopen (const char *filename, const char *target, const char *mode, int fd); @@ -1206,6 +1207,7 @@ void *bfd_mmap (bfd *abfd, void *addr, bfd_size_type len, /* Extracted from bfdwin.c. */ /* Extracted from section.c. */ + typedef struct bfd_section { /* The name of the section; the name isn't a copy, the pointer is @@ -2344,6 +2346,7 @@ unsigned int bfd_arch_mach_octets_per_byte (enum bfd_architecture arch, unsigned long machine); /* Extracted from reloc.c. */ + typedef enum bfd_reloc_status { /* No errors detected. */ @@ -2393,6 +2396,7 @@ typedef struct reloc_cache_entry } arelent; + enum complain_overflow { /* Do not complain on overflow. */ @@ -2411,6 +2415,7 @@ enum complain_overflow unsigned number. */ complain_overflow_unsigned }; +struct bfd_symbol; /* Forward declaration. */ struct reloc_howto_struct { @@ -6027,6 +6032,7 @@ assembler and not (currently) written to any object files. */ /* Adapteva EPIPHANY - 8 bit immediate for 16 bit mov instruction. */ BFD_RELOC_EPIPHANY_IMM8, BFD_RELOC_UNUSED }; + typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; reloc_howto_type *bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code); @@ -6224,6 +6230,7 @@ bfd_boolean bfd_copy_private_symbol_data (ibfd, isymbol, obfd, osymbol)) /* Extracted from bfd.c. */ + enum bfd_direction { no_direction = 0, @@ -6508,6 +6515,7 @@ bfd_set_cacheable (bfd * abfd, bfd_boolean val) return TRUE; } + typedef enum bfd_error { bfd_error_no_error = 0, @@ -6543,6 +6551,7 @@ const char *bfd_errmsg (bfd_error_type error_tag); void bfd_perror (const char *message); + typedef void (*bfd_error_handler_type) (const char *, ...); bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); @@ -6551,6 +6560,7 @@ void bfd_set_error_program_name (const char *); bfd_error_handler_type bfd_get_error_handler (void); + typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg, const char *bfd_version, const char *bfd_file, diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog index 338773267e8..e2987ed5e7b 100644 --- a/bfd/doc/ChangeLog +++ b/bfd/doc/ChangeLog @@ -1,3 +1,9 @@ +2014-08-05 Doug Evans + + * chew.c (skip_past_newline_1): New function. + (outputdots): Call it. + (skip_past_newline): Ditto. + 2014-08-05 Alan Modra * chew.c (print_stack_level, main): Cast result of pointer diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c index 0773f9c1b02..9ad88aaa182 100644 --- a/bfd/doc/chew.c +++ b/bfd/doc/chew.c @@ -265,6 +265,19 @@ skip_white_and_stars (src, idx) return idx; } +static unsigned int +skip_past_newline_1 (ptr, idx) + string_type *ptr; + unsigned int idx; +{ + while (at (ptr, idx) + && at (ptr, idx) != '\n') + idx++; + if (at (ptr, idx) == '\n') + return idx + 1; + return idx; +} + /***********************************************************************/ string_type stack[STACK]; @@ -603,10 +616,12 @@ outputdots () while (at (tos, idx)) { - if (at (tos, idx) == '\n' && at (tos, idx + 1) == '.') + /* Every iteration begins at the start of a line. */ + if (at (tos, idx) == '.') { char c; - idx += 2; + + idx++; while ((c = at (tos, idx)) && c != '\n') { @@ -626,11 +641,13 @@ outputdots () idx++; } } + if (c == '\n') + idx++; catchar (&out, '\n'); } else { - idx++; + idx = skip_past_newline_1 (tos, idx); } } @@ -1095,10 +1112,7 @@ icatstr () static void skip_past_newline () { - while (at (ptr, idx) - && at (ptr, idx) != '\n') - idx++; - idx++; + idx = skip_past_newline_1 (ptr, idx); pc++; } diff --git a/bfd/libcoff.h b/bfd/libcoff.h index d2c794deb9c..540ddf94058 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -625,6 +625,7 @@ extern bfd_boolean ppc_allocate_toc_section extern bfd_boolean ppc_process_before_allocation (bfd *, struct bfd_link_info *); /* Extracted from coffcode.h. */ + typedef struct coff_ptr_struct { /* Remembers the offset from the first symbol in the file for