https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122359
Bug ID: 122359
Summary: Compiling for cortex-m0plus fails with "relocations in
generic ELF"
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: xaver.hugl at kde dot org
Target Milestone: ---
I managed to put together a really minimal example:
example.c:
```
int main()
{
}
```
Just running "/usr/bin/arm-none-eabi-gcc -mcpu=cortex-m0plus example.c" results
in
```
/usr/lib/gcc/arm-none-eabi/15.1.0/../../../../arm-none-eabi/bin/ld:
/usr/lib/gcc/arm-none-eabi/15.1.0/thumb/v6-m/nofp/crtbegin.o: relocations in
generic ELF (EM: 0)
/usr/lib/gcc/arm-none-eabi/15.1.0/../../../../arm-none-eabi/bin/ld:
/usr/lib/gcc/arm-none-eabi/15.1.0/thumb/v6-m/nofp/crtbegin.o: relocations in
generic ELF (EM: 0)
/usr/lib/gcc/arm-none-eabi/15.1.0/../../../../arm-none-eabi/bin/ld:
/usr/lib/gcc/arm-none-eabi/15.1.0/thumb/v6-m/nofp/crtbegin.o: relocations in
generic ELF (EM: 0)
/usr/lib/gcc/arm-none-eabi/15.1.0/../../../../arm-none-eabi/bin/ld:
/usr/lib/gcc/arm-none-eabi/15.1.0/thumb/v6-m/nofp/crtbegin.o: error adding
symbols: file in wrong format
collect2: error: ld returned 1 exit status
```
I narrowed down the sample from the commands run when building the
pico-examples project (https://github.com/raspberrypi/pico-examples), but to be
honest I'm a bit out of my element here. I'm not sure why it complains about
the linker as I'm calling on the compiler; if I should report it elsewhere,
please just point me in the right direction.
Another odd thing possibly worth mentioning is that even just running
"/usr/bin/arm-none-eabi-gcc -mcpu=cortex-m0plus -Wl,--build-id=none" without an
input file yields the same warnings.
I'm on Fedora 43, with arm-none-eabi-gcc (Fedora 15.1.0-3.fc43) 15.1.0.