This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

arm-none-eabi-ld: Cannot set target architecture

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.

Parents
  • Check the section 'Secondary compatibility tag' in the ABI errata doc. Check the source code for ld.

    If one tries to link armv4 and armv6-m, that fails. The ld source code for arm does explicitly deal with compatibility of differing arm architectures, perhaps guided by the ABI.

    The author of the stackoverflow article writes:

    Long: I just learned that ld has no issues or concerns about linking an armv4 object into an armv6-m binary despite this beeing very obvious nonsense"

    But in their update, they were actually linking arm4t+armv6-m, and not armv4+armv6-m as they originally described. The test shows that armv4+armv6-m fails. And armv4t+armv6-m is considered compatible, as the ABI errata says:

    At this release of the ABI (2019Q4) there are only two defined uses of Tag_also_compatible_with:

    To express v4T also compatible with v6-M and v6-M also compatible with v4T.

    Thus, it seems that the linker is working as expected, and I fail to see an issue.

    Did they check the behaviour of gold/mold/lld?

    If this compatibility is such an obvious error, they should open a support case with Arm to have the ABI rectified. Once the ABI is corrected, the linkers will be too.

Reply
  • Check the section 'Secondary compatibility tag' in the ABI errata doc. Check the source code for ld.

    If one tries to link armv4 and armv6-m, that fails. The ld source code for arm does explicitly deal with compatibility of differing arm architectures, perhaps guided by the ABI.

    The author of the stackoverflow article writes:

    Long: I just learned that ld has no issues or concerns about linking an armv4 object into an armv6-m binary despite this beeing very obvious nonsense"

    But in their update, they were actually linking arm4t+armv6-m, and not armv4+armv6-m as they originally described. The test shows that armv4+armv6-m fails. And armv4t+armv6-m is considered compatible, as the ABI errata says:

    At this release of the ABI (2019Q4) there are only two defined uses of Tag_also_compatible_with:

    To express v4T also compatible with v6-M and v6-M also compatible with v4T.

    Thus, it seems that the linker is working as expected, and I fail to see an issue.

    Did they check the behaviour of gold/mold/lld?

    If this compatibility is such an obvious error, they should open a support case with Arm to have the ABI rectified. Once the ABI is corrected, the linkers will be too.

Children