[PATCH] D133099: [LLD][COFF] Add load config checks to warn if incorrect for CFGuard
Alvin Wong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 7 06:47:17 PDT 2022
alvinhochun added inline comments.
================
Comment at: lld/COFF/Writer.cpp:2123
+ uint8_t *symBuf = secBuf + (b->getRVA() - sec->getRVA());
+ if (!isAligned(Align(config->is64() ? 8 : 4), b->getRVA()))
+ warn("'_load_config_used' may be misaligned (RVA is 0x" +
----------------
mstorsjo wrote:
> Do you think it would be worthwhile to check that the section chunk itself also has got the right alignment? Since even if the section doesn't flag the right required alignment, we can accidentally end up on a correctly aligned RVA anyway.
Initially I was only concerned about giving the user some insight to help with the mysterious "This app can't run on your PC" message that appears when you try to run the executable. My thinking is that if it happens to end up aligned correctly then the final executable will still work and the warning isn't needed...
A check for the actual alignment of the section chunk would be nice to have, but I suspect it may be a bit tricky to implement correctly.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133099/new/
https://reviews.llvm.org/D133099
More information about the llvm-commits
mailing list