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
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