for (m = asneeded_list_head; m != NULL; m = m->next)
{
- size_t len;
+ int len;
minfo ("%s", m->soname);
len = strlen (m->soname);
print_nl ();
len = 0;
}
- while (len < 30)
- {
- print_space ();
- ++len;
- }
+ print_spaces (30 - len);
if (m->ref != NULL)
minfo ("%pB ", m->ref);
for (m = lang_memory_region_list; m != NULL; m = m->next)
{
- fprintf (config.map_file, "%-16s ", m->name_list.name);
+ fprintf (config.map_file, "%-16s", m->name_list.name);
- minfo ("0x%V 0x%V", m->origin, m->length);
- if (m->flags || m->not_flags)
- {
-#ifndef BFD64
- minfo (" ");
-#endif
- if (m->flags)
- {
- print_space ();
- lang_map_flags (m->flags);
- }
+ char buf[32];
+ bfd_sprintf_vma (link_info.output_bfd, buf, m->origin);
+ fprintf (config.map_file, " 0x%-16s", buf);
+ bfd_sprintf_vma (link_info.output_bfd, buf, m->length);
+ fprintf (config.map_file,
+ " 0x%*s", m->flags || m->not_flags ? -17 : 0, buf);
+ if (m->flags)
+ lang_map_flags (m->flags);
- if (m->not_flags)
- {
- minfo (" !");
- lang_map_flags (m->not_flags);
- }
+ if (m->not_flags)
+ {
+ minfo ("!");
+ lang_map_flags (m->not_flags);
}
print_nl ();
print_nl ();
len = 0;
}
- while (len < SECTION_NAME_MAP_LENGTH)
- {
- print_space ();
- ++len;
- }
+ print_spaces (SECTION_NAME_MAP_LENGTH - len);
minfo ("0x%V %W", section->vma, TO_ADDR (section->size));
print_assignment (lang_assignment_statement_type *assignment,
lang_output_section_statement_type *output_section)
{
- unsigned int i;
bool is_dot;
etree_type *tree;
asection *osec;
- for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
- print_space ();
+ print_spaces (SECTION_NAME_MAP_LENGTH);
if (assignment->exp->type.node_class == etree_assert)
{
else
expld.result.valid_p = false;
+ char buf[32];
+ const char *str = buf;
if (expld.result.valid_p)
{
bfd_vma value;
if (expld.result.section != NULL)
value += expld.result.section->vma;
- minfo ("0x%V", value);
+ buf[0] = '0';
+ buf[1] = 'x';
+ bfd_sprintf_vma (link_info.output_bfd, buf + 2, value);
if (is_dot)
print_dot = value;
}
value += h->u.def.section->output_section->vma;
value += h->u.def.section->output_offset;
- minfo ("[0x%V]", value);
+ buf[0] = '[';
+ buf[1] = '0';
+ buf[2] = 'x';
+ bfd_sprintf_vma (link_info.output_bfd, buf + 3, value);
+ strcat (buf, "]");
}
else
- minfo ("[unresolved]");
+ str = "[unresolved]";
}
}
else
{
if (assignment->exp->type.node_class == etree_provide)
- minfo ("[!provide]");
+ str = "[!provide]";
else
- minfo ("*undef* ");
-#ifdef BFD64
- minfo (" ");
-#endif
+ str = "*undef*";
}
expld.assign_name = NULL;
- minfo (" ");
+ fprintf (config.map_file, "%-34s", str);
exp_print_tree (assignment->exp);
print_nl ();
}
|| hash_entry->type == bfd_link_hash_defweak)
&& sec == hash_entry->u.def.section)
{
- int i;
-
- for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
- print_space ();
+ print_spaces (SECTION_NAME_MAP_LENGTH);
minfo ("0x%V ",
(hash_entry->u.def.value
+ hash_entry->u.def.section->output_offset
init_opb (i);
- print_space ();
- minfo ("%s", i->name);
+ minfo (" %s", i->name);
len = 1 + strlen (i->name);
if (len >= SECTION_NAME_MAP_LENGTH - 1)
print_nl ();
len = 0;
}
- while (len < SECTION_NAME_MAP_LENGTH)
- {
- print_space ();
- ++len;
- }
+ print_spaces (SECTION_NAME_MAP_LENGTH - len);
if (i->output_section != NULL
&& i->output_section->owner == link_info.output_bfd)
size = 0;
}
- minfo ("0x%V %W %pB\n", addr, TO_ADDR (size), i->owner);
+ char buf[32];
+ bfd_sprintf_vma (link_info.output_bfd, buf, addr);
+ minfo ("0x%s %W %pB\n", buf, TO_ADDR (size), i->owner);
if (size != i->rawsize && i->rawsize != 0)
{
- len = SECTION_NAME_MAP_LENGTH + 3;
-#ifdef BFD64
- len += 16;
-#else
- len += 8;
-#endif
- while (len > 0)
- {
- print_space ();
- --len;
- }
-
+ len = SECTION_NAME_MAP_LENGTH + 3 + strlen (buf);
+ print_spaces (len);
minfo (_("%W (size before relaxing)\n"), TO_ADDR (i->rawsize));
}
static void
print_data_statement (lang_data_statement_type *data)
{
- int i;
bfd_vma addr;
bfd_size_type size;
const char *name;
init_opb (data->output_section);
- for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
- print_space ();
+ print_spaces (SECTION_NAME_MAP_LENGTH);
addr = data->output_offset;
if (data->output_section != NULL)
static void
print_reloc_statement (lang_reloc_statement_type *reloc)
{
- int i;
bfd_vma addr;
bfd_size_type size;
init_opb (reloc->output_section);
- for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
- print_space ();
+ print_spaces (SECTION_NAME_MAP_LENGTH);
addr = reloc->output_offset;
if (reloc->output_section != NULL)
minfo (" *fill*");
len = sizeof " *fill*" - 1;
- while (len < SECTION_NAME_MAP_LENGTH)
- {
- print_space ();
- ++len;
- }
+ print_spaces (SECTION_NAME_MAP_LENGTH - len);
addr = s->output_offset;
if (s->output_section != NULL)
static bool header_printed;
int len;
char *name;
- char buf[50];
+ char buf[32];
if (!header_printed)
{
print_nl ();
len = 0;
}
- while (len < 20)
- {
- print_space ();
- ++len;
- }
- minfo ("0x");
sprintf (buf, "%" PRIx64, (uint64_t) size);
- minfo ("%s", buf);
- len = strlen (buf);
-
- while (len < 16)
- {
- print_space ();
- ++len;
- }
+ fprintf (config.map_file, "%*s0x%-16s", 20 - len, "", buf);
minfo ("%pB\n", section->owner);
}
%H like %C but in addition emit section+offset
%P print program name
%V hex bfd_vma
- %W hex bfd_vma with 0x with no leading zeros taking up 8 spaces
+ %W hex bfd_vma with 0x with no leading zeros taking up 10 spaces
%X no object output, fail return
%d integer, like printf
%ld long, like printf
case 'V':
/* hex bfd_vma */
{
- uint64_t value = args[arg_no].v;
+ char buf[32];
+ bfd_vma value;
+
+ value = args[arg_no].v;
++arg_count;
- fprintf (fp, "%016" PRIx64, value);
+ bfd_sprintf_vma (link_info.output_bfd, buf, value);
+ fprintf (fp, "%s", buf);
}
break;
case 'W':
/* hex bfd_vma with 0x with no leading zeroes taking up
- 8 spaces. */
+ 10 spaces (including the 0x). */
{
- char buf[100];
+ char buf[32];
uint64_t value;
- int len;
value = args[arg_no].v;
++arg_count;
- sprintf (buf, "%" PRIx64, value);
- len = strlen (buf);
- while (len < 8)
- {
- putc (' ', fp);
- ++len;
- }
- fprintf (fp, "0x%s", buf);
+ sprintf (buf, "0x%" PRIx64, value);
+ fprintf (fp, "%10s", buf);
}
break;
/* Functions to print the link map. */
void
-print_space (void)
+print_spaces (int count)
{
- fprintf (config.map_file, " ");
+ fprintf (config.map_file, "%*s", count, "");
}
void