aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/mmo.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4c2bb14..d11421f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-01 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * mmo.c (mmo_scan): Create .text section only when needed, not
+ from the start.
+
2020-03-31 Alan Modra <amodra@gmail.com>
* coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Correct bfd_bread
diff --git a/bfd/mmo.c b/bfd/mmo.c
index 3b7e5c0..ea7c4c6 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -1588,7 +1588,7 @@ mmo_scan (bfd *abfd)
unsigned int lineno = 1;
bfd_boolean error = FALSE;
bfd_vma vma = 0;
- asection *sec = bfd_make_section_old_way (abfd, MMO_TEXT_SECTION_NAME);
+ asection *sec = NULL;
asection *non_spec_sec = NULL;
bfd_vma non_spec_vma = 0;
bfd_size_type nbytes_read = 0;
@@ -1646,6 +1646,8 @@ mmo_scan (bfd *abfd)
goto error_return;
vma &= ~3;
+ if (sec == NULL)
+ sec = bfd_make_section_old_way (abfd, MMO_TEXT_SECTION_NAME);
mmo_xore_32 (sec, vma, bfd_get_32 (abfd, buf));
vma += 4;
lineno++;
@@ -2038,6 +2040,8 @@ mmo_scan (bfd *abfd)
else
{
/* This wasn't a lopcode, so store it in the current section. */
+ if (sec == NULL)
+ sec = bfd_make_section_old_way (abfd, MMO_TEXT_SECTION_NAME);
mmo_xore_32 (sec, vma & ~3, bfd_get_32 (abfd, buf));
vma += 4;
vma &= ~3;