[PATCH] D100944: [MC][ELF] Emit separate unique sections for different flags

ben via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 25 08:35:29 PDT 2021


bd1976llvm added a comment.

We have found a problem whist testing this change. We have some internal code that was exploiting the old behaviour:

1. Creates a non-ALLOC section: "inline asm: _asm_(".section debug_special,\"\", at progbits");"
2. Assigns symbols to that section: _attribute((used, section("debug_special")))
3. Uses a linkscript so that the symbols in the section are offsets from the start of the section and the section is not assigned to a phdr: debug_special 0 : { KEEP(*(debug_special)) } : NONE

With this change that no longer works. Instead, the linker creates an ALLOC debug_special section and then that section overlaps with another at address 0 and LLD errors: "lld: error: section debug_special virtual address range overlaps with ...".

I still think that this change is reasonable; but, I'm not sure how to support this code that was exploiting the old behaviour. It might be possible to find a work-around; or, perhaps, to make a fix in another tool. Maybe we could add a linkerscript feature to force the input sections to an output section to be considered non-ALLOC e.g. NOADDR (analogous to the existing NOLOAD).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100944/new/

https://reviews.llvm.org/D100944



More information about the llvm-commits mailing list