[PATCH] D68101: [MC][ELF] Prevent globals with an explicit section from being mergeable

ben via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 2 16:59:52 PST 2020


bd1976llvm added a comment.

Sorry for the delay in updating this.

I hoped to post an updated patch today for this but I realized that I first need to investigate whether section relative references might interact badly with multiple sections with the same name.. I will be able to update the patch tomorrow.

Below is the code comment from the new patch explaining the new approach, please take a look and see if you have any questions/comments:

  // If two globals with differing sizes end up in the same mergeable
  // section that section can be assigned an incorrect entry size. Normally,
  // the assembler avoids this by putting incompatible globals into
  // differently named sections. However, globals can be explicitly assigned
  // to a section by specifying the section name. In this case, if unique
  // section names are available (-unique-section-names in LLVM) then we
  // bin compatible globals into different mergeable sections with the same name.
  // Otherwise, if incompatible globals have been explicitly assigned to section by a
  // fine-grained/per-symbol mechanism (e.g. via  _attribute_((section(“myname”)))) then
  // we issue an error and the user can then change the section assignment. If the
  // section assignment is not via a fine-grained means (e.g. via pragma clang section)
  // then we simply do not make the resulting section mergeable as there is nothing
  // that the user can easily change to fix the resulting problem.


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

https://reviews.llvm.org/D68101





More information about the cfe-commits mailing list