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

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 17:57:11 PST 2020


rjmccall added a comment.

The solution described in that comment is not acceptable.  We are not going to tell users that they cannot assign symbols explicitly to sections because LLVM is unable to promise not to miscompile if they do.  It is LLVM's responsibility to correctly compile valid code; enabling mergeability for a section containing `unnamed_addr` symbols is an optimization, and if it is not safe, it needs to be disabled until we can figure out a way to make it safe.

I laid out a series of three options before:

- Emit different object-file sections for different mergeability settings.
- Only mark an object-file section as mergeable if all the symbols in it would have the same mergeability settings.
- Stop implicitly using mergeability for "ordinary" sections (i.e. sections other than the string section).

Did you investigate these?


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

https://reviews.llvm.org/D68101





More information about the llvm-commits mailing list