[PATCH] D93948: [MC] Merge section flags for user defined sections
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 6 12:10:47 PST 2021
MaskRay added a comment.
For sections with incompatible flags, we have 4 choices.
- Error. For certain combinations, they have been errored by Clang (D93102 <https://reviews.llvm.org/D93102>) but the check is not comprehensive. (Note: `SHF_WRITE` and `SHF_EXECINSTR` are not fundamentally incompatible. For instance, ppc32 BSS-PLT .plt section is RWX, but several tools may warn for them (asan security check, selinux and other Linux hardening, OpenBSD hardening, etc))
- Pick the first one. IIRC this is the current behavior in the backend which is not ideal.
- Merge the flags.
- Emit multiple sections.
It is not super clear where to draw a line between error and non-error (this is dependent on the binary format and probably platform preference), but for non-error cases, I feel that we should go toward the direction of D72194 <https://reviews.llvm.org/D72194> (emit multiple sections for different sh_entsize of SHF_MERGE sections) for consistency and simplicity. If we err, multiple sections look better than arbitrarily picking the first (current behavior).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93948/new/
https://reviews.llvm.org/D93948
More information about the llvm-commits
mailing list