[llvm] [BOLT] Err when linking objects of different architectures (PR #66770)

Job Noorman via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 00:49:07 PDT 2023


mtvec wrote:

> Good catch, thanks for the added check. We should err but that doesn't address the rootcause. In principle, we should support something akin to LLVM_RUNTIME_TARGETS.

Indeed, this would be nice. I have been working around this by manually building the runtime library for RISC-V in order to use it on an x86 host. It would be better to integrate this in the build system so I might try this out soon.

> Can you please add a test with x86 host (`REQUIRES: target=x86_64{{.*}}`) instrumenting aarch64 binary?

Done! It was a bit tricky though to produce an AArch64 binary suitable for instrumentation on x86. I had to:
- Force a dummy relocation;
- Add a dummy `_fini` function to force `DT_FINI` to be emitted;
- Link with `-pie` (to avoid a static binary being created).

Please let me know if there's an easier way to accomplish this.

https://github.com/llvm/llvm-project/pull/66770


More information about the llvm-commits mailing list