From 4f90d84b2f2995829d6af475077598d45ef1d127 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Wed, 14 Sep 2016 16:02:17 +0100 Subject: [PATCH] Fix ld --gc-section segfault with ARMv8-M entry function in absolute section bfd/ 2016-09-14 Thomas Preud'homme * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Only mark section not already marked. ld/ 2016-09-14 Thomas Preud'homme * 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 | 5 +++++ bfd/elf32-arm.c | 3 ++- ld/ChangeLog | 6 ++++++ ld/testsuite/ld-arm/cmse-veneers.rd | 2 ++ ld/testsuite/ld-arm/cmse-veneers.s | 10 ++++++++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 567e18f195b..b54d0c938ea 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2016-09-14 Thomas Preud'homme + + * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Only mark section + not already marked. + 2016-09-14 Nick Clifton PR binutils/20605 diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 5275caef164..6e68be1c09d 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -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; } } diff --git a/ld/ChangeLog b/ld/ChangeLog index 2a3db2cb63b..4bae998e6a6 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2016-09-14 Thomas Preud'homme + + * 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 * testsuite/ld-arc/tls-dtpoff.dd: New file. diff --git a/ld/testsuite/ld-arm/cmse-veneers.rd b/ld/testsuite/ld-arm/cmse-veneers.rd index 20fad961bd8..2f0fa5f9472 100644 --- a/ld/testsuite/ld-arm/cmse-veneers.rd +++ b/ld/testsuite/ld-arm/cmse-veneers.rd @@ -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 diff --git a/ld/testsuite/ld-arm/cmse-veneers.s b/ld/testsuite/ld-arm/cmse-veneers.s index d5c57f646a7..8346888909c 100644 --- a/ld/testsuite/ld-arm/cmse-veneers.s +++ b/ld/testsuite/ld-arm/cmse-veneers.s @@ -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 -- 2.30.2