ARM STM32L4XX erratum test failure

Alan Modra amodra@gmail.com
Thu May 16 13:43:00 GMT 2019


On Thu, May 16, 2019 at 10:34:35PM +0930, Alan Modra wrote:
> On Thu, May 16, 2019 at 12:19:31PM +0000, Szabolcs Nagy wrote:
> > On 15/05/2019 08:13, Alan Modra wrote:
> > > Fixes a failure seen with MALLOC_PERTURB_=1.  Applied.
> > > 
> > > 	* elf32-arm.c (elf32_arm_write_section): Don't leave
> > > 	error case of STM32L4XX_ERRATUM_BRANCH_TO_VENEER with
> > > 	unitialised section contents.
> > 
> > since this commit on arm targets i see
> > 
> > FAIL: STM32L4XX erratum : LDM cannot be patched when LDM is too far from veneer section
> 
> Oh wow, looks like I didn't test the "fix" at all.  Reverting.

The fix of course needs to be on the STM32L4XX_ERRATUM_VENEER case
below the one I patched, or simply init the entire contents.

We use this approach in most backend size_dynamic_sections (including
ARM).  I'll hold off committing this in case the ARM maintainers might
like to implement a more elegant solution.

	* elf32-arm.c (arm_allocate_glue_section_space): Initialise
	section contents.

diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 337961d26e..d459561a9d 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -7222,7 +7222,7 @@ arm_allocate_glue_section_space (bfd * abfd, bfd_size_type size, const char * na
   s = bfd_get_linker_section (abfd, name);
   BFD_ASSERT (s != NULL);
 
-  contents = (bfd_byte *) bfd_alloc (abfd, size);
+  contents = (bfd_byte *) bfd_zalloc (abfd, size);
 
   BFD_ASSERT (s->size == size);
   s->contents = contents;

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list