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

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 17:02:06 PST 2019


rjmccall added a comment.

> So I don't think we should even be trying to mark sections as mergeable unless we walk all elements in the section and make sure it's even safe to apply these.

That's the conservative fix, yes.  You can either:

1. emit global objects with the same section name into a single section unit and then set the mergeable flag and entry size for that unit only if all the objects were mergeable and the same size, or
2. emit global objects with the same section name into different section units based on their mergeability and entry size.

If the code isn't already set up to emit multiple section units with a name — which implies that there may also be an existing bug based on having mergeable and non-mergeable symbols with the same section name — then the former is probably much simpler.  But if it's already set up to split into two section units, I can't imagine it'd be that difficult to split into more than two.


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

https://reviews.llvm.org/D68101





More information about the cfe-commits mailing list