Search code examples
clinkerarm

Embedding resources into executable using GCC on Arm?


I've used the following linker command to convert a TensorFlow model file myv2.tflite to "dummy" object file myv2.o, so that I can link it into an executable, to avoid having to drag this file separately:

ld --relocatable --format=binary --output=myv2.o myv2.tflite

I've done this on Ubuntu x86_64. However, I will need to do the same for Arm. I suppose I cannot reuse the same myv2.o? Do I have to regenerate the file on Arm using ld from an appropriate Arm toolchain?


Solution

  • I suppose I cannot reuse the same myv2.o?

    You can't that; file is an ELF 64bit x86_64 ABI object file, you need it for your target architecture

    Do I have to regenerate the file on Arm

    no, there's no reason ld needs to run on an ARM machine,

    using ld from an appropriate Arm toolchain?

    exactly, just replace ld with your correctly targeting linker, e.g. arm-none-eabi-ld if this is for baremetal. Again, this is normal cross-development: no need to run on the target architecture, just build for the target architecture.