Skip to content

Commit 27d713b

Browse files
committed
Fix build failure of lld/ELF/OutputSections.cpp
On Windows when zlib is enabled, zlib header introduced some Windows headers which defines max as a macro. Since OutputSections.cpp uses std::max with template argument, this causes compilation error. Define NOMINMAX before include zlib header to avoid introducing max as a macro.
1 parent 7caff73 commit 27d713b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lld/ELF/OutputSections.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "llvm/Support/Path.h"
2323
#include "llvm/Support/TimeProfiler.h"
2424
#if LLVM_ENABLE_ZLIB
25+
// Avoid introducing max as a macro from Windows headers.
26+
#define NOMINMAX
2527
#include <zlib.h>
2628
#endif
2729
#if LLVM_ENABLE_ZSTD

0 commit comments

Comments
 (0)