[stage4] Fix type for .init_array.* and .fini_array.* sections

Message ID 59409543-3f31-2c7b-394d-3fb9073acd5d@foss.arm.com
State New
Headers show

Commit Message

Thomas Preudhomme April 19, 2017, 9:21 a.m.
Stage 4 ping?

Best regards,

Thomas

On 11/04/17 18:35, Thomas Preudhomme wrote:
> Hi,
>
> Several tests started failing for ARM targets (eg. gcc.dg/initpri1.c)
> after change 6f9dbcd42f2cf034a9a21f46842c08d2e88449db in binutils. This
> is because the non-default priority init_array and fini_array sections
> are not created with NOTYPE flag as is the case for default priority
> init_array and fini_array sections (see default_section_type_flags in
> varasm.c for instance). This patch fixes the issue.
>
> ChangeLog entry is as follows:
>
> *** gcc/ChangeLog ***
>
> 2017-04-11  Thomas Preud'homme  <thomas.preudhomme@arm.com>
>
>     * config/arm/arm.c (arm_elf_asm_cdtor): Create non-default
>     priority .init_array and .fini_array section with SECTION_NOTYPE
>     flag.
>
> Testing: with this patch test gcc.dg/initpri1.c succeeds but fails
> without.
>
> Is this ok for stage4?
>
> Best regards,
>
> Thomas

Patch

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index a2d80cfd645928fb8b3178a8e0c7173adce5d598..f3a6b64b16896e82d6e7a66726a929f0572542d9 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -22593,7 +22593,7 @@  arm_elf_asm_cdtor (rtx symbol, int priority, bool is_ctor)
       sprintf (buf, "%s.%.5u",
 	       is_ctor ? ".init_array" : ".fini_array",
 	       priority);
-      s = get_section (buf, SECTION_WRITE, NULL_TREE);
+      s = get_section (buf, SECTION_WRITE | SECTION_NOTYPE, NULL_TREE);
     }
   else if (is_ctor)
     s = ctors_section;