Fix ld --gc-section segfault with ARMv8-M entry function in absolute section
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Wed, 14 Sep 2016 15:02:17 +0000 (16:02 +0100)
committerThomas Preud'homme <thomas.preudhomme@arm.com>
Wed, 14 Sep 2016 15:03:43 +0000 (16:03 +0100)
bfd/
2016-09-14  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* elf32-arm.c (elf32_arm_gc_mark_extra_sections): Only mark section
not already marked.

ld/
2016-09-14  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* testsuite/ld-arm/cmse-veneers.s: Add a test for ARMv8-M Security
Extensions entry functions in absolute section.
* testsuite/ld-arm/cmse-veneers.rd: Adapt expected output accordingly.

bfd/ChangeLog
bfd/elf32-arm.c
ld/ChangeLog
ld/testsuite/ld-arm/cmse-veneers.rd
ld/testsuite/ld-arm/cmse-veneers.s

index 567e18f195b26fb60fee8d6518fe955770f24d45..b54d0c938ea9ac99f8dde3a499254dd47e2cf246 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-14  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Only mark section
+       not already marked.
+
 2016-09-14  Nick Clifton  <nickc@redhat.com>
 
        PR binutils/20605
index 5275caef164c948f8b73abadf6fb80012e4ea2f2..6e68be1c09d3668e62aed9d6243de01fa23f8f2f 100644 (file)
@@ -14906,7 +14906,8 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info,
                  if (ARM_GET_SYM_CMSE_SPCL (cmse_hash->root.target_internal))
                    {
                      cmse_sec = cmse_hash->root.root.u.def.section;
-                     if (!_bfd_elf_gc_mark (info, cmse_sec, gc_mark_hook))
+                     if (!cmse_sec->gc_mark &&
+                         !_bfd_elf_gc_mark (info, cmse_sec, gc_mark_hook))
                        return FALSE;
                    }
                }
index 2a3db2cb63b3ec6de9dc2184b61a13bbfc8e0933..4bae998e6a6459025d9cb8fe8ac458d273a28103 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-14  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * testsuite/ld-arm/cmse-veneers.s: Add a test for ARMv8-M Security
+       Extensions entry functions in absolute section.
+       * testsuite/ld-arm/cmse-veneers.rd: Adapt expected output accordingly.
+
 2016-09-14  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * testsuite/ld-arc/tls-dtpoff.dd: New file.
index 20fad961bd8803109c3cf57ef22e3b36da5b1500..2f0fa5f9472298650bba51bed2f23b3806fcb894 100644 (file)
@@ -1,4 +1,6 @@
 #...
+[0-9a-f]+ A abs_entry_fct
+#...
 [0-9a-f]+ T glob_entry_fct
 #...
 [0-9a-f]+ T glob_entry_veneer1
index d5c57f646a78c4736e4f084d8ad6aff7efea554f..8346888909cb5f9781e0dd3dce1d57c5988514e6 100644 (file)
@@ -53,6 +53,16 @@ __acle_se_\name:
        @ Valid setup for entry function without SG veneer
        entry glob_entry_fct, function, global, entry_fct=nop
 
+       @ Valid setup for entry function with absolute address
+       .align 2
+       .global __acle_se_abs_entry_fct
+       .global abs_entry_fct
+       .type   __acle_se_abs_entry_fct, %function
+       .type   abs_entry_fct, %function
+__acle_se_abs_entry_fct = 0x10000
+abs_entry_fct = 0x10004
+       .size   abs_entry_fct, 0
+       .size   __acle_se_abs_entry_fct, 0
 .else
        @ Invalid setups for veneer generation (visibility)
        entry loc_entry_veneer1, function, local