Hi GNU ld experts!
This question is related to a StackOverflow discussion, how GNU ld handles architecture mismatches.
When the ELF objects are compiled in a different architecture than the target architecture from GNU ld.
Without passing GNU ld a target architecture, GNU ld detects the architecture in the ELF objects and
link the objects in a binary. If there are some mismatches with the object files, then GNU ld refuse the linking
with an error.
Issue #1
It isn't possible to pass the architecture to ARM GNU ld when passing the architecture via command line.
The option will not recognized and GNU ld abort with an error.
Issue #2
When trying to use a linker script and set the output architecture here, it leads in many errors
with mismatching EABI version. I have tried to find a option how to set the target EBAI version with
GNU ld, but currently didn't find the correct option, if this is possible.
On none-ARM architectures like AVR from Microchip (formerly Atmel) there are no issues with GNU ld
when setting the target architecture.
Confirmed that ld.gold works with OUTPUT_ARCH(armv7e-m). This indicates a bug with GNU ld.
Thank you for the detailed explanation and confirmation!
Should I report this issue back to ARM or to the GNU bug tracker, if this issue isn't known yet?
the GNU bug tracker.
Done.
Here is the link to the bug report.