* emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_after_allocation):
authorJoern Rennecke <joern.rennecke@embecosm.com>
Tue, 8 Jul 2003 18:05:34 +0000 (18:05 +0000)
committerJoern Rennecke <joern.rennecke@embecosm.com>
Tue, 8 Jul 2003 18:05:34 +0000 (18:05 +0000)
Allow second call from ldemul_finish.

ld/ChangeLog
ld/emultempl/sh64elf.em

index 27af4c8b0bddad7e238a109393fd5a9bb6f2ed64..7dc68c6835c79d6b291734c9e52b669a765e61d9 100644 (file)
@@ -1,3 +1,8 @@
+2003-07-08  J"orn Rennecke <joern.rennecke@superh.com>
+
+       * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_after_allocation):
+       Allow second call from ldemul_finish.
+
 2003-07-04  J"orn Rennecke <joern.rennecke@superh.com>
 
        * emulparams/shelf32.sh (STACK_ADDR): Don't define.
index 3c348fd2fa93c67dbedcf49acc01094e06c546cd..7f2b037df7f596235934b8cc9d08c1eb443de71f 100644 (file)
@@ -375,7 +375,14 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
       }
     }
 
-  BFD_ASSERT (cranges->contents == NULL);
+  /* ldemul_after_allocation may be called twice.  First directly from
+     lang_process, and the second time when lang_process calls ldemul_finish,
+     which calls gld${EMULATION_NAME}_finish, e.g. gldshelf32_finish, which
+     is defined in emultempl/elf32.em and calls ldemul_after_allocation,
+     if bfd_elf${ELFSIZE}_discard_info returned true.  */
+  if (cranges->contents != NULL)
+    free (cranges->contents);
+
   BFD_ASSERT (sh64_elf_section_data (cranges)->sh64_info != NULL);
 
   /* Make sure we have .cranges in memory even if there were only