[PATCH] D93948: [MC] Merge section flags for user defined sections

Tomas Matheson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 30 09:57:48 PST 2020


tmatheson created this revision.
Herald added a subscriber: hiraditya.
tmatheson requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When placing global variables in a previously encountered user defined
section, check that the flags for the new global variable are compatible
with the existing flags on the section, and emit an error if not.
Otherwise, update the section flags with the union of the new and old
flags and emit a remark.

I am not sure if this is the correct approach to take and would welcome
any feedback.

There is already some mitigation for this in clang (e.g.
https://reviews.llvm.org/D93102). However, the problem could still arise
when the global variables are in separate translation units and LTO was enabled.

Some previous discussion about merging sections with values of different size
can be found here:

  https://bugs.llvm.org/show_bug.cgi?id=43627
  https://reviews.llvm.org/D72194
  https://reviews.llvm.org/D68101


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93948

Files:
  llvm/include/llvm/MC/MCObjectFileInfo.h
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/test/CodeGen/AArch64/aarch64-section-flags-incompatible.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93948.314130.patch
Type: text/x-patch
Size: 10784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201230/45622907/attachment.bin>


More information about the llvm-commits mailing list