[lld] Fix build failure of lld/ELF/OutputSections.cpp (PR #70368)

Yaxun Liu via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 17:15:56 PDT 2023


yxsamliu wrote:

> I think zlib is often disabled on Windows, so nobody has noticed for such a long time.
> 
> > On Windows when zlib is enabled, zlib header introduced some C headers which defines max as a macro. Since OutputSections.cpp uses std::max with template argument, this causes compilation error.
> 
> Can you point out where `max` is defined in zlib v2.3.13? A likely better choice is to disable zlib for Windows if a problematic one is found.

zlib header does not define max as a macro, but it includes some windows headers which define max as macro. There is a cleaner way to avoid that by defining a macro NOMINMAX before include zlib.h.

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


More information about the llvm-commits mailing list