[lld] [lld/ELF] Warn on conflicting SHF_X86_64_LARGE flag (PR #72335)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 11:11:07 PST 2024


rnk wrote:

> Essentially, this is a lint feature disguised as a warning.

I'm not sure if I agree with this phrasing. I would say this is a warning, but there are some false positive cases. The example Arthur used is to compile with ASan and mix large and small code model objects. Because there are no direct references to asan_globals, the warning is a false positive, it is safe to suppress, there will be no PC32 references to asan_globals.

I think this warning has enough value to land it. Would an option to specifically disable this warning (think `-Wno-x`, `--no-warn-section-flag-mismatch`, however we spell linker warning flags) address the concerns? Are we concerned about the performance cost of the conditional check, or the code complexity?

I think we can address the performance concerns by tweaking the conditionals. We have to check flag section mismatch, which is very rare, and we can outline everything after that as cold code with marginal performance impact.

https://github.com/llvm/llvm-project/pull/72335


More information about the llvm-commits mailing list