Correct printed value of Main in mmo.c consistency error message.

This commit is contained in:
Hans-Peter Nilsson
2015-10-20 06:56:33 +02:00
parent bfd09d203f
commit f9c62303d8
2 changed files with 12 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2015-10-20 Hans-Peter Nilsson <hp@bitrange.com>
* mmo.c (mmo_write_symbols_and_terminator): Correct printed value
of Main in error message.
2015-10-18 Doug Evans <xdje42@gmail.com> 2015-10-18 Doug Evans <xdje42@gmail.com>
* targets.c (bfd_flavour_name): "MMO" is spelled "mmo". * targets.c (bfd_flavour_name): "MMO" is spelled "mmo".

View File

@ -2896,16 +2896,17 @@ mmo_write_symbols_and_terminator (bfd *abfd)
&& (table[i]->flags & (BSF_DEBUGGING|BSF_GLOBAL)) == BSF_GLOBAL) && (table[i]->flags & (BSF_DEBUGGING|BSF_GLOBAL)) == BSF_GLOBAL)
{ {
asymbol *mainsym = table[i]; asymbol *mainsym = table[i];
memcpy (table + 1, orig_table, i * sizeof (asymbol *)); bfd_vma mainvalue
= (mainsym->value
+ mainsym->section->output_section->vma
+ mainsym->section->output_offset);
memcpy (table + 1, orig_table, i * sizeof (asymbol *));
table[0] = mainsym; table[0] = mainsym;
/* Check that the value assigned to :Main is the same as the entry /* Check that the value assigned to :Main is the same as the entry
address. The default linker script asserts this. This is as address. The default linker script asserts this. This is as
good a place as any to check this consistency. */ good a place as any to check this consistency. */
if ((mainsym->value if (mainvalue != bfd_get_start_address (abfd))
+ mainsym->section->output_section->vma
+ mainsym->section->output_offset)
!= bfd_get_start_address (abfd))
{ {
/* Arbitrary buffer to hold the printable representation of a /* Arbitrary buffer to hold the printable representation of a
vma. */ vma. */
@ -2913,7 +2914,7 @@ mmo_write_symbols_and_terminator (bfd *abfd)
char vmas_start[40]; char vmas_start[40];
bfd_vma vma_start = bfd_get_start_address (abfd); bfd_vma vma_start = bfd_get_start_address (abfd);
sprintf_vma (vmas_main, mainsym->value); sprintf_vma (vmas_main, mainvalue);
sprintf_vma (vmas_start, vma_start); sprintf_vma (vmas_start, vma_start);
(*_bfd_error_handler) (*_bfd_error_handler)