diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn --- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn @@ -46,6 +46,10 @@ # Iterate unordered llvm containers in reverse. llvm_enable_reverse_iteration = false + + # glibc is at least 2.33 which has mallinfo2. + # TODO: remove this once nobody using the gn build is building against an old glibc. + llvm_have_mallinfo2 = false } write_cmake_config("abi-breaking") { @@ -142,7 +146,6 @@ "HAVE_LINK_H=1", "HAVE_LSEEK64=1", "HAVE_MALLINFO=1", - "HAVE_MALLINFO2=1", "HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1", ] } else { @@ -151,7 +154,6 @@ "HAVE_LINK_H=", "HAVE_LSEEK64=", "HAVE_MALLINFO=", - "HAVE_MALLINFO2=", "HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=", ] } @@ -322,6 +324,12 @@ } else { values += [ "LLVM_ENABLE_LIBXML2=" ] } + + if (llvm_have_mallinfo2) { + values += [ "HAVE_MALLINFO2=1" ] + } else { + values += [ "HAVE_MALLINFO2=" ] + } } write_cmake_config("llvm-config") {