[PATCH] D24388: [ELF] Merge sections with different access attributes

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 12 23:57:55 PDT 2016


evgeny777 added a comment.

AFAIK, the main problem was linker script putting mergeable and non-mergeable to the same output section. This is really bad and should be avoided. However we're not living in ideal world and linker scripts putting RX and RW input sections to the same output section do exist. Things get worse when you use assignments:

  .mysec : {
     *(.text)
     *(.data)
     . = ALIGN(0x1000);
  }

Needless to say that lld will align second .mysec section, leaving the first one as is. Currently the only way lld allows putting code and data together is using PHDRS and single PT_LOAD for both. However nothing can be done to handle the case above correctly.

May be it makes sense to enable R/W/X merging only for linker script case for now?


Repository:
  rL LLVM

https://reviews.llvm.org/D24388





More information about the llvm-commits mailing list