https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118715
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |arm
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
00000124 <foo@plt>:
124: 0000 movs r0, r0
126: 0000 movs r0, r0
128: f241 0c88 movw ip, #4232 @ 0x1088
12c: f2c0 0c00 movt ip, #0
130: 44fc add ip, pc
132: Address 0x132 is out of bounds.
Disassembly of section .text:
00000134 <_start>:
134: f7ff bff8 b.w 128 <foo@plt+0x4>
What GCC produces is:
```
.cpu cortex-m4
.arch armv7e-m
.fpu softvfp
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 1
.eabi_attribute 30, 2
.eabi_attribute 34, 1
.file "<artificial>"
.text
.align 1
.p2align 2,,3
.global _start
.cpu cortex-m4
.arch armv7e-m
.fpu softvfp
.syntax unified
.thumb
.thumb_func
.type _start, %function
_start:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
b foo(PLT)
.size _start, .-_start
.ident "GCC: (Arm GNU Toolchain 14.2.Rel1 (Build arm-14.52)) 14.2.1
20241119"
.cpu cortex-m4
.arch armv7e-m
.fpu softvfp
```
Looks like it is generating a sibcall which might be invalid.
Without LTO it does not generate a sibcall.
Anyways this is a target issue.