On Tue, 2 Nov 2021, H.J. Lu wrote:
> On Tue, Nov 2, 2021 at 5:11 AM Jakub Jelinek <ja...@redhat.com> wrote:
>> include/md5.h is a header we have control over, can't we just add to it
>> something like:
>> #ifdef USE_SYSTEM_MD5
>> #include_next <md5.h>
>> #else
>> Current header content
>> #endif
>> and arrange for that macro to be -DUSE_SYSTEM_MD5 when building that
>> libsanitizer source file?
> Gerald, can you try this suggestion?  You can add "#define 
> USE_SYSTEM_MD5" in sanitizer_platform_limits_freebsd.cpp for testing.

Yes, the patch below restores bootstrap on x86_64-unkown-freebsd12.

Okay for now (or does anyone want to / can anyone help with Makefile
trickery to -Define USE_SYSTEM_MD5 there)?

Thanks,
Gerald


include:
        * md5.h (USE_SYSTEM_MD5): Introduce.

libsanitizer:
        * sanitizer_common/sanitizer_platform_limits_freebsd.cpp
        (USE_SYSTEM_MD5): Define.


diff --git a/include/md5.h b/include/md5.h
index 03f7d29afc7..c5bb6076969 100644
--- a/include/md5.h
+++ b/include/md5.h
@@ -21,6 +21,10 @@
 #ifndef _MD5_H
 #define _MD5_H 1
 
+#ifdef USE_SYSTEM_MD5
+#include_next <md5.h>
+#else
+
 #include <stdio.h>
 
 #if defined HAVE_LIMITS_H || _LIBC
@@ -151,4 +155,6 @@ extern void *md5_buffer (const char *buffer, size_t len, 
void *resblock);
 }
 #endif
 
+#endif // USE_SYSTEM_MD5
+
 #endif
diff --git 
a/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp 
b/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
index 64535805e40..a549734efc5 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
@@ -15,6 +15,8 @@
 
 #if SANITIZER_FREEBSD
 
+#define USE_SYSTEM_MD5
+
 #include <sys/capsicum.h>
 #include <sys/consio.h>
 #include <sys/filio.h>

Reply via email to