On 03/01/2018 12:45 PM, Jakub Jelinek wrote:
> On Thu, Mar 01, 2018 at 12:41:37PM +0100, Martin Liška wrote:
>> I've been running periodically UBSAN bootstrap and as the runtime errors are
>> not causing failure of compiler I haven't noticed the errors.
>> Thus I would like to disable UBSAN recovery. Apart from that I'm handling
>> issue in md5.c where in UBSAN bootstrap we want to do proper pointer 
>> alignment.
>> Doing that 2 will be remaining issues that will block the bootstrap:
>>
>> PR84634 and PR84635
>>
>> May I then install the patch? Jakub what do you think about it?
> 
> I actually prefer recovery where possible, that way we can get more runtime
> errors at once, rather than stopping at the first one.
> You always can and should grep the build logs.

Ok, you convinced me with Marek :)

> 
> As for md5.c, you only posted ChangeLog for it, not the actual patch.

Sorry, I'm attaching updated patch.

Martin

> 
>       Jakub
> 

>From ccf9285022df7a2c11c14e5dc388d668d18243eb Mon Sep 17 00:00:00 2001
From: marxin <mli...@suse.cz>
Date: Thu, 1 Mar 2018 12:13:34 +0100
Subject: [PATCH] Improve boostrap-ubsan config (PR bootstrap/64914).

config/ChangeLog:

2018-03-01  Martin Liska  <mli...@suse.cz>

	PR bootstrap/64914
	* bootstrap-ubsan.mk: Define UBSAN_BOOTSTRAP.

libiberty/ChangeLog:

2018-03-01  Martin Liska  <mli...@suse.cz>

	PR bootstrap/64914
	* md5.c: Use strict alignment with UBSAN_BOOTSTRAP.
---
 config/bootstrap-ubsan.mk | 6 +++---
 libiberty/md5.c           | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/config/bootstrap-ubsan.mk b/config/bootstrap-ubsan.mk
index d2615e8f807..1d85fe1c836 100644
--- a/config/bootstrap-ubsan.mk
+++ b/config/bootstrap-ubsan.mk
@@ -1,8 +1,8 @@
 # This option enables -fsanitize=undefined for stage2 and stage3.
 
-STAGE2_CFLAGS += -fsanitize=undefined
-STAGE3_CFLAGS += -fsanitize=undefined
-POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan \
+STAGE2_CFLAGS += -fsanitize=undefined -DUBSAN_BOOTSTRAP
+STAGE3_CFLAGS += -fsanitize=undefined -DUBSAN_BOOTSTRAP
+POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan -DUBSAN_BOOTSTRAP \
 		      -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ \
 		      -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/ \
 		      -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/.libs
diff --git a/libiberty/md5.c b/libiberty/md5.c
index f106d2262ca..4dd5186a69a 100644
--- a/libiberty/md5.c
+++ b/libiberty/md5.c
@@ -231,7 +231,7 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
   /* Process available complete blocks.  */
   if (len > 64)
     {
-#if !_STRING_ARCH_unaligned
+#if !_STRING_ARCH_unaligned || defined UBSAN_BOOTSTRAP
 /* To check alignment gcc has an appropriate operator.  Other
    compilers don't.  */
 # if __GNUC__ >= 2
-- 
2.16.1

Reply via email to