1

I need to compile project with custom linker script.

This project is successfully compiled by gcc.

Build fails when I use clang with ld.lld linker.

It fails on linker stage due to the use of "NOCROSSREFS_TO" command, which is used in linker script.

Is it possible to use such a command for ld.lld linker? Any alternatives?

lol lol
  • 319
  • 3
  • 18

1 Answers1

1

No, this command isn't supported.

lol lol
  • 319
  • 3
  • 18
  • It is possible to just comment it out. The purpose is to provide diagnostics. For the most part the linkage between GCC and llvm should be the same; with the exceptions of compiler built-ins. So, if a build is successful with gcc/gnu ld, then there should be no references from 'text' to 'init' and after a system has booted, the 'init' section could be mapped out of memory (or reused for allocation). As per [the ticket](https://github.com/llvm/llvm-project/issues/41825). – artless noise Jul 15 '22 at 14:38
  • 1
    @artlessnoise Yes, this is diagnostic command. However it is useful at compilation step. It is like an assert() function calls in C. – lol lol Jul 16 '22 at 15:17