https://sourceware.org/bugzilla/show_bug.cgi?id=28910
Bug ID: 28910 Summary: GNU-ld: ARM: Issues when trying to set target output architecture Product: binutils Version: 2.36.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: krjdev at gmail dot com Target Milestone: --- I noticed two issues in the ARM port from GNU-ld. It's a special case when the output target is set manually (linker script or command line). When no target output architecture is set, linking of the objects works fine with GNU-ld. Testcase: I used a current project from me which targets a Cortex-M7 (Armv7E-M). GNU-ld is invoked directly within a Makefile, not via GCC. Compiled the source code with the following GCC options: CCFLAGS += -march=armv7e-m CCFLAGS += -mcpu=cortex-m7 Issue #1 - command line with long option "--architecture ARCH" Setting the target output architecture doesn't work with the command line option when using the long format. GNU-ld doesn't recognize the option and aborts with an error. I don't know if this is a real issue or an usage mistake from me when I use the long option instead of the short form. Tried it with... $ arm-none-eabi-ld --architecture armv7e-m arm-none-eabi-ld: Error: unable to disambiguate: --architecture (did you mean ---architecture ?) ...and... arm-none-eabi-ld --architecture=armv7e-m arm-none-eabi-ld: Error: unable to disambiguate: --architecture=armv7e-m (did you mean ---architecture=armv7e-m ?) Works with the short form: $ arm-none-eabi-ld -A armv7e-m Issue #2 - linker script If I don't use the working short form for setting the target output architecture and use a linker script instead with... OUTPUT_ARCH(armv7e-m) ...linking fails with many EABI version mismatches errors: arm-none-eabi-ld: error: source object main.o has EABI version 5, but target main_cm7.elf has EABI version 0 arm-none-eabi-ld: failed to merge target specific data of file main.o The linking fails with GNU-ld, but works when I use GNU-gold instead. An ARM developer community member has also confirmed this behavior. Affected version: 2.36.1.20210621 $ arm-none-eabi-ld --version GNU ld (GNU Arm Embedded Toolchain 10.3-2021.07) 2.36.1.20210621 I currently haven't build GNU ld from the actually source code, so I don't know if these issues are known or already fixed. Will make up this later. The tried version was the binary build from the ARM homepage. References: ARM developer Community: https://community.arm.com/support-forums/f/compilers-and-libraries-forum/52304/arm-none-eabi-ld-cannot-set-target-architecture StackOverflow: https://stackoverflow.com/questions/71188898/gnu-ld-warn-about-mismatching-arm-architecture-version -- You are receiving this mail because: You are on the CC list for the bug.