On Thu, Oct 7, 2021 at 2:41 PM Gerald Pfeifer <ger...@pfeifer.com> wrote:
>
> On Wed, 6 Oct 2021, H.J. Lu via Gcc-patches wrote:
> > I am checking in these patches to merge with upstream commit:
>
> Thus breaking bootstrap on FreeBSD:
>
> GCC-HEAD/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp:370:36:
>  error: 'MD5_CTX' was not declared in this scope
>   370 | const unsigned MD5_CTX_sz = sizeof(MD5_CTX);
>       |                                    ^~~~~~~
> GCC-HEAD/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp:371:36:
>  error:
> 'MD5_DIGEST_STRING_LENGTH' was not declared in this scope; did you mean
> 'SHA256_DIGEST_STRING_LENGTH'?
>   371 | const unsigned MD5_return_length = MD5_DIGEST_STRING_LENGTH;
>       |                                    ^~~~~~~~~~~~~~~~~~~~~~~~
>       |                                    SHA256_DIGEST_STRING_LENGTH
>
> I stared the the sources for minutes and FreeBSD include files and could
> not find what was wrong.

compiler-rt sync brought in

commit 18a7ebda99044473fdbce6376993714ff54e6690
Author: David Carlier <devne...@gmail.com>
Date:   Wed Oct 6 06:01:50 2021 +0100

    [Sanitizers] intercept md5 and sha* apis on FreeBSD.

    Reviewed By: vitalybuka

    Differential Revision: https://reviews.llvm.org/D110989

diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
 b/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
index bfe3eea464d..64535805e40 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
@@ -69,6 +69,11 @@
 #include <semaphore.h>
 #include <signal.h>
 #include <stddef.h>
+#include <md5.h>
+#include <sha224.h>
+#include <sha256.h>
+#include <sha384.h>
+#include <sha512.h>
 #include <stdio.h>
 #include <stringlist.h>
 #include <term.h>
@@ -361,6 +366,22 @@ const int si_SEGV_MAPERR = SEGV_MAPERR;
 const int si_SEGV_ACCERR = SEGV_ACCERR;
 const int unvis_valid = UNVIS_VALID;
 const int unvis_validpush = UNVIS_VALIDPUSH;
+
+const unsigned MD5_CTX_sz = sizeof(MD5_CTX);
+const unsigned MD5_return_length = MD5_DIGEST_STRING_LENGTH;
+
+#define SHA2_CONST(LEN)                                                      \
+  const unsigned SHA##LEN##_CTX_sz = sizeof(SHA##LEN##_CTX);                 \
+  const unsigned SHA##LEN##_return_length = SHA##LEN##_DIGEST_STRING_LENGTH; \
+  const unsigned SHA##LEN##_block_length = SHA##LEN##_BLOCK_LENGTH;          \
+  const unsigned SHA##LEN##_digest_length = SHA##LEN##_DIGEST_LENGTH
+
+SHA2_CONST(224);
+SHA2_CONST(256);
+SHA2_CONST(384);
+SHA2_CONST(512);
+
+#undef SHA2_CONST
 }  // namespace __sanitizer

Does compiler-rt compile on FreeBSD?  If not, please file a compiler-rt bug.
If yes, why doesn't it work in GCC?

> Then I realized: GCC has its own include/md5 which misses some of these!
>
>
> Looking how old md5 is (and deprecated) I cannot help wonder whether you
> merged something that wasn't new, but intentionally left out originally?
>
> Or include paths are broken.
>
>
> Gerald
>
>
> PS: At this point I am counting about *seven* distinct bootstrap
> breakages on my nightly testers in the last six weeks or so. :-(



-- 
H.J.

Reply via email to