binutils-gdb/ld/ldmisc.h
Alan Modra 6b9bd54c24 Re: Get rid of fprintf_vma and sprintf_vma
Commit f493c2174e messed the formatting in linker map files,
particularly for 32-bit builds where a number of tests using map files
regressed.  I should have noticed the BFD64 conditional printing of
spaces to line up output due to the original %V printing hex vmas with
16 digits when BFD64 and 8 digits when not.  Besides that, it is nicer
to print 32-bit vmas for 32-bit targets.  So change %V back to be
target dependent, now using bfd_sprintf_vma.  Since minfo doesn't
return the number of chars printed, that means some places that
currently use %V must instead sprintf to a buffer in order to find the
length printed.

	* ldmisc.h (print_spaces): Declare.
	(print_space): Change to a macro.
	* ldmisc.c (vfinfo): Use bfd_sprintf_vma for %V.  Tidy %W case.
	(print_space): Delete.
	(print_spaces): New function.
	* emultempl/aix.em (print_symbol): Use print_spaces.
	* ldctor.c (ldctor_build_sets): Likewise.
	* ldmain.c (add_archive_element): Likewise.
	* ldlang.c (print_one_symbol, lang_print_asneeded): Likewise.
	(print_output_section_statement, print_data_statement): Likewise.
	(print_reloc_statement, print_padding_statement): Likewise.
	(print_assignment): Likewise.  Also replace %V printing of vmas
	with printing to a buffer in order to properly format output.
	(print_input_section, lang_one_common): Likewise.
2022-08-04 12:00:36 +09:30

46 lines
1.5 KiB
C

/* ldmisc.h -
Copyright (C) 1991-2022 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#ifndef LDMISC_H
#define LDMISC_H
extern void vfinfo (FILE *fp, const char *fmt, va_list arg, bool is_warning);
extern void einfo (const char *, ...);
extern void minfo (const char *, ...);
extern void info_msg (const char *, ...);
extern void lfinfo (FILE *, const char *, ...);
extern void info_assert (const char *, unsigned int);
extern void yyerror (const char *);
extern void *xmalloc (size_t);
extern void *xrealloc (void *, size_t);
extern void xexit (int);
#define ASSERT(x) \
do { if (!(x)) info_assert(__FILE__,__LINE__); } while (0)
#define FAIL() \
do { info_assert(__FILE__,__LINE__); } while (0)
extern void print_spaces (int);
#define print_space() print_spaces (1)
extern void print_nl (void);
#endif