[gcc(refs/vendors/ARM/heads/morello)] aarch64: Fix ICEs in aarch64_elf_asm_{con, de}structor

Matthew Malcomson matmal01@gcc.gnu.org
Tue Sep 21 09:14:20 GMT 2021


https://gcc.gnu.org/g:19157f82ada66b6fee464024f7551af79c4b94d6

commit 19157f82ada66b6fee464024f7551af79c4b94d6
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Wed Sep 1 14:10:12 2021 +0100

    aarch64: Fix ICEs in aarch64_elf_asm_{con,de}structor
    
    These functions were calling assemble_integer on capabilities. Fix by
    calling assemble_addr_to_section instead.
    
    Since assemble_pointer should handle the alignment, we can drop the
    calls to assemble_align both in the aarch64 backend functions and in
    assemble_addr_to_section.
    
    gcc/ChangeLog:
    
            * config/aarch64/aarch64.c (aarch64_elf_asm_constructor): Use
            assemble_addr_to_section.
            (aarch64_elf_asm_destructor): Likewise.
            * varasm.c (assemble_addr_to_section): Drop call to
            assemble_align.

Diff:
---
 gcc/config/aarch64/aarch64.c | 8 ++------
 gcc/varasm.c                 | 1 -
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index e924a94f048..126782246bf 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -11398,9 +11398,7 @@ aarch64_elf_asm_constructor (rtx symbol, int priority)
       char buf[23];
       snprintf (buf, sizeof (buf), ".init_array.%.5u", priority);
       s = get_section (buf, SECTION_WRITE | SECTION_NOTYPE, NULL);
-      switch_to_section (s);
-      assemble_align (POINTER_SIZE);
-      assemble_aligned_integer (POINTER_BYTES, symbol);
+      assemble_addr_to_section (symbol, s);
     }
 }
 
@@ -11418,9 +11416,7 @@ aarch64_elf_asm_destructor (rtx symbol, int priority)
       char buf[23];
       snprintf (buf, sizeof (buf), ".fini_array.%.5u", priority);
       s = get_section (buf, SECTION_WRITE | SECTION_NOTYPE, NULL);
-      switch_to_section (s);
-      assemble_align (POINTER_SIZE);
-      assemble_aligned_integer (POINTER_BYTES, symbol);
+      assemble_addr_to_section (symbol, s);
     }
 }
 
diff --git a/gcc/varasm.c b/gcc/varasm.c
index b5e07e6fcf4..d5f41d5ec25 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1578,7 +1578,6 @@ void
 assemble_addr_to_section (rtx symbol, section *sec)
 {
   switch_to_section (sec);
-  assemble_align (POINTER_SIZE);
   assemble_pointer (symbol);
 }


More information about the Gcc-cvs mailing list