bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/27217] New: aarch64 as Internal error in md_apply_fix at ......


From: joel.sherrill at oarcorp dot com
Subject: [Bug gas/27217] New: aarch64 as Internal error in md_apply_fix at ....../gas/config/tc-aarch64.c:8330.
Date: Wed, 20 Jan 2021 16:06:33 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=27217

            Bug ID: 27217
           Summary: aarch64 as Internal error in md_apply_fix at
                    ....../gas/config/tc-aarch64.c:8330.
           Product: binutils
           Version: 2.35
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: joel.sherrill at oarcorp dot com
  Target Milestone: ---

The following C code compiles and assembles cleanly on the other 17
architectures supported by RTEMS. But when compiled at -O2, -O1, and -Os on
aarch64, gcc produces assembly which gives an internal error. Examining the
generated assembly on arm and aarch64, enabling optimization results in the
.set statement being in the top part of the generated assembly versus the
bottom part. This pattern of .set placement is consistent across at least arm
and aarch64.

GCC's behavior related to the start and end of user assembly language comments
also varies based on optimization level. This isn't critical but odd. This type
of comment isn't generated for the arm. 

===========================
extern char bar[];
char * foo(void)
{
        return bar;
}
__asm__ (".set bar, 0");
===========================

$ /home/joel/rtems-work/tools/6/bin/aarch64-rtems6-gcc -c -O2 set.c
/tmp/ccyseDVm.s: Assembler messages:
/tmp/ccyseDVm.s: Internal error in md_apply_fix at
../../sourceware-mirror-binutils-gdb-8807d31/gas/config/tc-aarch64.c:8330.
Please report this bug.

This is the generated assembly so you do not need a full aarch64 toolchain.

===================================
        .arch armv8-a
        .file   "set.c"
        .text
        // Start of user assembly
        .set bar, 0
        // End of user assembly
        .align  2
        .p2align 4,,11
        .global foo
        .type   foo, %function
foo:
        adrp    x0, bar
        add     x0, x0, :lo12:bar
        ret
        .size   foo, .-foo
        .ident  "GCC: (GNU) 10.2.1 20201030 (RTEMS 6, RSB
31dd1ab4424e59e48c60dfa587e805e908d13b02, Newlib 9517e5f)"

===================================

This is the assembly language at -O0 and it assembles successfully:

===================================


        .arch armv8-a
        .file   "set.c"
        .text
        .align  2
        .global foo
        .type   foo, %function
foo:
        adrp    x0, bar
        add     x0, x0, :lo12:bar
        ret
        .size   foo, .-foo
        // Start of user assembly
        .set bar, 0
        .ident  "GCC: (GNU) 10.2.1 20201030 (RTEMS 6, RSB
31dd1ab4424e59e48c60dfa587e805e908d13b02, Newlib 9517e5f)"

===================================

I've confirmed this in the current master as well as an older version I had.
Based on reports from other RTEMS developers, this has been broken a while. I
personally confirmed it in these:

GNU assembler (GNU Binutils) 2.36.50.20210120
GNU assembler (GNU Binutils) 2.35.50.20201102

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]