Issue 135487
Summary [aarch64][x86] llvm keep .rodata..L__const section
Labels new issue
Assignees
Reporter guoxin049
    https://godbolt.org/z/oTqx9jKzb
Option is: `-O2 -g0 -mgeneral-regs-only -fdata-sections -ffunction-sections`

```
void test(void)
{
    char tmp_str2[20]="te0000";

    __asm__ volatile ("":"+m"(tmp_str2)::);
}
```
AArch64 ASM:
```
test:
 sub	sp, sp, #0x20
 mov	x8, #0x6574                	// #25972
 str	wzr, [sp, #24]
 add	x9, sp, #0x8
 movk	x8, #0x3030, lsl #16
 movk	x8, #0x3030, lsl #32
 stp	x8, xzr, [sp, #8]
 add	sp, sp, #0x20
 ret
```
x86 ASM:
```
test:
 movabs rax,0x303030306574
 mov    QWORD PTR [rsp-0x18],rax
 mov    DWORD PTR [rsp-0x8],0x0
 mov    QWORD PTR [rsp-0x10],0x0
 ret
```
Segment info:
```
***
[ 4] .rodata..L__const.test.tmp_str2 PROGBITS   
***
```

AArch64 uses mov and movk for loading constants, whereas x86 generates movabs for the same purpose. Is the .rodata..L__const.test.tmp_str2 segment required, or can it be removed?
Similar issues:https://github.com/llvm/llvm-project/issues/133684
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to