From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id C862D384B0EC; Mon, 1 Aug 2022 04:34:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C862D384B0EC Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org Subject: [binutils-gdb] Get rid of fprintf_vma and sprintf_vma X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: 48ca1b26b99c8fd5bc21f5c69b6b666d9b6b9726 X-Git-Newrev: f493c2174ef99a43c0a5d89179122f857955d738 Message-Id: <20220801043410.C862D384B0EC@sourceware.org> Date: Mon, 1 Aug 2022 04:34:10 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2022 04:34:10 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Df493c2174ef9= 9a43c0a5d89179122f857955d738 commit f493c2174ef99a43c0a5d89179122f857955d738 Author: Alan Modra Date: Mon Aug 1 11:33:46 2022 +0930 Get rid of fprintf_vma and sprintf_vma =20 These two macros print either a 16 digit hex number or an 8 digit hex number. Unfortunately they depend on both target and host, which means that the output for 32-bit targets may be either 8 or 16 hex digits. =20 Replace them in most cases with code that prints a bfd_vma using PRIx64. In some cases, deliberately lose the leading zeros. This change some output, notably in base/offset fields of m68k disassembly which I think looks better that way, and in error messages. I've kept leading zeros in symbol dumps (objdump -t) and in PE header dumps. =20 bfd/ * bfd-in.h (fprintf_vma, sprintf_vma, printf_vma): Delete. * bfd-in2.h: Regenerate. * bfd.c (bfd_sprintf_vma): Don't use sprintf_vma. (bfd_fprintf_vma): Don't use fprintf_vma. * coff-rs6000.c (xcoff_reloc_type_tls): Don't use sprintf_vma. Instead use PRIx64 to print bfd_vma values. (xcoff_ppc_relocate_section): Likewise. * cofflink.c (_bfd_coff_write_global_sym): Likewise. * mmo.c (mmo_write_symbols_and_terminator): Likewise. * srec.c (srec_write_symbols): Likewise. * elf32-xtensa.c (print_r_reloc): Similarly for fprintf_vma. * pei-x86_64.c (pex64_dump_xdata): Likewise. (pex64_bfd_print_pdata_section): Likewise. * som.c (som_print_symbol): Likewise. * ecoff.c (_bfd_ecoff_print_symbol): Use bfd_fprintf_vma. opcodes/ * dis-buf.c (perror_memory, generic_print_address): Don't use sprintf_vma. Instead use PRIx64 to print bfd_vma values. * i386-dis.c (print_operand_value, print_displacement): Likewis= e. * m68k-dis.c (print_base, print_indexed): Likewise. * ns32k-dis.c (print_insn_arg): Likewise. * ia64-gen.c (_opcode_int64_low, _opcode_int64_high): Delete. (opcode_fprintf_vma): Delete. (print_main_table): Use PRIx64 to print opcode. binutils/ * od-macho.c: Replace all uses of printf_vma with bfd_printf_vm= a. * objcopy.c (copy_object): Don't use sprintf_vma. Instead use PRIx64 to print bfd_vma values. (copy_main): Likewise. * readelf.c (CHECK_ENTSIZE_VALUES): Likewise. (dynamic_section_mips_val): Likewise. (print_vma): Don't use printf_vma. Instead use PRIx64 to print bfd_vma values. (dump_ia64_vms_dynamic_fixups): Likewise. (process_version_sections): Likewise. * rddbg.c (stab_context): Likewise. gas/ * config/tc-i386.c (offset_in_range): Don't use sprintf_vma. Instead use PRIx64 to print bfd_vma values. (md_assemble): Likewise. * config/tc-mips.c (load_register, macro): Likewise. * messages.c (as_internal_value_out_of_range): Likewise. * read.c (emit_expr_with_reloc): Likewise. * config/tc-ia64.c (note_register_values): Don't use fprintf_vm= a. Instead use PRIx64 to print bfd_vma values. (print_dependency): Likewise. * listing.c (list_symbol_table): Use bfd_sprintf_vma. * symbols.c (print_symbol_value_1): Use %p to print pointers. (print_binary): Likewise. (print_expr_1): Use PRIx64 to print bfd_vma values. * write.c (print_fixup): Use %p to print pointers. Don't use fprintf_vma. * testsuite/gas/all/overflow.l: Update expected output. * testsuite/gas/m68k/mcf-mov3q.d: Likewise. * testsuite/gas/m68k/operands.d: Likewise. * testsuite/gas/s12z/truncated.d: Likewise. ld/ * deffilep.y (def_file_print): Don't use fprintf_vma. Instead use PRIx64 to print bfd_vma values. * emultempl/armelf.em (gld${EMULATION_NAME}_finish): Don't use sprintf_vma. Instead use PRIx64 to print bfd_vma values. * emultempl/pe.em (gld${EMULATION_NAME}_finish): Likewise. * ldlang.c (lang_map): Use %V to print region origin. (lang_one_common): Don't use sprintf_vma. * ldmisc.c (vfinfo): Don't use fprintf_vma or sprintf_vma. * pe-dll.c (pe_dll_generate_def_file): Likewise. gdb/ * remote.c (remote_target::trace_set_readonly_regions): Replace uses of sprintf_vma with bfd_sprintf_vma. Diff: --- bfd/bfd-in.h | 7 - bfd/bfd-in2.h | 7 - bfd/bfd.c | 12 +- bfd/coff-rs6000.c | 27 +-- bfd/cofflink.c | 12 +- bfd/ecoff.c | 6 +- bfd/elf32-xtensa.c | 7 +- bfd/mmo.c | 11 +- bfd/pei-x86_64.c | 52 ++--- bfd/som.c | 5 +- bfd/srec.c | 21 +- binutils/objcopy.c | 58 ++--- binutils/od-macho.c | 34 +-- binutils/rddbg.c | 2 +- binutils/readelf.c | 41 ++-- gas/config/tc-i386.c | 19 +- gas/config/tc-ia64.c | 23 +- gas/config/tc-mips.c | 18 +- gas/listing.c | 20 +- gas/messages.c | 42 ++-- gas/read.c | 9 +- gas/symbols.c | 24 +- gas/testsuite/gas/all/overflow.l | 8 +- gas/testsuite/gas/m68k/mcf-mov3q.d | 2 +- gas/testsuite/gas/m68k/operands.d | 448 ++++++++++++++++++---------------= ---- gas/testsuite/gas/s12z/truncated.d | 2 +- gas/write.c | 14 +- gdb/remote.c | 15 +- ld/deffilep.y | 7 +- ld/emultempl/armelf.em | 5 +- ld/emultempl/pe.em | 5 +- ld/ldlang.c | 19 +- ld/ldmisc.c | 28 +-- ld/pe-dll.c | 6 +- opcodes/dis-buf.c | 11 +- opcodes/i386-dis.c | 21 +- opcodes/ia64-gen.c | 20 +- opcodes/m68k-dis.c | 10 +- opcodes/ns32k-dis.c | 5 +- 39 files changed, 426 insertions(+), 657 deletions(-) diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 9d0738a232a..5ae7e48214f 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -115,9 +115,6 @@ typedef uint64_t symvalue; =20 #define BFD_VMA_FMT @BFD_INT64_FMT@ =20 -#define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x) -#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x) - #else /* not BFD64 */ =20 typedef unsigned long bfd_vma; @@ -127,9 +124,6 @@ typedef unsigned long bfd_size_type; =20 #define BFD_VMA_FMT "l" =20 -#define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x) -#define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x) - #endif /* not BFD64 */ =20 #define HALF_BFD_SIZE_TYPE \ @@ -143,7 +137,6 @@ typedef @bfd_ufile_ptr@ ufile_ptr; extern void bfd_sprintf_vma (bfd *, char *, bfd_vma); extern void bfd_fprintf_vma (bfd *, void *, bfd_vma); =20 -#define printf_vma(x) fprintf_vma(stdout,x) #define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x) =20 typedef unsigned int flagword; /* 32 bits of flags */ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index bbe19288520..91ada0e3a94 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -122,9 +122,6 @@ typedef uint64_t symvalue; =20 #define BFD_VMA_FMT @BFD_INT64_FMT@ =20 -#define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x) -#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x) - #else /* not BFD64 */ =20 typedef unsigned long bfd_vma; @@ -134,9 +131,6 @@ typedef unsigned long bfd_size_type; =20 #define BFD_VMA_FMT "l" =20 -#define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x) -#define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x) - #endif /* not BFD64 */ =20 #define HALF_BFD_SIZE_TYPE \ @@ -150,7 +144,6 @@ typedef @bfd_ufile_ptr@ ufile_ptr; extern void bfd_sprintf_vma (bfd *, char *, bfd_vma); extern void bfd_fprintf_vma (bfd *, void *, bfd_vma); =20 -#define printf_vma(x) fprintf_vma(stdout,x) #define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x) =20 typedef unsigned int flagword; /* 32 bits of flags */ diff --git a/bfd/bfd.c b/bfd/bfd.c index 913ce2d6abe..3e85e171e3f 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -2236,26 +2236,26 @@ void bfd_sprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, char *buf, bfd_vma value) { #ifdef BFD64 - if (is32bit (abfd)) + if (!is32bit (abfd)) { - sprintf (buf, "%08lx", (unsigned long) value & 0xffffffff); + sprintf (buf, "%016" PRIx64, (uint64_t) value); return; } #endif - sprintf_vma (buf, value); + sprintf (buf, "%08lx", (unsigned long) value & 0xffffffff); } =20 void bfd_fprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, void *stream, bfd_vma value) { #ifdef BFD64 - if (is32bit (abfd)) + if (!is32bit (abfd)) { - fprintf ((FILE *) stream, "%08lx", (unsigned long) value & 0xfffffff= f); + fprintf ((FILE *) stream, "%016" PRIx64, (uint64_t) value); return; } #endif - fprintf_vma ((FILE *) stream, value); + fprintf ((FILE *) stream, "%08lx", (unsigned long) value & 0xffffffff); } =20 /* diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 6ad77ba77c4..3f0753e5bfc 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -3280,12 +3280,9 @@ xcoff_reloc_type_tls (bfd *input_bfd ATTRIBUTE_UNUSE= D, /* TLS relocations must target a TLS symbol. */ if (h->smclas !=3D XMC_TL && h->smclas !=3D XMC_UL) { - char vaddr_buf[128]; - - sprintf_vma (vaddr_buf, rel->r_vaddr); _bfd_error_handler - (_("%pB: TLS relocation at 0x%s over non-TLS symbol %s (0x%x)\n"), - input_bfd, vaddr_buf, h->root.root.string, h->smclas); + (_("%pB: TLS relocation at 0x%" PRIx64 " over non-TLS symbol %s (0x%x)\n"= ), + input_bfd, (uint64_t) rel->r_vaddr, h->root.root.string, h->smclas); return false; } =20 @@ -3296,12 +3293,9 @@ xcoff_reloc_type_tls (bfd *input_bfd ATTRIBUTE_UNUSE= D, && (h->flags & XCOFF_DEF_DYNAMIC) !=3D 0) || (h->flags & XCOFF_IMPORT) !=3D 0)) { - char vaddr_buf[128]; - - sprintf_vma (vaddr_buf, rel->r_vaddr); _bfd_error_handler - (_("%pB: TLS local relocation at 0x%s over imported symbol %s\n"), - input_bfd, vaddr_buf, h->root.root.string); + (_("%pB: TLS local relocation at 0x%" PRIx64 " over imported symbol %s\n"= ), + input_bfd, (uint64_t) rel->r_vaddr, h->root.root.string); return false; } =20 @@ -3705,15 +3699,10 @@ xcoff_ppc_relocate_section (bfd *output_bfd, break; =20 default: - { - char vaddr_buf[128]; - - sprintf_vma (vaddr_buf, rel->r_vaddr); - _bfd_error_handler - (_("%pB: relocation (%d) at 0x%s has wrong r_rsize (0x%x)\n"), - input_bfd, rel->r_type, vaddr_buf, rel->r_size); - return false; - } + _bfd_error_handler + (_("%pB: relocation (%d) at 0x%" PRIx64 " has wrong r_rsize (0x%x)\n"), + input_bfd, rel->r_type, (uint64_t) rel->r_vaddr, rel->r_size); + return false; } } =20 diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 92e780733fc..a5b936fd7c1 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -2562,14 +2562,10 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *= bh, void *data) if (isym.n_value > (bfd_vma) 0xffffffff) { if (! h->root.linker_def) - { - char value_buf[128]; - - sprintf_vma (value_buf, isym.n_value); - _bfd_error_handler - (_("%pB: stripping non-representable symbol '%s' (value 0x%s)"), - output_bfd, h->root.root.string, value_buf); - } + _bfd_error_handler + (_("%pB: stripping non-representable symbol '%s' " + "(value 0x%" PRIx64 ")"), + output_bfd, h->root.root.string, isym.n_value); return true; } #endif diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 511d88b5339..a4edf7a2e6c 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -1389,7 +1389,7 @@ _bfd_ecoff_print_symbol (bfd *abfd, (*debug_swap->swap_sym_in) (abfd, ecoffsymbol (symbol)->native, &ecoff_sym); fprintf (file, "ecoff local "); - fprintf_vma (file, (bfd_vma) ecoff_sym.value); + bfd_fprintf_vma (abfd, file, ecoff_sym.value); fprintf (file, " %x %x", (unsigned) ecoff_sym.st, (unsigned) ecoff_sym.sc); } @@ -1400,7 +1400,7 @@ _bfd_ecoff_print_symbol (bfd *abfd, (*debug_swap->swap_ext_in) (abfd, ecoffsymbol (symbol)->native, &ecoff_ext); fprintf (file, "ecoff extern "); - fprintf_vma (file, (bfd_vma) ecoff_ext.asym.value); + bfd_fprintf_vma (abfd, file, ecoff_ext.asym.value); fprintf (file, " %x %x", (unsigned) ecoff_ext.asym.st, (unsigned) ecoff_ext.asym.sc); } @@ -1443,7 +1443,7 @@ _bfd_ecoff_print_symbol (bfd *abfd, =20 fprintf (file, "[%3d] %c ", pos, type); - fprintf_vma (file, (bfd_vma) ecoff_ext.asym.value); + bfd_fprintf_vma (abfd, file, ecoff_ext.asym.value); fprintf (file, " st %x sc %x indx %x %c%c%c %s", (unsigned) ecoff_ext.asym.st, (unsigned) ecoff_ext.asym.sc, diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index ce3c46f69e5..bf72c85ca4a 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -5054,12 +5054,9 @@ print_r_reloc (FILE *fp, const r_reloc *r_rel) else fprintf (fp, " ?? + "); =20 - fprintf_vma (fp, r_rel->target_offset); + fprintf (fp, "%" PRIx64, (uint64_t) r_rel->target_offset); if (r_rel->virtual_offset) - { - fprintf (fp, " + "); - fprintf_vma (fp, r_rel->virtual_offset); - } + fprintf (fp, " + %" PRIx64, (uint64_t) r_rel->virtual_offset); =20 fprintf (fp, ")"); } diff --git a/bfd/mmo.c b/bfd/mmo.c index 20fa472c387..9c177d8d0b0 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -3010,18 +3010,13 @@ mmo_write_symbols_and_terminator (bfd *abfd) { /* Arbitrary buffer to hold the printable representation of a vma. */ - char vmas_main[40]; - char vmas_start[40]; bfd_vma vma_start =3D bfd_get_start_address (abfd); =20 - sprintf_vma (vmas_main, mainvalue); - sprintf_vma (vmas_start, vma_start); - _bfd_error_handler /* xgettext:c-format */ - (_("%pB: bad symbol definition: `Main' set to %s rather" - " than the start address %s\n"), - abfd, vmas_main, vmas_start); + (_("%pB: bad symbol definition: `Main' set to %" PRIx64 " rather" + " than the start address %" PRIx64 "\n"), + abfd, mainvalue, vma_start); bfd_set_error (bfd_error_bad_value); return false; } diff --git a/bfd/pei-x86_64.c b/bfd/pei-x86_64.c index 90ee530ea20..7d8fc8f0721 100644 --- a/bfd/pei-x86_64.c +++ b/bfd/pei-x86_64.c @@ -498,19 +498,14 @@ pex64_dump_xdata (FILE *file, bfd *abfd, case UNW_FLAG_EHANDLER: case UNW_FLAG_UHANDLER: case UNW_FLAG_FHANDLER: - fprintf (file, "\tHandler: "); - fprintf_vma (file, (ui.rva_ExceptionHandler - + pe_data (abfd)->pe_opthdr.ImageBase)); - fprintf (file, ".\n"); + fprintf (file, "\tHandler: %016" PRIx64 ".\n", + ui.rva_ExceptionHandler + pe_data (abfd)->pe_opthdr.ImageBase); break; case UNW_FLAG_CHAININFO: - fprintf (file, "\tChain: start: "); - fprintf_vma (file, ui.rva_BeginAddress); - fprintf (file, ", end: "); - fprintf_vma (file, ui.rva_EndAddress); - fprintf (file, "\n\t unwind data: "); - fprintf_vma (file, ui.rva_UnwindData); - fprintf (file, ".\n"); + fprintf (file, "\tChain: start: %016" PRIx64 ", end: %016" PRIx64, + ui.rva_BeginAddress, ui.rva_EndAddress); + fprintf (file, "\n\t unwind data: %016" PRIx64 ".\n", + ui.rva_UnwindData); break; } =20 @@ -640,15 +635,10 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile= , asection *pdata_section) && rf.rva_UnwindData =3D=3D 0) /* We are probably into the padding of the section now. */ break; - fputc (' ', file); - fprintf_vma (file, i + pdata_section->vma); - fprintf (file, ":\t"); - fprintf_vma (file, imagebase + rf.rva_BeginAddress); - fprintf (file, " "); - fprintf_vma (file, imagebase + rf.rva_EndAddress); - fprintf (file, " "); - fprintf_vma (file, imagebase + rf.rva_UnwindData); - fprintf (file, "\n"); + fprintf (file, " %016" PRIx64, i + pdata_section->vma); + fprintf (file, ":\t%016" PRIx64, imagebase + rf.rva_BeginAddress); + fprintf (file, " %016" PRIx64, imagebase + rf.rva_EndAddress); + fprintf (file, " %016" PRIx64 "\n", imagebase + rf.rva_UnwindData); if (i !=3D 0 && rf.rva_BeginAddress <=3D prev_beginaddress) { seen_error =3D 1; @@ -744,26 +734,22 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile= , asection *pdata_section) if (i =3D=3D 0) fprintf (file, _("\nDump of %s\n"), xdata_section->name); =20 - fputc (' ', file); - fprintf_vma (file, rf.rva_UnwindData + imagebase); + fprintf (file, " %016" PRIx64, rf.rva_UnwindData + imagebase); =20 if (prev_unwinddata_rva =3D=3D rf.rva_UnwindData) { /* Do not dump again the xdata for the same entry. */ - fprintf (file, " also used for function at "); - fprintf_vma (file, rf.rva_BeginAddress + imagebase); - fputc ('\n', file); + fprintf (file, " also used for function at %016" PRIx64 "\n", + rf.rva_BeginAddress + imagebase); continue; } else prev_unwinddata_rva =3D rf.rva_UnwindData; =20 - fprintf (file, " (rva: %08x): ", - (unsigned int) rf.rva_UnwindData); - fprintf_vma (file, rf.rva_BeginAddress + imagebase); - fprintf (file, " - "); - fprintf_vma (file, rf.rva_EndAddress + imagebase); - fputc ('\n', file); + fprintf (file, " (rva: %08x): %016" PRIx64 " - %016" PRIx64 "\n", + (unsigned int) rf.rva_UnwindData, + rf.rva_BeginAddress + imagebase, + rf.rva_EndAddress + imagebase); =20 if (rf.rva_UnwindData !=3D 0 || virt_size_is_zero) { @@ -781,8 +767,8 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile, = asection *pdata_section) { pex64_get_runtime_function (abfd, &arf, &pdata[altent - pdata_vma]); - fprintf (file, "pdata element at 0x"); - fprintf_vma (file, arf.rva_UnwindData); + fprintf (file, "pdata element at 0x%016" PRIx64, + arf.rva_UnwindData); } else fprintf (file, "unknown pdata element"); diff --git a/bfd/som.c b/bfd/som.c index 3c0b68a444e..90928b7641d 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -4897,9 +4897,8 @@ som_print_symbol (bfd *abfd, fprintf (file, "%s", symbol->name); break; case bfd_print_symbol_more: - fprintf (file, "som "); - fprintf_vma (file, symbol->value); - fprintf (file, " %lx", (long) symbol->flags); + fprintf (file, "som %08" PRIx64 " %x", + (uint64_t) symbol->value, symbol->flags); break; case bfd_print_symbol_all: { diff --git a/bfd/srec.c b/bfd/srec.c index 5f8c8c18087..abe36bbdbd1 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -1096,26 +1096,19 @@ srec_write_symbols (bfd *abfd) && s->section->output_section !=3D NULL) { /* Just dump out non debug symbols. */ - char buf[43], *p; + char buf[43]; =20 len =3D strlen (s->name); if (bfd_bwrite (" ", (bfd_size_type) 2, abfd) !=3D 2 || bfd_bwrite (s->name, len, abfd) !=3D len) return false; =20 - sprintf_vma (buf + 2, (s->value - + s->section->output_section->lma - + s->section->output_offset)); - p =3D buf + 2; - while (p[0] =3D=3D '0' && p[1] !=3D 0) - p++; - len =3D strlen (p); - p[len] =3D '\r'; - p[len + 1] =3D '\n'; - *--p =3D '$'; - *--p =3D ' '; - len +=3D 4; - if (bfd_bwrite (p, len, abfd) !=3D len) + sprintf (buf, " $%" PRIx64 "\r\n", + (uint64_t) (s->value + + s->section->output_section->lma + + s->section->output_offset)); + len =3D strlen (buf); + if (bfd_bwrite (buf, len, abfd) !=3D len) return false; } } diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 37435733d76..21c3a7127c8 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -2792,13 +2792,10 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_i= nfo_type *input_arch) =20 if (pe_file_alignment > pe_section_alignment) { - char file_alignment[20], section_alignment[20]; - - sprintf_vma (file_alignment, pe_file_alignment); - sprintf_vma (section_alignment, pe_section_alignment); - non_fatal (_("warning: file alignment (0x%s) > section alignment (0x%s)= "), - - file_alignment, section_alignment); + non_fatal (_("warning: file alignment (0x%" PRIx64 + ") > section alignment (0x%" PRIx64 ")"), + (uint64_t) pe_file_alignment, + (uint64_t) pe_section_alignment); } } =20 @@ -5495,14 +5492,9 @@ copy_main (int argc, char *argv[]) gap_fill_vma =3D parse_vma (optarg, "--gap-fill"); gap_fill =3D (bfd_byte) gap_fill_vma; if ((bfd_vma) gap_fill !=3D gap_fill_vma) - { - char buff[20]; - - sprintf_vma (buff, gap_fill_vma); - - non_fatal (_("Warning: truncating gap-fill from 0x%s to 0x%x"), - buff, gap_fill); - } + non_fatal (_("Warning: truncating gap-fill from 0x%" PRIx64 + " to 0x%x"), + (uint64_t) gap_fill_vma, gap_fill); gap_fill_set =3D true; } break; @@ -5968,32 +5960,20 @@ copy_main (int argc, char *argv[]) if (! p->used) { if (p->context & (SECTION_CONTEXT_SET_VMA | SECTION_CONTEXT_ALTER_V= MA)) - { - char buff [20]; - - sprintf_vma (buff, p->vma_val); - - /* xgettext:c-format */ - non_fatal (_("%s %s%c0x%s never used"), - "--change-section-vma", - p->pattern, - p->context & SECTION_CONTEXT_SET_VMA ? '=3D' : '+', - buff); - } + /* xgettext:c-format */ + non_fatal (_("%s %s%c0x%" PRIx64 " never used"), + "--change-section-vma", + p->pattern, + p->context & SECTION_CONTEXT_SET_VMA ? '=3D' : '+', + (uint64_t) p->vma_val); =20 if (p->context & (SECTION_CONTEXT_SET_LMA | SECTION_CONTEXT_ALTER_L= MA)) - { - char buff [20]; - - sprintf_vma (buff, p->lma_val); - - /* xgettext:c-format */ - non_fatal (_("%s %s%c0x%s never used"), - "--change-section-lma", - p->pattern, - p->context & SECTION_CONTEXT_SET_LMA ? '=3D' : '+', - buff); - } + /* xgettext:c-format */ + non_fatal (_("%s %s%c0x%" PRIx64 " never used"), + "--change-section-lma", + p->pattern, + p->context & SECTION_CONTEXT_SET_LMA ? '=3D' : '+', + (uint64_t) p->lma_val); } } } diff --git a/binutils/od-macho.c b/binutils/od-macho.c index e91c87d2acf..710dfc33db9 100644 --- a/binutils/od-macho.c +++ b/binutils/od-macho.c @@ -357,9 +357,9 @@ dump_section_map (bfd *abfd) seg =3D &cmd->command.segment; =20 printf ("[Segment %-16s ", seg->segname); - printf_vma (seg->vmaddr); + bfd_printf_vma (abfd, seg->vmaddr); putchar ('-'); - printf_vma (seg->vmaddr + seg->vmsize - 1); + bfd_printf_vma (abfd, seg->vmaddr + seg->vmsize - 1); putchar (' '); disp_segment_prot (seg->initprot); printf ("]\n"); @@ -368,29 +368,29 @@ dump_section_map (bfd *abfd) { printf ("%02u: %-16s %-16s ", ++sec_nbr, sec->segname, sec->sectname); - printf_vma (sec->addr); + bfd_printf_vma (abfd, sec->addr); putchar (' '); - printf_vma (sec->size); + bfd_printf_vma (abfd, sec->size); printf (" %08lx\n", sec->flags); } } } =20 static void -dump_section_header (bfd *abfd ATTRIBUTE_UNUSED, bfd_mach_o_section *sec) +dump_section_header (bfd *abfd, bfd_mach_o_section *sec) { printf (" Section: %-16s %-16s (bfdname: %s)\n", sec->sectname, sec->segname, sec->bfdsection->name); printf (" addr: "); - printf_vma (sec->addr); + bfd_printf_vma (abfd, sec->addr); printf (" size: "); - printf_vma (sec->size); + bfd_printf_vma (abfd, sec->size); printf (" offset: "); - printf_vma (sec->offset); + bfd_printf_vma (abfd, sec->offset); printf ("\n"); printf (" align: %ld", sec->align); printf (" nreloc: %lu reloff: ", sec->nreloc); - printf_vma (sec->reloff); + bfd_printf_vma (abfd, sec->reloff); printf ("\n"); printf (" flags: %08lx (type: %s", sec->flags, bfd_mach_o_get_name (bfd_mach_o_section_type_name, @@ -425,7 +425,7 @@ dump_section_header (bfd *abfd ATTRIBUTE_UNUSED, bfd_ma= ch_o_section *sec) } =20 static void -dump_segment (bfd *abfd ATTRIBUTE_UNUSED, bfd_mach_o_load_command *cmd) +dump_segment (bfd *abfd, bfd_mach_o_load_command *cmd) { bfd_mach_o_segment_command *seg =3D &cmd->command.segment; bfd_mach_o_section *sec; @@ -439,16 +439,16 @@ dump_segment (bfd *abfd ATTRIBUTE_UNUSED, bfd_mach_o_= load_command *cmd) disp_segment_prot (seg->maxprot); printf ("\n"); printf (" vmaddr: "); - printf_vma (seg->vmaddr); + bfd_printf_vma (abfd, seg->vmaddr); printf (" vmsize: "); - printf_vma (seg->vmsize); + bfd_printf_vma (abfd, seg->vmsize); printf ("\n"); printf (" fileoff: "); - printf_vma (seg->fileoff); + bfd_printf_vma (abfd, seg->fileoff); printf (" filesize: "); - printf_vma ((bfd_vma)seg->filesize); + bfd_printf_vma (abfd, (bfd_vma) seg->filesize); printf (" endoff: "); - printf_vma ((bfd_vma)(seg->fileoff + seg->filesize)); + bfd_printf_vma (abfd, (bfd_vma) (seg->fileoff + seg->filesize)); printf ("\n"); for (sec =3D seg->sect_head; sec !=3D NULL; sec =3D sec->next) dump_section_header (abfd, sec); @@ -540,7 +540,7 @@ dump_dysymtab (bfd *abfd, bfd_mach_o_load_command *cmd,= bool verbose) printf (" term: idx: %8u num: %u\n", module->iterm, module->nterm); printf (" objc_module_info: addr: "); - printf_vma (module->objc_module_info_addr); + bfd_printf_vma (abfd, module->objc_module_info_addr); printf (" size: %lu\n", module->objc_module_info_size); } =20 @@ -608,7 +608,7 @@ dump_dysymtab (bfd *abfd, bfd_mach_o_load_command *cmd,= bool verbose) unsigned int isym =3D dysymtab->indirect_syms[j]; =20 printf (" "); - printf_vma (addr); + bfd_printf_vma (abfd, addr); printf (" %5u: 0x%08x", j, isym); if (isym & BFD_MACH_O_INDIRECT_SYMBOL_LOCAL) printf (" LOCAL"); diff --git a/binutils/rddbg.c b/binutils/rddbg.c index 169c52f4983..9d69355420b 100644 --- a/binutils/rddbg.c +++ b/binutils/rddbg.c @@ -410,7 +410,7 @@ stab_context (void) else fprintf (stderr, "%-6d", stabp->type); fprintf (stderr, " %-6d ", stabp->desc); - fprintf_vma (stderr, stabp->value); + fprintf (stderr, "%08" PRIx64, (uint64_t) stabp->value); if (stabp->type !=3D 0) fprintf (stderr, " %s", stabp->string); fprintf (stderr, "\n"); diff --git a/binutils/readelf.c b/binutils/readelf.c index 4a3e448e30d..157f8d8f6fb 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -566,11 +566,10 @@ print_vma (bfd_vma vma, print_mode mode) /* Fall through. */ case LONG_HEX: #ifdef BFD64 - if (is_32bit_elf) - return nc + printf ("%8.8" BFD_VMA_FMT "x", vma); + if (!is_32bit_elf) + return nc + printf ("%16.16" PRIx64, (uint64_t) vma); #endif - printf_vma (vma); - return nc + 16; + return nc + printf ("%8.8" PRIx64, (uint64_t) vma); =20 case DEC_5: if (vma <=3D 99999) @@ -7193,13 +7192,10 @@ process_section_headers (Filedata * filedata) bfd_size_type expected_entsize =3D is_32bit_elf ? size32 : size64; \ if (section->sh_entsize !=3D expected_entsize) \ { \ - char buf[40]; \ - sprintf_vma (buf, section->sh_entsize); \ - /* Note: coded this way so that there is a single string for \ - translation. */ \ - error (_("Section %d has invalid sh_entsize of %s\n"), i, buf); \ - error (_("(Using the expected size of %u for the rest of this dump)\n")= , \ - (unsigned) expected_entsize); \ + error (_("Section %d has invalid sh_entsize of %" PRIx64 "\n"), \ + i, (uint64_t) section->sh_entsize); \ + error (_("(Using the expected size of %" PRIx64 " for the rest of this = dump)\n"), \ + (uint64_t) expected_entsize); \ section->sh_entsize =3D expected_entsize; \ } \ } \ @@ -8184,13 +8180,13 @@ dump_ia64_vms_dynamic_fixups (Filedata * = filedata, const char *rtype; =20 printf ("%3u ", (unsigned) BYTE_GET (imfs [i].fixup_seg)); - printf_vma ((bfd_vma) BYTE_GET (imfs [i].fixup_offset)); + printf ("%016" PRIx64 " ", (uint64_t) BYTE_GET (imfs [i].fixup_offse= t)); type =3D BYTE_GET (imfs [i].type); rtype =3D elf_ia64_reloc_type (type); if (rtype =3D=3D NULL) - printf (" 0x%08x ", type); + printf ("0x%08x ", type); else - printf (" %-32s ", rtype); + printf ("%-32s ", rtype); printf ("%6u ", (unsigned) BYTE_GET (imfs [i].symvec_index)); printf ("0x%08x\n", (unsigned) BYTE_GET (imfs [i].data_type)); } @@ -10596,12 +10592,8 @@ dynamic_section_mips_val (Filedata * filedata, Elf= _Internal_Dyn * entry) printf (_("Interface Version: %s"), get_dynamic_name (filedata, entry->d_un.d_val)); else - { - char buf[40]; - sprintf_vma (buf, entry->d_un.d_ptr); - /* Note: coded this way so that there is a single string for translatio= n. */ - printf (_(""), buf); - } + printf (_("Interface Version: "), + (uint64_t) entry->d_un.d_ptr); break; =20 case DT_MIPS_TIME_STAMP: @@ -12087,8 +12079,7 @@ process_version_sections (Filedata * filedata) printable_section_name (filedata, section), section->sh_info); =20 - printf (_(" Addr: 0x")); - printf_vma (section->sh_addr); + printf (_(" Addr: 0x%016" PRIx64), (uint64_t) section->sh_addr); printf (_(" Offset: %#08lx Link: %u (%s)\n"), (unsigned long) section->sh_offset, section->sh_link, printable_section_name_from_index (filedata, section->sh_link)); @@ -12234,8 +12225,7 @@ process_version_sections (Filedata * filedata) printable_section_name (filedata, section), section->sh_info); =20 - printf (_(" Addr: 0x")); - printf_vma (section->sh_addr); + printf (_(" Addr: 0x%016" PRIx64), (uint64_t) section->sh_addr); printf (_(" Offset: %#08lx Link: %u (%s)\n"), (unsigned long) section->sh_offset, section->sh_link, printable_section_name_from_index (filedata, section->sh_link)); @@ -12400,8 +12390,7 @@ process_version_sections (Filedata * filedata) printable_section_name (filedata, section), (unsigned long) total); =20 - printf (_(" Addr: 0x")); - printf_vma (section->sh_addr); + printf (_(" Addr: 0x%016" PRIx64), (uint64_t) section->sh_addr); printf (_(" Offset: %#08lx Link: %u (%s)\n"), (unsigned long) section->sh_offset, section->sh_link, printable_section_name (filedata, link_section)); diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index d40a71a492a..15520e58435 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -2377,15 +2377,8 @@ offset_in_range (offsetT val, int size) } =20 if ((val & ~mask) !=3D 0 && (-val & ~mask) !=3D 0) - { - char val_buf[128]; - char masked_buf[128]; - - /* Coded this way in order to ease translation. */ - sprintf_vma (val_buf, val); - sprintf_vma (masked_buf, val & mask); - as_warn (_("0x%s shortened to 0x%s"), val_buf, masked_buf); - } + as_warn (_("0x%" PRIx64 " shortened to 0x%" PRIx64), + (uint64_t) val, (uint64_t) (val & mask)); =20 return val & mask; } @@ -4913,12 +4906,8 @@ md_assemble (char *line) i.types[j].bitfield.disp32 =3D 0; if (i.types[j].bitfield.baseindex) { - char number_buf[128]; - - /* Coded this way in order to allow for ease of translation. */ - sprintf_vma (number_buf, exp->X_add_number); - as_bad (_("0x%s out of range of signed 32bit displacement"), - number_buf); + as_bad (_("0x%" PRIx64 " out of range of signed 32bit displacement"= ), + (uint64_t) exp->X_add_number); return; } } diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index 3011302ffba..2051d72a69b 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -9954,11 +9954,8 @@ note_register_values (struct ia64_opcode *idesc) gr_values[regno].value =3D CURR_SLOT.opnd[1].X_add_number; gr_values[regno].path =3D md.path; if (md.debug_dv) - { - fprintf (stderr, " Know gr%d =3D ", regno); - fprintf_vma (stderr, gr_values[regno].value); - fputs ("\n", stderr); - } + fprintf (stderr, " Know gr%d =3D %" PRIx64 "\n", + regno, gr_values[regno].value); } } /* Look for dep.z imm insns. */ @@ -9978,11 +9975,8 @@ note_register_values (struct ia64_opcode *idesc) gr_values[regno].value =3D value; gr_values[regno].path =3D md.path; if (md.debug_dv) - { - fprintf (stderr, " Know gr%d =3D ", regno); - fprintf_vma (stderr, gr_values[regno].value); - fputs ("\n", stderr); - } + fprintf (stderr, " Know gr%d =3D %" PRIx64 "\n", + regno, gr_values[regno].value); } } else @@ -10196,12 +10190,9 @@ print_dependency (const char *action, int depind) if (regdeps[depind].specific && regdeps[depind].index >=3D 0) fprintf (stderr, " (%d)", regdeps[depind].index); if (regdeps[depind].mem_offset.hint) - { - fputs (" ", stderr); - fprintf_vma (stderr, regdeps[depind].mem_offset.base); - fputs ("+", stderr); - fprintf_vma (stderr, regdeps[depind].mem_offset.offset); - } + fprintf (stderr, " %" PRIx64 "+%" PRIx64, + regdeps[depind].mem_offset.base, + regdeps[depind].mem_offset.offset); fprintf (stderr, "\n"); } } diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index da04414bdf8..9abdf389aca 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -9501,10 +9501,8 @@ load_register (int reg, expressionS *ep, int dbl) =20 if (!dbl || GPR_SIZE =3D=3D 32) { - char value[32]; - - sprintf_vma (value, ep->X_add_number); - as_bad (_("number (0x%s) larger than 32 bits"), value); + as_bad (_("number (0x%" PRIx64 ") larger than 32 bits"), + ep->X_add_number); macro_build (ep, "addiu", "t,r,j", reg, 0, BFD_RELOC_LO16); return; } @@ -12318,10 +12316,8 @@ macro (struct mips_cl_insn *ip, char *str) if (HAVE_32BIT_ADDRESSES && !IS_SEXT_32BIT_NUM (offset_expr.X_add_number)) { - char value [32]; - - sprintf_vma (value, offset_expr.X_add_number); - as_bad (_("number (0x%s) larger than 32 bits"), value); + as_bad (_("number (0x%" PRIx64 ") larger than 32 bits"), + offset_expr.X_add_number); } =20 /* A constant expression in PIC code can be handled just as it @@ -13001,10 +12997,8 @@ macro (struct mips_cl_insn *ip, char *str) if (HAVE_32BIT_ADDRESSES && !IS_SEXT_32BIT_NUM (offset_expr.X_add_number)) { - char value [32]; - - sprintf_vma (value, offset_expr.X_add_number); - as_bad (_("number (0x%s) larger than 32 bits"), value); + as_bad (_("number (0x%" PRIx64 ") larger than 32 bits"), + offset_expr.X_add_number); } =20 if (mips_pic =3D=3D NO_PIC || offset_expr.X_op =3D=3D O_constant) diff --git a/gas/listing.c b/gas/listing.c index 56e04b155df..83a6f39cb31 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -936,26 +936,10 @@ list_symbol_table (void) =20 if (S_GET_NAME (ptr)) { - char buf[30], fmt[8]; + char buf[30]; valueT val =3D S_GET_VALUE (ptr); =20 - /* @@ Note that this is dependent on the compilation options, - not solely on the target characteristics. */ - if (sizeof (val) =3D=3D 4 && sizeof (int) =3D=3D 4) - sprintf (buf, "%08lx", (unsigned long) val); - else if (sizeof (val) <=3D sizeof (unsigned long)) - { - sprintf (fmt, "%%0%lulx", - (unsigned long) (sizeof (val) * 2)); - sprintf (buf, fmt, (unsigned long) val); - } -#if defined (BFD64) - else if (sizeof (val) > 4) - sprintf_vma (buf, val); -#endif - else - abort (); - + bfd_sprintf_vma (stdoutput, buf, val); if (!got_some) { fprintf (list_file, "DEFINED SYMBOLS\n"); diff --git a/gas/messages.c b/gas/messages.c index 3b34466e998..e43b2dbd388 100644 --- a/gas/messages.c +++ b/gas/messages.c @@ -369,12 +369,6 @@ as_internal_value_out_of_range (const char *prefix, bool bad) { const char * err; - /* These buffer sizes are excessive, but better to be safe than sorry. - Note - these buffers are used in order to make the error message - string translateable. */ - char val_buf [128]; - char min_buf [128]; - char max_buf [128]; =20 if (prefix =3D=3D NULL) prefix =3D ""; @@ -386,16 +380,14 @@ as_internal_value_out_of_range (const char *prefix, if (max <=3D 1) abort (); =20 - sprintf (val_buf, "%" BFD_VMA_FMT "d", val); - sprintf (min_buf, "%" BFD_VMA_FMT "d", right); - /* xgettext:c-format */ - err =3D _("%s out of domain (%s is not a multiple of %s)"); + err =3D _("%s out of domain (%" PRId64 + " is not a multiple of %" PRId64 ")"); =20 if (bad) - as_bad_where (file, line, err, prefix, val_buf, min_buf); + as_bad_where (file, line, err, prefix, (int64_t) val, (int64_t) right); else - as_warn_where (file, line, err, prefix, val_buf, min_buf); + as_warn_where (file, line, err, prefix, (int64_t) val, (int64_t) right); } else if ( val < HEX_MAX_THRESHOLD && min < HEX_MAX_THRESHOLD @@ -404,31 +396,29 @@ as_internal_value_out_of_range (const char *prefix, && min > HEX_MIN_THRESHOLD && max > HEX_MIN_THRESHOLD) { - sprintf (val_buf, "%" BFD_VMA_FMT "d", val); - sprintf (min_buf, "%" BFD_VMA_FMT "d", min); - sprintf (max_buf, "%" BFD_VMA_FMT "d", max); - /* xgettext:c-format. */ - err =3D _("%s out of range (%s is not between %s and %s)"); + err =3D _("%s out of range (%" PRId64 + " is not between %" PRId64 " and %" PRId64 ")"); =20 if (bad) - as_bad_where (file, line, err, prefix, val_buf, min_buf, max_buf); + as_bad_where (file, line, err, prefix, + (int64_t) val, (int64_t) min, (int64_t) max); else - as_warn_where (file, line, err, prefix, val_buf, min_buf, max_buf); + as_warn_where (file, line, err, prefix, + (int64_t) val, (int64_t) min, (int64_t) max); } else { - sprintf_vma (val_buf, (bfd_vma) val); - sprintf_vma (min_buf, (bfd_vma) min); - sprintf_vma (max_buf, (bfd_vma) max); - /* xgettext:c-format. */ - err =3D _("%s out of range (0x%s is not between 0x%s and 0x%s)"); + err =3D _("%s out of range (0x%" PRIx64 + " is not between 0x%" PRIx64 " and 0x%" PRIx64 ")"); =20 if (bad) - as_bad_where (file, line, err, prefix, val_buf, min_buf, max_buf); + as_bad_where (file, line, err, prefix, + (int64_t) val, (int64_t) min, (int64_t) max); else - as_warn_where (file, line, err, prefix, val_buf, min_buf, max_buf); + as_warn_where (file, line, err, prefix, + (int64_t) val, (int64_t) min, (int64_t) max); } } =20 diff --git a/gas/read.c b/gas/read.c index 559fd05a8db..800712466be 100644 --- a/gas/read.c +++ b/gas/read.c @@ -4495,14 +4495,9 @@ emit_expr_with_reloc (expressionS *exp, use =3D get & unmask; if ((get & mask) !=3D 0 && (-get & mask) !=3D 0) { - char get_buf[128]; - char use_buf[128]; - - /* These buffers help to ease the translation of the warning message. = */ - sprintf_vma (get_buf, get); - sprintf_vma (use_buf, use); /* Leading bits contain both 0s & 1s. */ - as_warn (_("value 0x%s truncated to 0x%s"), get_buf, use_buf); + as_warn (_("value 0x%" PRIx64 " truncated to 0x%" PRIx64), + (uint64_t) get, (uint64_t) use); } /* Put bytes in right order. */ md_number_to_chars (p, use, (int) nbytes); diff --git a/gas/symbols.c b/gas/symbols.c index 81383a5e8cb..d4c0dff7ad6 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -3132,9 +3132,7 @@ print_symbol_value_1 (FILE *file, symbolS *sym) const char *name =3D S_GET_NAME (sym); if (!name || !name[0]) name =3D "(unnamed)"; - fprintf (file, "sym "); - fprintf_vma (file, (bfd_vma) (uintptr_t) sym); - fprintf (file, " %s", name); + fprintf (file, "sym %p %s", sym, name); =20 if (sym->flags.local_symbol) { @@ -3142,10 +3140,7 @@ print_symbol_value_1 (FILE *file, symbolS *sym) =20 if (locsym->frag !=3D &zero_address_frag && locsym->frag !=3D NULL) - { - fprintf (file, " frag "); - fprintf_vma (file, (bfd_vma) (uintptr_t) locsym->frag); - } + fprintf (file, " frag %p", locsym->frag); if (locsym->flags.resolved) fprintf (file, " resolved"); fprintf (file, " local"); @@ -3153,10 +3148,7 @@ print_symbol_value_1 (FILE *file, symbolS *sym) else { if (sym->frag !=3D &zero_address_frag) - { - fprintf (file, " frag "); - fprintf_vma (file, (bfd_vma) (uintptr_t) sym->frag); - } + fprintf (file, " frag %p", sym->frag); if (sym->flags.written) fprintf (file, " written"); if (sym->flags.resolved) @@ -3230,9 +3222,7 @@ print_binary (FILE *file, const char *name, expressio= nS *exp) void print_expr_1 (FILE *file, expressionS *exp) { - fprintf (file, "expr "); - fprintf_vma (file, (bfd_vma) (uintptr_t) exp); - fprintf (file, " "); + fprintf (file, "expr %p ", exp); switch (exp->X_op) { case O_illegal: @@ -3242,7 +3232,7 @@ print_expr_1 (FILE *file, expressionS *exp) fprintf (file, "absent"); break; case O_constant: - fprintf (file, "constant %lx", (unsigned long) exp->X_add_number); + fprintf (file, "constant %" PRIx64, (uint64_t) exp->X_add_number); break; case O_symbol: indent_level++; @@ -3251,8 +3241,8 @@ print_expr_1 (FILE *file, expressionS *exp) fprintf (file, ">"); maybe_print_addnum: if (exp->X_add_number) - fprintf (file, "\n%*s%lx", indent_level * 4, "", - (unsigned long) exp->X_add_number); + fprintf (file, "\n%*s%" PRIx64, indent_level * 4, "", + (uint64_t) exp->X_add_number); indent_level--; break; case O_register: diff --git a/gas/testsuite/gas/all/overflow.l b/gas/testsuite/gas/all/overf= low.l index 7f98e852f62..d10d9feb550 100644 --- a/gas/testsuite/gas/all/overflow.l +++ b/gas/testsuite/gas/all/overflow.l @@ -1,8 +1,8 @@ .*: Assembler messages: -.*:5: Warning: .* 0x0+100 truncated to 0x0+0 -.*:6: Warning: .* 0x0+101 truncated to 0x0+1 -.*:11: Warning: .* 0xf+00 truncated to 0x0+0 -.*:12: Warning: .* 0xf+eff truncated to 0x0+ff +.*:5: Warning: .* 0x0*100 truncated to 0x0*0 +.*:6: Warning: .* 0x0*101 truncated to 0x0*1 +.*:11: Warning: .* 0xf+00 truncated to 0x0*0 +.*:12: Warning: .* 0xf+eff truncated to 0x0*ff .*:17: Error: .* (256|(0x)?100) too large .* .*:18: Error: .* (257|(0x)?101) too large .* .*:23: Error: .* (0x)?f+00 too large .* diff --git a/gas/testsuite/gas/m68k/mcf-mov3q.d b/gas/testsuite/gas/m68k/mc= f-mov3q.d index 8de1d38b687..1f4df1dc31d 100644 --- a/gas/testsuite/gas/m68k/mcf-mov3q.d +++ b/gas/testsuite/gas/m68k/mcf-mov3q.d @@ -13,6 +13,6 @@ Disassembly of section .text: 6: a75b mov3ql #3,%a3@\+ 8: a964 mov3ql #4,%a4@- a: ab6d 04d2 mov3ql #5,%a5@\(1234\) - e: ad76 6803 mov3ql #6,%fp@\(0+03,%d6:l\) + e: ad76 6803 mov3ql #6,%fp@\(0*3,%d6:l\) 12: af78 1234 mov3ql #7,1234 (|<.data\+0x1218>) 16: a179 1234 5678 mov3ql #-1,12345678 (|<.data= \+0x1234565c>) diff --git a/gas/testsuite/gas/m68k/operands.d b/gas/testsuite/gas/m68k/ope= rands.d index 465ae88dac3..f3a1b04531c 100644 --- a/gas/testsuite/gas/m68k/operands.d +++ b/gas/testsuite/gas/m68k/operands.d @@ -18,237 +18,237 @@ Disassembly of section .text: 0+010 tstl %a0@\(8\) 0+014 tstl %a0@\(8\) 0+018 tstl %a0@\(8\) -0+01c tstl %a0@\(0+008,%d0:l\) -0+020 tstl %a0@\(0+008,%d0:w\) -0+024 tstl %a0@\(0+008,%d0:w\) -0+028 tstl %a0@\(0+008,%d0:w:2\) -0+02c tstl %a0@\(0+008,%d0:w:4\) -0+030 tstl %a0@\(0+008,%d0:w:8\) -0+034 tstl %a0@\(0+008,%d0:l\) -0+038 tstl %a0@\(0+008,%d0:l\) -0+03c tstl %a0@\(0+008,%d0:l:2\) -0+040 tstl %a0@\(0+008,%d0:l:4\) -0+044 tstl %a0@\(0+008,%d0:l:8\) -0+048 tstl %a0@\(0+000,%d0:w:2\) -0+04c tstl %a0@\(0+008,%d0:l\) -0+050 tstl %a0@\(0+008,%d0:l\) -0+054 tstl %a0@\(0+008,%d0:l:2\) -0+058 tstl %a0@\(0+008,%d0:l:4\) -0+05c tstl %a0@\(0+008,%d0:l:8\) -0+060 tstl %a0@\(0+008,%d0:w\) -0+064 tstl %a0@\(0+008,%d0:w\) -0+068 tstl %a0@\(0+008,%d0:w:2\) -0+06c tstl %a0@\(0+008,%d0:w:4\) -0+070 tstl %a0@\(0+008,%d0:w:8\) -0+074 tstl %a0@\(0+008,%d0:l\) -0+078 tstl %a0@\(0+008,%d0:l\) -0+07c tstl %a0@\(0+008,%d0:l:2\) -0+080 tstl %a0@\(0+008,%d0:l:4\) -0+084 tstl %a0@\(0+008,%d0:l:8\) -0+088 tstl %a0@\(0+008,%d0:l\) -0+08c tstl %a0@\(0+008,%a1:w:2\) -0+090 tstl %a1@\(0+008,%a0:l\) -0+094 tstl %a0@\(0+008,%d0:w:2\) -0+098 tstl %a0@\(0+008,%d0:w:2\) -0+09c tstl %a0@\(0+008,%a1:w:2\) -0+0a0 tstl %a0@\(0+000,%d0:w:2\) -0+0a4 tstl %a0@\(0+000,%d0:w:2\) -0+0a8 tstl %a0@\(0+3e8,%d0:w:2\) -0+0ae tstl @\(0+3e8,%d0:w:2\) -0+0b4 tstl @\(0+000,%d0:w:2\) -0+0b8 tstl @\(0+3e8\) -0+0be tstl %a0@\(0+186a0\) -0+0c6 tstl %a0@\(0+3e8,%d0:w:2\) -0+0cc tstl %a0@\(0+3e8,%d0:l\) -0+0d2 tstl %a0@\(0+3e8,%a1:w:2\) -0+0d8 tstl %a0@\(0+3e8,%d0:w:2\) -0+0de tstl %a0@\(0+3e8,%d0:l\) -0+0e4 tstl @\(0+3e8,%d0:w:2\) -0+0ea tstl @\(0+3e8,%d0:w:2\) -0+0f0 tstl @\(0+000,%d0:w:2\) -0+0f4 tstl %a0@\(0+186a0\) -0+0fc tstl %a0@\(0+186a0\) -0+104 tstl @\(0+3e8,%d0:w:2\) -0+10a tstl @\(0+186a0\) -0+112 tstl @\(0+3e8,%d0:w:2\) -0+118 tstl @\(0+3e8,%d0:l\) -0+11e tstl @\(0+3e8,%a1:w:2\) -0+124 tstl @\(0+3e8,%d0:w:2\) -0+12a tstl @\(0+3e8,%d0:l\) -0+130 tstl @\(0+186a0\) -0+138 tstl @\(0+186a0\) -0+140 tstl %a0@\(0+3e8\) -0+146 tstl @\(0+3e8\) -0+14c tstl @\(0+000\) -0+150 tstl %a0@\(0+3e8\) -0+156 tstl %a0@\(0+3e8\) -0+15c tstl %a0@\(0+3e8\) -0+162 tstl %a0@\(0+3e8\) -0+168 tstl %a0@\(0+3e8\) -0+16e tstl @\(0+3e8\) -0+174 tstl @\(0+3e8\) -0+17a tstl @\(0+000\) -0+17e tstl %a0@\(0+3e8\)@\(0+7d0,%d0:w:2\) -0+186 tstl %a0@\(0+3e8\)@\(0+000,%d0:w:2\) -0+18c tstl %a0@\(0+3e8\)@\(0+7d0\) -0+194 tstl @\(0+3e8\)@\(0+7d0,%d0:w:2\) -0+19c tstl @\(0+3e8\)@\(0+000,%d0:w:2\) -0+1a2 tstl @\(0+3e8\)@\(0+7d0\) -0+1aa tstl %a0@\(0+000\)@\(0+7d0,%d0:w:2\) -0+1b0 tstl %a0@\(0+000\)@\(0+000,%d0:w:2\) -0+1b4 tstl %a0@\(0+000\)@\(0+7d0\) -0+1ba tstl @\(0+000\)@\(0+7d0,%d0:w:2\) -0+1c0 tstl @\(0+000\)@\(0+000,%d0:w:2\) -0+1c4 tstl @\(0+000\)@\(0+7d0\) -0+1ca tstl %a0@\(0+3e8\)@\(0+7d0,%d0:w:2\) -0+1d2 tstl %a0@\(0+3e8\)@\(0+000,%d0:w:2\) -0+1d8 tstl %a0@\(0+3e8\)@\(0+7d0\) -0+1e0 tstl @\(0+3e8\)@\(0+7d0,%d0:w:2\) -0+1e8 tstl @\(0+3e8\)@\(0+000,%d0:w:2\) -0+1ee tstl @\(0+3e8\)@\(0+7d0\) -0+1f6 tstl %a0@\(0+000\)@\(0+7d0,%d0:w:2\) -0+1fc tstl %a0@\(0+000\)@\(0+000,%d0:w:2\) -0+200 tstl %a0@\(0+000\)@\(0+7d0\) -0+206 tstl @\(0+000\)@\(0+7d0,%d0:w:2\) -0+20c tstl @\(0+000\)@\(0+000,%d0:w:2\) -0+210 tstl @\(0+000\)@\(0+7d0\) -0+216 tstl %a0@\(0+3e8,%d0:w:2\)@\(0+7d0\) -0+21e tstl %a0@\(0+3e8,%d0:w:2\)@\(0+000\) -0+224 tstl @\(0+3e8,%d0:w:2\)@\(0+7d0\) -0+22c tstl @\(0+3e8,%d0:w:2\)@\(0+000\) -0+232 tstl %a0@\(0+000,%d0:w:2\)@\(0+7d0\) -0+238 tstl %a0@\(0+000,%d0:w:2\)@\(0+000\) -0+23c tstl @\(0+000,%d0:w:2\)@\(0+7d0\) -0+242 tstl @\(0+000,%d0:w:2\)@\(0+000\) -0+246 tstl %a0@\(0+3e8,%d0:w:2\)@\(0+7d0\) -0+24e tstl %a0@\(0+3e8,%d0:w:2\)@\(0+7d0\) -0+256 tstl %a0@\(0+3e8,%d0:l\)@\(0+7d0\) -0+25e tstl %a1@\(0+3e8,%a0:l\)@\(0+7d0\) -0+266 tstl %a0@\(0+3e8,%a1:w:2\)@\(0+7d0\) -0+26e tstl %a0@\(0+3e8,%d0:w:2\)@\(0+000\) -0+274 tstl %a0@\(0+3e8,%d0:l\)@\(0+000\) -0+27a tstl @\(0+3e8,%d0:w:2\)@\(0+7d0\) -0+282 tstl @\(0+3e8,%d0:w:2\)@\(0+000\) -0+288 tstl %a0@\(0+000,%d0:w:2\)@\(0+7d0\) -0+28e tstl %a0@\(0+000,%d0:l\)@\(0+7d0\) -0+294 tstl %a0@\(0+000,%d0:w:2\)@\(0+000\) -0+298 tstl %a0@\(0+000,%d0:l\)@\(0+000\) -0+29c tstl @\(0+000,%d0:w:2\)@\(0+7d0\) -0+2a2 tstl @\(0+000,%d0:w:2\)@\(0+000\) -0+2a6 pea %pc@\(0+2b0 \) -0+2aa pea %pc@\(0+2b4 \) -0+2ae pea %pc@\(0+2b8 \) -0+2b2 pea %pc@\(0+000 \) -0+2b6 pea %pc@\(0+2c0 ,%d0:w:2\) -0+2ba pea %pc@\(0+2bc ,%d0:w:2\) -0+2be pea %pc@\(0+2c8 ,%d0:w:2\) -0+2c2 pea %pc@\(0+2cc ,%d0:l\) -0+2c6 pea %pc@\(0+2d0 ,%a0:l\) -0+2ca pea %pc@\(0+2d4 ,%d0:w:2\) -0+2ce pea %pc@\(0+2d8 ,%d0:l\) -0+2d2 pea %pc@\(0+2dc ,%a0:l\) -0+2d6 pea %pc@\(0+2d8 ,%d0:w:2\) -0+2da pea %pc@\(0+2dc ,%d0:l\) -0+2de pea %pc@\(0+2e0 ,%a0:l\) -0+2e2 pea %pc@\(0+6cc <.*>,%d0:w:2\) -0+2e8 pea %pc@\(0+1898a <.*>\) -0+2f0 pea %pc@\(0+6da <.*>,%d0:w:2\) -0+2f6 pea %pc@\(0+6e0 <.*>,%d0:l\) -0+2fc pea %pc@\(0+6e6 <.*>,%a1:w:2\) -0+302 pea %pc@\(0+6ec <.*>,%a1:l\) -0+308 pea %pc@\(0+6f2 <.*>,%d0:w:2\) -0+30e pea %pc@\(0+6f8 <.*>,%d0:l\) -0+314 pea %pc@\(0+6fe <.*>,%a1:l\) -0+31a pea %pc@\(0+189bc <.*>\) -0+322 pea %pc@\(0+189c4 <.*>\) -0+32a pea %zpc@\(0+3e8,%d0:w:2\) -0+330 pea %zpc@\(0+186a0\) -0+338 pea %zpc@\(0+3e8,%d0:w:2\) -0+33e pea %zpc@\(0+3e8,%d0:l\) -0+344 pea %zpc@\(0+3e8,%a1:w:2\) -0+34a pea %zpc@\(0+3e8,%a1:l\) -0+350 pea %zpc@\(0+3e8,%d0:w:2\) -0+356 pea %zpc@\(0+3e8,%d0:l\) -0+35c pea %zpc@\(0+3e8,%a1:l\) -0+362 pea %zpc@\(0+186a0\) -0+36a pea %zpc@\(0+186a0\) -0+372 pea %pc@\(0+75c <.*>\)@\(0+7d0,%d0:w:2\) -0+37a pea %pc@\(0+764 <.*>\)@\(0+000,%d0:w:2\) -0+380 pea %pc@\(0+76a <.*>\)@\(0+7d0\) -0+388 pea %pc@\(0+38a \)@\(0+7d0,%d0:w:2\) -0+38e pea %pc@\(0+390 \)@\(0+000,%d0:w:2\) -0+392 pea %pc@\(0+394 \)@\(0+7d0\) -0+398 pea %pc@\(0+782 <.*>\)@\(0+7d0,%d0:w:2\) -0+3a0 pea %pc@\(0+78a <.*>\)@\(0+000,%d0:w:2\) -0+3a6 pea %pc@\(0+790 <.*>\)@\(0+7d0\) -0+3ae pea %pc@\(0+3b0 \)@\(0+7d0,%d0:w:2\) -0+3b4 pea %pc@\(0+3b6 \)@\(0+000,%d0:w:2\) -0+3b8 pea %pc@\(0+3ba \)@\(0+7d0\) -0+3be pea %zpc@\(0+3e8\)@\(0+7d0,%d0:w:2\) -0+3c6 pea %zpc@\(0+3e8\)@\(0+000,%d0:w:2\) -0+3cc pea %zpc@\(0+3e8\)@\(0+7d0\) -0+3d4 pea %zpc@\(0+000\)@\(0+7d0,%d0:w:2\) -0+3da pea %zpc@\(0+000\)@\(0+000,%d0:w:2\) -0+3de pea %zpc@\(0+000\)@\(0+7d0\) -0+3e4 pea %zpc@\(0+3e8\)@\(0+7d0,%d0:w:2\) -0+3ec pea %zpc@\(0+3e8\)@\(0+000,%d0:w:2\) -0+3f2 pea %zpc@\(0+3e8\)@\(0+7d0\) -0+3fa pea %zpc@\(0+000\)@\(0+7d0,%d0:w:2\) -0+400 pea %zpc@\(0+000\)@\(0+000,%d0:w:2\) -0+404 pea %zpc@\(0+000\)@\(0+7d0\) -0+40a pea %pc@\(0+7f4 <.*>,%d0:w:2\)@\(0+7d0\) -0+412 pea %pc@\(0+7fc <.*>,%d0:w:2\)@\(0+000\) -0+418 pea %pc@\(0+41a ,%d0:w:2\)@\(0+7d0\) -0+41e pea %pc@\(0+420 ,%d0:w:2\)@\(0+000\) -0+422 pea %pc@\(0+80c <.*>,%d0:w:2\)@\(0+7d0\) -0+42a pea %pc@\(0+814 <.*>,%d0:w:2\)@\(0+7d0\) -0+432 pea %pc@\(0+81c <.*>,%d0:l\)@\(0+7d0\) -0+43a pea %pc@\(0+824 <.*>,%a1:l\)@\(0+7d0\) -0+442 pea %pc@\(0+82c <.*>,%a1:l\)@\(0+7d0\) -0+44a pea %pc@\(0+834 <.*>,%a1:w:2\)@\(0+7d0\) -0+452 pea %pc@\(0+83c <.*>,%d0:w:2\)@\(0+000\) -0+458 pea %pc@\(0+842 <.*>,%d0:l\)@\(0+000\) -0+45e pea %pc@\(0+848 <.*>,%a1:l\)@\(0+000\) -0+464 pea %pc@\(0+466 ,%d0:w:2\)@\(0+7d0\) -0+46a pea %pc@\(0+46c ,%a0:l\)@\(0+7d0\) -0+470 pea %pc@\(0+472 ,%d0:w:2\)@\(0+000\) -0+474 pea %pc@\(0+476 ,%d0:l\)@\(0+000\) -0+478 pea %zpc@\(0+3e8,%d0:w:2\)@\(0+7d0\) -0+480 pea %zpc@\(0+3e8,%d0:w:2\)@\(0+000\) -0+486 pea %zpc@\(0+000,%d0:w:2\)@\(0+7d0\) -0+48c pea %zpc@\(0+000,%d0:w:2\)@\(0+000\) -0+490 pea %zpc@\(0+3e8,%d0:w:2\)@\(0+7d0\) -0+498 pea %zpc@\(0+3e8,%d0:w:2\)@\(0+7d0\) -0+4a0 pea %zpc@\(0+3e8,%d0:l\)@\(0+7d0\) -0+4a8 pea %zpc@\(0+3e8,%a1:l\)@\(0+7d0\) -0+4b0 pea %zpc@\(0+3e8,%a1:l\)@\(0+7d0\) -0+4b8 pea %zpc@\(0+3e8,%a1:w:2\)@\(0+7d0\) -0+4c0 pea %zpc@\(0+3e8,%d0:w:2\)@\(0+000\) -0+4c6 pea %zpc@\(0+3e8,%d0:l\)@\(0+000\) -0+4cc pea %zpc@\(0+3e8,%a1:l\)@\(0+000\) -0+4d2 pea %zpc@\(0+000,%d0:w:2\)@\(0+7d0\) -0+4d8 pea %zpc@\(0+000,%a0:l\)@\(0+7d0\) -0+4de pea %zpc@\(0+000,%d0:w:2\)@\(0+000\) -0+4e2 pea %zpc@\(0+000,%d0:l\)@\(0+000\) -0+4e6 tstl 0+004 -0+4ea tstl 0+004 -0+4ee tstl 0+004 -0+4f2 tstl 0+186a0 <.*> -0+4f8 tstl 0+008 -0+4fe tstl 0+008 +0+01c tstl %a0@\(0*8,%d0:l\) +0+020 tstl %a0@\(0*8,%d0:w\) +0+024 tstl %a0@\(0*8,%d0:w\) +0+028 tstl %a0@\(0*8,%d0:w:2\) +0+02c tstl %a0@\(0*8,%d0:w:4\) +0+030 tstl %a0@\(0*8,%d0:w:8\) +0+034 tstl %a0@\(0*8,%d0:l\) +0+038 tstl %a0@\(0*8,%d0:l\) +0+03c tstl %a0@\(0*8,%d0:l:2\) +0+040 tstl %a0@\(0*8,%d0:l:4\) +0+044 tstl %a0@\(0*8,%d0:l:8\) +0+048 tstl %a0@\(0*0,%d0:w:2\) +0+04c tstl %a0@\(0*8,%d0:l\) +0+050 tstl %a0@\(0*8,%d0:l\) +0+054 tstl %a0@\(0*8,%d0:l:2\) +0+058 tstl %a0@\(0*8,%d0:l:4\) +0+05c tstl %a0@\(0*8,%d0:l:8\) +0+060 tstl %a0@\(0*8,%d0:w\) +0+064 tstl %a0@\(0*8,%d0:w\) +0+068 tstl %a0@\(0*8,%d0:w:2\) +0+06c tstl %a0@\(0*8,%d0:w:4\) +0+070 tstl %a0@\(0*8,%d0:w:8\) +0+074 tstl %a0@\(0*8,%d0:l\) +0+078 tstl %a0@\(0*8,%d0:l\) +0+07c tstl %a0@\(0*8,%d0:l:2\) +0+080 tstl %a0@\(0*8,%d0:l:4\) +0+084 tstl %a0@\(0*8,%d0:l:8\) +0+088 tstl %a0@\(0*8,%d0:l\) +0+08c tstl %a0@\(0*8,%a1:w:2\) +0+090 tstl %a1@\(0*8,%a0:l\) +0+094 tstl %a0@\(0*8,%d0:w:2\) +0+098 tstl %a0@\(0*8,%d0:w:2\) +0+09c tstl %a0@\(0*8,%a1:w:2\) +0+0a0 tstl %a0@\(0*0,%d0:w:2\) +0+0a4 tstl %a0@\(0*0,%d0:w:2\) +0+0a8 tstl %a0@\(0*3e8,%d0:w:2\) +0+0ae tstl @\(0*3e8,%d0:w:2\) +0+0b4 tstl @\(0*0,%d0:w:2\) +0+0b8 tstl @\(0*3e8\) +0+0be tstl %a0@\(0*186a0\) +0+0c6 tstl %a0@\(0*3e8,%d0:w:2\) +0+0cc tstl %a0@\(0*3e8,%d0:l\) +0+0d2 tstl %a0@\(0*3e8,%a1:w:2\) +0+0d8 tstl %a0@\(0*3e8,%d0:w:2\) +0+0de tstl %a0@\(0*3e8,%d0:l\) +0+0e4 tstl @\(0*3e8,%d0:w:2\) +0+0ea tstl @\(0*3e8,%d0:w:2\) +0+0f0 tstl @\(0*0,%d0:w:2\) +0+0f4 tstl %a0@\(0*186a0\) +0+0fc tstl %a0@\(0*186a0\) +0+104 tstl @\(0*3e8,%d0:w:2\) +0+10a tstl @\(0*186a0\) +0+112 tstl @\(0*3e8,%d0:w:2\) +0+118 tstl @\(0*3e8,%d0:l\) +0+11e tstl @\(0*3e8,%a1:w:2\) +0+124 tstl @\(0*3e8,%d0:w:2\) +0+12a tstl @\(0*3e8,%d0:l\) +0+130 tstl @\(0*186a0\) +0+138 tstl @\(0*186a0\) +0+140 tstl %a0@\(0*3e8\) +0+146 tstl @\(0*3e8\) +0+14c tstl @\(0*0\) +0+150 tstl %a0@\(0*3e8\) +0+156 tstl %a0@\(0*3e8\) +0+15c tstl %a0@\(0*3e8\) +0+162 tstl %a0@\(0*3e8\) +0+168 tstl %a0@\(0*3e8\) +0+16e tstl @\(0*3e8\) +0+174 tstl @\(0*3e8\) +0+17a tstl @\(0*0\) +0+17e tstl %a0@\(0*3e8\)@\(0*7d0,%d0:w:2\) +0+186 tstl %a0@\(0*3e8\)@\(0*0,%d0:w:2\) +0+18c tstl %a0@\(0*3e8\)@\(0*7d0\) +0+194 tstl @\(0*3e8\)@\(0*7d0,%d0:w:2\) +0+19c tstl @\(0*3e8\)@\(0*0,%d0:w:2\) +0+1a2 tstl @\(0*3e8\)@\(0*7d0\) +0+1aa tstl %a0@\(0*0\)@\(0*7d0,%d0:w:2\) +0+1b0 tstl %a0@\(0*0\)@\(0*0,%d0:w:2\) +0+1b4 tstl %a0@\(0*0\)@\(0*7d0\) +0+1ba tstl @\(0*0\)@\(0*7d0,%d0:w:2\) +0+1c0 tstl @\(0*0\)@\(0*0,%d0:w:2\) +0+1c4 tstl @\(0*0\)@\(0*7d0\) +0+1ca tstl %a0@\(0*3e8\)@\(0*7d0,%d0:w:2\) +0+1d2 tstl %a0@\(0*3e8\)@\(0*0,%d0:w:2\) +0+1d8 tstl %a0@\(0*3e8\)@\(0*7d0\) +0+1e0 tstl @\(0*3e8\)@\(0*7d0,%d0:w:2\) +0+1e8 tstl @\(0*3e8\)@\(0*0,%d0:w:2\) +0+1ee tstl @\(0*3e8\)@\(0*7d0\) +0+1f6 tstl %a0@\(0*0\)@\(0*7d0,%d0:w:2\) +0+1fc tstl %a0@\(0*0\)@\(0*0,%d0:w:2\) +0+200 tstl %a0@\(0*0\)@\(0*7d0\) +0+206 tstl @\(0*0\)@\(0*7d0,%d0:w:2\) +0+20c tstl @\(0*0\)@\(0*0,%d0:w:2\) +0+210 tstl @\(0*0\)@\(0*7d0\) +0+216 tstl %a0@\(0*3e8,%d0:w:2\)@\(0*7d0\) +0+21e tstl %a0@\(0*3e8,%d0:w:2\)@\(0*0\) +0+224 tstl @\(0*3e8,%d0:w:2\)@\(0*7d0\) +0+22c tstl @\(0*3e8,%d0:w:2\)@\(0*0\) +0+232 tstl %a0@\(0*0,%d0:w:2\)@\(0*7d0\) +0+238 tstl %a0@\(0*0,%d0:w:2\)@\(0*0\) +0+23c tstl @\(0*0,%d0:w:2\)@\(0*7d0\) +0+242 tstl @\(0*0,%d0:w:2\)@\(0*0\) +0+246 tstl %a0@\(0*3e8,%d0:w:2\)@\(0*7d0\) +0+24e tstl %a0@\(0*3e8,%d0:w:2\)@\(0*7d0\) +0+256 tstl %a0@\(0*3e8,%d0:l\)@\(0*7d0\) +0+25e tstl %a1@\(0*3e8,%a0:l\)@\(0*7d0\) +0+266 tstl %a0@\(0*3e8,%a1:w:2\)@\(0*7d0\) +0+26e tstl %a0@\(0*3e8,%d0:w:2\)@\(0*0\) +0+274 tstl %a0@\(0*3e8,%d0:l\)@\(0*0\) +0+27a tstl @\(0*3e8,%d0:w:2\)@\(0*7d0\) +0+282 tstl @\(0*3e8,%d0:w:2\)@\(0*0\) +0+288 tstl %a0@\(0*0,%d0:w:2\)@\(0*7d0\) +0+28e tstl %a0@\(0*0,%d0:l\)@\(0*7d0\) +0+294 tstl %a0@\(0*0,%d0:w:2\)@\(0*0\) +0+298 tstl %a0@\(0*0,%d0:l\)@\(0*0\) +0+29c tstl @\(0*0,%d0:w:2\)@\(0*7d0\) +0+2a2 tstl @\(0*0,%d0:w:2\)@\(0*0\) +0+2a6 pea %pc@\(0*2b0 \) +0+2aa pea %pc@\(0*2b4 \) +0+2ae pea %pc@\(0*2b8 \) +0+2b2 pea %pc@\(0*0 \) +0+2b6 pea %pc@\(0*2c0 ,%d0:w:2\) +0+2ba pea %pc@\(0*2bc ,%d0:w:2\) +0+2be pea %pc@\(0*2c8 ,%d0:w:2\) +0+2c2 pea %pc@\(0*2cc ,%d0:l\) +0+2c6 pea %pc@\(0*2d0 ,%a0:l\) +0+2ca pea %pc@\(0*2d4 ,%d0:w:2\) +0+2ce pea %pc@\(0*2d8 ,%d0:l\) +0+2d2 pea %pc@\(0*2dc ,%a0:l\) +0+2d6 pea %pc@\(0*2d8 ,%d0:w:2\) +0+2da pea %pc@\(0*2dc ,%d0:l\) +0+2de pea %pc@\(0*2e0 ,%a0:l\) +0+2e2 pea %pc@\(0*6cc <.*>,%d0:w:2\) +0+2e8 pea %pc@\(0*1898a <.*>\) +0+2f0 pea %pc@\(0*6da <.*>,%d0:w:2\) +0+2f6 pea %pc@\(0*6e0 <.*>,%d0:l\) +0+2fc pea %pc@\(0*6e6 <.*>,%a1:w:2\) +0+302 pea %pc@\(0*6ec <.*>,%a1:l\) +0+308 pea %pc@\(0*6f2 <.*>,%d0:w:2\) +0+30e pea %pc@\(0*6f8 <.*>,%d0:l\) +0+314 pea %pc@\(0*6fe <.*>,%a1:l\) +0+31a pea %pc@\(0*189bc <.*>\) +0+322 pea %pc@\(0*189c4 <.*>\) +0+32a pea %zpc@\(0*3e8,%d0:w:2\) +0+330 pea %zpc@\(0*186a0\) +0+338 pea %zpc@\(0*3e8,%d0:w:2\) +0+33e pea %zpc@\(0*3e8,%d0:l\) +0+344 pea %zpc@\(0*3e8,%a1:w:2\) +0+34a pea %zpc@\(0*3e8,%a1:l\) +0+350 pea %zpc@\(0*3e8,%d0:w:2\) +0+356 pea %zpc@\(0*3e8,%d0:l\) +0+35c pea %zpc@\(0*3e8,%a1:l\) +0+362 pea %zpc@\(0*186a0\) +0+36a pea %zpc@\(0*186a0\) +0+372 pea %pc@\(0*75c <.*>\)@\(0*7d0,%d0:w:2\) +0+37a pea %pc@\(0*764 <.*>\)@\(0*0,%d0:w:2\) +0+380 pea %pc@\(0*76a <.*>\)@\(0*7d0\) +0+388 pea %pc@\(0*38a \)@\(0*7d0,%d0:w:2\) +0+38e pea %pc@\(0*390 \)@\(0*0,%d0:w:2\) +0+392 pea %pc@\(0*394 \)@\(0*7d0\) +0+398 pea %pc@\(0*782 <.*>\)@\(0*7d0,%d0:w:2\) +0+3a0 pea %pc@\(0*78a <.*>\)@\(0*0,%d0:w:2\) +0+3a6 pea %pc@\(0*790 <.*>\)@\(0*7d0\) +0+3ae pea %pc@\(0*3b0 \)@\(0*7d0,%d0:w:2\) +0+3b4 pea %pc@\(0*3b6 \)@\(0*0,%d0:w:2\) +0+3b8 pea %pc@\(0*3ba \)@\(0*7d0\) +0+3be pea %zpc@\(0*3e8\)@\(0*7d0,%d0:w:2\) +0+3c6 pea %zpc@\(0*3e8\)@\(0*0,%d0:w:2\) +0+3cc pea %zpc@\(0*3e8\)@\(0*7d0\) +0+3d4 pea %zpc@\(0*0\)@\(0*7d0,%d0:w:2\) +0+3da pea %zpc@\(0*0\)@\(0*0,%d0:w:2\) +0+3de pea %zpc@\(0*0\)@\(0*7d0\) +0+3e4 pea %zpc@\(0*3e8\)@\(0*7d0,%d0:w:2\) +0+3ec pea %zpc@\(0*3e8\)@\(0*0,%d0:w:2\) +0+3f2 pea %zpc@\(0*3e8\)@\(0*7d0\) +0+3fa pea %zpc@\(0*0\)@\(0*7d0,%d0:w:2\) +0+400 pea %zpc@\(0*0\)@\(0*0,%d0:w:2\) +0+404 pea %zpc@\(0*0\)@\(0*7d0\) +0+40a pea %pc@\(0*7f4 <.*>,%d0:w:2\)@\(0*7d0\) +0+412 pea %pc@\(0*7fc <.*>,%d0:w:2\)@\(0*0\) +0+418 pea %pc@\(0*41a ,%d0:w:2\)@\(0*7d0\) +0+41e pea %pc@\(0*420 ,%d0:w:2\)@\(0*0\) +0+422 pea %pc@\(0*80c <.*>,%d0:w:2\)@\(0*7d0\) +0+42a pea %pc@\(0*814 <.*>,%d0:w:2\)@\(0*7d0\) +0+432 pea %pc@\(0*81c <.*>,%d0:l\)@\(0*7d0\) +0+43a pea %pc@\(0*824 <.*>,%a1:l\)@\(0*7d0\) +0+442 pea %pc@\(0*82c <.*>,%a1:l\)@\(0*7d0\) +0+44a pea %pc@\(0*834 <.*>,%a1:w:2\)@\(0*7d0\) +0+452 pea %pc@\(0*83c <.*>,%d0:w:2\)@\(0*0\) +0+458 pea %pc@\(0*842 <.*>,%d0:l\)@\(0*0\) +0+45e pea %pc@\(0*848 <.*>,%a1:l\)@\(0*0\) +0+464 pea %pc@\(0*466 ,%d0:w:2\)@\(0*7d0\) +0+46a pea %pc@\(0*46c ,%a0:l\)@\(0*7d0\) +0+470 pea %pc@\(0*472 ,%d0:w:2\)@\(0*0\) +0+474 pea %pc@\(0*476 ,%d0:l\)@\(0*0\) +0+478 pea %zpc@\(0*3e8,%d0:w:2\)@\(0*7d0\) +0+480 pea %zpc@\(0*3e8,%d0:w:2\)@\(0*0\) +0+486 pea %zpc@\(0*0,%d0:w:2\)@\(0*7d0\) +0+48c pea %zpc@\(0*0,%d0:w:2\)@\(0*0\) +0+490 pea %zpc@\(0*3e8,%d0:w:2\)@\(0*7d0\) +0+498 pea %zpc@\(0*3e8,%d0:w:2\)@\(0*7d0\) +0+4a0 pea %zpc@\(0*3e8,%d0:l\)@\(0*7d0\) +0+4a8 pea %zpc@\(0*3e8,%a1:l\)@\(0*7d0\) +0+4b0 pea %zpc@\(0*3e8,%a1:l\)@\(0*7d0\) +0+4b8 pea %zpc@\(0*3e8,%a1:w:2\)@\(0*7d0\) +0+4c0 pea %zpc@\(0*3e8,%d0:w:2\)@\(0*0\) +0+4c6 pea %zpc@\(0*3e8,%d0:l\)@\(0*0\) +0+4cc pea %zpc@\(0*3e8,%a1:l\)@\(0*0\) +0+4d2 pea %zpc@\(0*0,%d0:w:2\)@\(0*7d0\) +0+4d8 pea %zpc@\(0*0,%a0:l\)@\(0*7d0\) +0+4de pea %zpc@\(0*0,%d0:w:2\)@\(0*0\) +0+4e2 pea %zpc@\(0*0,%d0:l\)@\(0*0\) +0+4e6 tstl 0*4 +0+4ea tstl 0*4 +0+4ee tstl 0*4 +0+4f2 tstl 0*186a0 <.*> +0+4f8 tstl 0*8 +0+4fe tstl 0*8 0+504 addib #1,%d0 0+508 addiw #1,%d0 0+50c addil #1,%d0 0+512 addqb #1,%d0 0+514 cmpib #1,%d0 -0+518 cmpib #1,%pc@\(0+51c \) +0+518 cmpib #1,%pc@\(0*51c \) 0+51e cmpiw #1,%d0 -0+522 cmpiw #1,%pc@\(0+526 \) +0+522 cmpiw #1,%pc@\(0*526 \) 0+528 cmpil #1,%d0 -0+52e cmpil #1,%pc@\(0+534 \) +0+52e cmpil #1,%pc@\(0*534 \) 0+536 cmpib #1,%d0 -0+53a cmpib #1,%pc@\(0+53e \) +0+53a cmpib #1,%pc@\(0*53e \) 0+540 cmpiw #1,%d0 -0+544 cmpiw #1,%pc@\(0+548 \) +0+544 cmpiw #1,%pc@\(0*548 \) 0+54a cmpil #1,%d0 -0+550 cmpil #1,%pc@\(0+556 \) +0+550 cmpil #1,%pc@\(0*556 \) diff --git a/gas/testsuite/gas/s12z/truncated.d b/gas/testsuite/gas/s12z/tr= uncated.d index 2dec3bc8d7b..fc6c4f40886 100644 --- a/gas/testsuite/gas/s12z/truncated.d +++ b/gas/testsuite/gas/s12z/truncated.d @@ -10,5 +10,5 @@ Disassembly of section .text: =20 00000000 <.text>: 0: 01 nop - 1: 14 Address 0x0+2 is out of bounds. + 1: 14 Address 0x0*2 is out of bounds. !!invalid!! diff --git a/gas/write.c b/gas/write.c index 20f5ce24d5f..f76bbdb706e 100644 --- a/gas/write.c +++ b/gas/write.c @@ -3211,9 +3211,7 @@ void print_fixup (fixS *fixp) { indent_level =3D 1; - fprintf (stderr, "fix "); - fprintf_vma (stderr, (bfd_vma) (uintptr_t) fixp); - fprintf (stderr, " %s:%d",fixp->fx_file, fixp->fx_line); + fprintf (stderr, "fix %p %s:%d", fixp, fixp->fx_file, fixp->fx_line); if (fixp->fx_pcrel) fprintf (stderr, " pcrel"); if (fixp->fx_pcrel_adjust) @@ -3222,12 +3220,10 @@ print_fixup (fixS *fixp) fprintf (stderr, " tcbit"); if (fixp->fx_done) fprintf (stderr, " done"); - fprintf (stderr, "\n size=3D%d frag=3D", fixp->fx_size); - fprintf_vma (stderr, (bfd_vma) (uintptr_t) fixp->fx_frag); - fprintf (stderr, " where=3D%ld offset=3D%lx addnumber=3D%lx", - (long) fixp->fx_where, - (unsigned long) fixp->fx_offset, - (unsigned long) fixp->fx_addnumber); + fprintf (stderr, "\n size=3D%d frag=3D%p", fixp->fx_size, fixp->fx_fr= ag); + fprintf (stderr, " where=3D%ld offset=3D%" PRIx64 " addnumber=3D%" PRIx6= 4, + fixp->fx_where, (uint64_t) fixp->fx_offset, + (uint64_t) fixp->fx_addnumber); fprintf (stderr, "\n %s (%d)", bfd_get_reloc_code_name (fixp->fx_r_ty= pe), fixp->fx_r_type); if (fixp->fx_addsy) diff --git a/gdb/remote.c b/gdb/remote.c index 39d0a794a21..49d26c2039e 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -13496,29 +13496,30 @@ remote_target::trace_set_readonly_regions () bfd_vma vma; int anysecs =3D 0; int offset =3D 0; + bfd *abfd =3D current_program_space->exec_bfd (); =20 - if (!current_program_space->exec_bfd ()) + if (!abfd) return; /* No information to give. */ =20 struct remote_state *rs =3D get_remote_state (); =20 strcpy (rs->buf.data (), "QTro"); offset =3D strlen (rs->buf.data ()); - for (s =3D current_program_space->exec_bfd ()->sections; s; s =3D s->nex= t) + for (s =3D abfd->sections; s; s =3D s->next) { char tmp1[40], tmp2[40]; int sec_length; =20 - if ((s->flags & SEC_LOAD) =3D=3D 0 || - /* (s->flags & SEC_CODE) =3D=3D 0 || */ - (s->flags & SEC_READONLY) =3D=3D 0) + if ((s->flags & SEC_LOAD) =3D=3D 0 + /* || (s->flags & SEC_CODE) =3D=3D 0 */ + || (s->flags & SEC_READONLY) =3D=3D 0) continue; =20 anysecs =3D 1; vma =3D bfd_section_vma (s); size =3D bfd_section_size (s); - sprintf_vma (tmp1, vma); - sprintf_vma (tmp2, vma + size); + bfd_sprintf_vma (abfd, tmp1, vma); + bfd_sprintf_vma (abfd, tmp2, vma + size); sec_length =3D 1 + strlen (tmp1) + 1 + strlen (tmp2); if (offset + sec_length + 1 > rs->buf.size ()) { diff --git a/ld/deffilep.y b/ld/deffilep.y index 3f610ddbe14..8c7a0dc4794 100644 --- a/ld/deffilep.y +++ b/ld/deffilep.y @@ -503,11 +503,8 @@ def_file_print (FILE *file, def_file *fdef) if (fdef->is_dll !=3D -1) fprintf (file, " is dll: %s\n", fdef->is_dll ? "yes" : "no"); if (fdef->base_address !=3D (bfd_vma) -1) - { - fprintf (file, " base address: 0x"); - fprintf_vma (file, fdef->base_address); - fprintf (file, "\n"); - } + fprintf (file, " base address: 0x%" PRIx64 "\n", + (uint64_t) fdef->base_address); if (fdef->description) fprintf (file, " description: `%s'\n", fdef->description); if (fdef->stack_reserve !=3D -1) diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em index 8f5334df198..1769ec54b2c 100644 --- a/ld/emultempl/armelf.em +++ b/ld/emultempl/armelf.em @@ -497,10 +497,7 @@ gld${EMULATION_NAME}_finish (void) =20 /* Now convert this value into a string and store it in entry_symbol where the lang_finish() function will pick it up. */ - buffer[0] =3D '0'; - buffer[1] =3D 'x'; - - sprintf_vma (buffer + 2, val); + sprintf (buffer, "0x%" PRIx64, (uint64_t) val); =20 if (params.thumb_entry_symbol !=3D NULL && entry_symbol.name !=3D NU= LL && entry_from_cmdline) diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 892bf70b7a6..2fd4ff4acaf 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -1980,10 +1980,7 @@ gld${EMULATION_NAME}_finish (void) =20 /* Now convert this value into a string and store it in entry_symbol where the lang_finish() function will pick it up. */ - buffer[0] =3D '0'; - buffer[1] =3D 'x'; - - sprintf_vma (buffer + 2, val); + sprintf (buffer, "0x%" PRIx64, (uint64_t) val); =20 if (entry_symbol.name !=3D NULL && entry_from_cmdline) einfo (_("%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"), diff --git a/ld/ldlang.c b/ld/ldlang.c index f12c09633a7..e7bc9f2d268 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -2297,21 +2297,9 @@ lang_map (void) =20 for (m =3D lang_memory_region_list; m !=3D NULL; m =3D m->next) { - char buf[100]; - int len; - fprintf (config.map_file, "%-16s ", m->name_list.name); =20 - sprintf_vma (buf, m->origin); - minfo ("0x%s ", buf); - len =3D strlen (buf); - while (len < 16) - { - print_space (); - ++len; - } - - minfo ("0x%V", m->length); + minfo ("0x%V 0x%V", m->origin, m->length); if (m->flags || m->not_flags) { #ifndef BFD64 @@ -7317,10 +7305,7 @@ lang_one_common (struct bfd_link_hash_entry *h, void= *info) } =20 minfo ("0x"); - if (size <=3D 0xffffffff) - sprintf (buf, "%lx", (unsigned long) size); - else - sprintf_vma (buf, size); + sprintf (buf, "%" PRIx64, (uint64_t) size); minfo ("%s", buf); len =3D strlen (buf); =20 diff --git a/ld/ldmisc.c b/ld/ldmisc.c index e204811a03e..ee5248705aa 100644 --- a/ld/ldmisc.c +++ b/ld/ldmisc.c @@ -241,25 +241,18 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bool i= s_warning) case 'V': /* hex bfd_vma */ { - bfd_vma value =3D args[arg_no].v; + uint64_t value =3D args[arg_no].v; ++arg_count; - fprintf_vma (fp, value); + fprintf (fp, "%016" PRIx64, value); } break; =20 case 'v': /* hex bfd_vma, no leading zeros */ { - char buf[100]; - char *p =3D buf; - bfd_vma value =3D args[arg_no].v; + uint64_t value =3D args[arg_no].v; ++arg_count; - sprintf_vma (p, value); - while (*p =3D=3D '0') - p++; - if (!*p) - p--; - fputs (p, fp); + fprintf (fp, "%" PRIx64, value); } break; =20 @@ -268,24 +261,19 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bool i= s_warning) 8 spaces. */ { char buf[100]; - bfd_vma value; - char *p; + uint64_t value; int len; =20 value =3D args[arg_no].v; ++arg_count; - sprintf_vma (buf, value); - for (p =3D buf; *p =3D=3D '0'; ++p) - ; - if (*p =3D=3D '\0') - --p; - len =3D strlen (p); + sprintf (buf, "%" PRIx64, value); + len =3D strlen (buf); while (len < 8) { putc (' ', fp); ++len; } - fprintf (fp, "0x%s", p); + fprintf (fp, "0x%s", buf); } break; =20 diff --git a/ld/pe-dll.c b/ld/pe-dll.c index db2c75da9b5..24a51189662 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -1812,10 +1812,8 @@ pe_dll_generate_def_file (const char *pe_out_def_fil= ename) quoteput (pe_def_file->name, out, 1); =20 if (pe_data (link_info.output_bfd)->pe_opthdr.ImageBase) - { - fprintf (out, " BASE=3D0x"); - fprintf_vma (out, ((bfd_vma) pe_data (link_info.output_bfd)->pe_opt= hdr.ImageBase)); - } + fprintf (out, " BASE=3D0x%" PRIx64, + (uint64_t) pe_data (link_info.output_bfd)->pe_opthdr.ImageBase); fprintf (out, "\n"); } =20 diff --git a/opcodes/dis-buf.c b/opcodes/dis-buf.c index 3bd078f54dc..56a57f9639f 100644 --- a/opcodes/dis-buf.c +++ b/opcodes/dis-buf.c @@ -61,13 +61,11 @@ perror_memory (int status, info->fprintf_func (info->stream, _("Unknown error %d\n"), status); else { - char buf[30]; - /* Actually, address between memaddr and memaddr + len was out of bounds. */ - sprintf_vma (buf, memaddr); info->fprintf_func (info->stream, - _("Address 0x%s is out of bounds.\n"), buf); + _("Address 0x%" PRIx64 " is out of bounds.\n"), + (uint64_t) memaddr); } } =20 @@ -81,10 +79,7 @@ perror_memory (int status, void generic_print_address (bfd_vma addr, struct disassemble_info *info) { - char buf[30]; - - sprintf_vma (buf, addr); - (*info->fprintf_func) (info->stream, "0x%s", buf); + (*info->fprintf_func) (info->stream, "0x%08" PRIx64, (uint64_t) addr); } =20 /* Just return NULL. */ diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index de9793690a5..1761df583da 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -10973,18 +10973,12 @@ print_operand_value (instr_info *ins, bfd_vma dis= p, enum disassembler_style style) { char tmp[30]; - unsigned int i =3D 0; =20 if (ins->address_mode =3D=3D mode_64bit) - { - oappend_with_style (ins, "0x", style); - sprintf_vma (tmp, disp); - while (tmp[i] =3D=3D '0' && tmp[i + 1]) - ++i; - } + sprintf (tmp, "0x%" PRIx64, (uint64_t) disp); else sprintf (tmp, "0x%x", (unsigned int) disp); - oappend_with_style (ins, tmp + i, style); + oappend_with_style (ins, tmp, style); } =20 /* Like oappend, but called for immediate operands. */ @@ -11004,7 +10998,6 @@ print_displacement (instr_info *ins, bfd_vma disp) { bfd_signed_vma val =3D disp; char tmp[30]; - unsigned int i; =20 if (val < 0) { @@ -11033,14 +11026,8 @@ print_displacement (instr_info *ins, bfd_vma disp) } } =20 - oappend_with_style (ins, "0x", dis_style_address_offset); - - sprintf_vma (tmp, (bfd_vma) val); - for (i =3D 0; tmp[i] =3D=3D '0'; i++) - continue; - if (tmp[i] =3D=3D '\0') - i--; - oappend_with_style (ins, tmp + i, dis_style_address_offset); + sprintf (tmp, "0x%" PRIx64, (int64_t) val); + oappend_with_style (ins, tmp, dis_style_address_offset); } =20 static void diff --git a/opcodes/ia64-gen.c b/opcodes/ia64-gen.c index a996bcd1c21..9acb078264b 100644 --- a/opcodes/ia64-gen.c +++ b/opcodes/ia64-gen.c @@ -53,15 +53,6 @@ #include #define _(String) gettext (String) =20 -/* This is a copy of fprintf_vma from bfd/bfd-in2.h. We have to use this - always, because we might be compiled without BFD64 defined, if configur= ed - for a 32-bit target and --enable-targets=3Dall is used. This will work= for - both 32-bit and 64-bit hosts. */ -#define _opcode_int64_low(x) ((unsigned long) (((x) & 0xffffffff))) -#define _opcode_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff)) -#define opcode_fprintf_vma(s,x) \ - fprintf ((s), "%08lx%08lx", _opcode_int64_high (x), _opcode_int64_low (x= )) - const char * program_name =3D NULL; int debug =3D 0; =20 @@ -2711,14 +2702,13 @@ print_main_table (void) printf ("static const struct ia64_main_table\nmain_table[] =3D {\n"); while (ptr !=3D NULL) { - printf (" { %d, %d, %d, 0x", + printf (" { %d, %d, %d, 0x%016" PRIx64 "ull, 0x%016" PRIx64 + "ull, { %d, %d, %d, %d, %d }, 0x%x, %d, },\n", ptr->name->num, ptr->opcode->type, - ptr->opcode->num_outputs); - opcode_fprintf_vma (stdout, ptr->opcode->opcode); - printf ("ull, 0x"); - opcode_fprintf_vma (stdout, ptr->opcode->mask); - printf ("ull, { %d, %d, %d, %d, %d }, 0x%x, %d, },\n", + ptr->opcode->num_outputs, + ptr->opcode->opcode, + ptr->opcode->mask, ptr->opcode->operands[0], ptr->opcode->operands[1], ptr->opcode->operands[2], diff --git a/opcodes/m68k-dis.c b/opcodes/m68k-dis.c index 963e1bf94a2..55038d4207a 100644 --- a/opcodes/m68k-dis.c +++ b/opcodes/m68k-dis.c @@ -515,17 +515,13 @@ print_base (int regno, bfd_vma disp, disassemble_info= *info) } else { - char buf[50]; - if (regno =3D=3D -2) (*info->fprintf_func) (info->stream, "@("); else if (regno =3D=3D -3) (*info->fprintf_func) (info->stream, "%%zpc@("); else (*info->fprintf_func) (info->stream, "%s@(", reg_names[regno]); - - sprintf_vma (buf, disp); - (*info->fprintf_func) (info->stream, "%s", buf); + (*info->fprintf_func) (info->stream, "%" PRIx64, (uint64_t) disp); } } =20 @@ -545,7 +541,6 @@ print_indexed (int basereg, bfd_vma base_disp; bfd_vma outer_disp; char buf[40]; - char vmabuf[50]; =20 NEXTWORD (p, word, NULL); =20 @@ -620,8 +615,7 @@ print_indexed (int basereg, (*info->fprintf_func) (info->stream, ",%s", buf); buf[0] =3D '\0'; } - sprintf_vma (vmabuf, outer_disp); - (*info->fprintf_func) (info->stream, ")@(%s", vmabuf); + (*info->fprintf_func) (info->stream, ")@(%" PRIx64, (uint64_t) outer_dis= p); if (buf[0] !=3D '\0') (*info->fprintf_func) (info->stream, ",%s", buf); (*info->fprintf_func) (info->stream, ")"); diff --git a/opcodes/ns32k-dis.c b/opcodes/ns32k-dis.c index a8509abb5cd..46e467da849 100644 --- a/opcodes/ns32k-dis.c +++ b/opcodes/ns32k-dis.c @@ -606,7 +606,7 @@ print_insn_arg (int d, /* Memory space disp(PC). */ disp1 =3D get_displacement (buffer, aoffsetp); *result++ =3D NEXT_IS_ADDR; - sprintf_vma (result, addr + disp1); + sprintf (result, "%" PRIx64, (uint64_t) (addr + disp1)); result +=3D strlen (result); *result++ =3D NEXT_IS_ADDR; *result =3D '\0'; @@ -665,7 +665,8 @@ print_insn_arg (int d, break; case 'p': *result++ =3D NEXT_IS_ADDR; - sprintf_vma (result, addr + get_displacement (buffer, aoffsetp)); + sprintf (result, "%" PRIx64, + (uint64_t) (addr + get_displacement (buffer, aoffsetp))); result +=3D strlen (result); *result++ =3D NEXT_IS_ADDR; *result =3D '\0';