lkml.org 
[lkml]   [2020]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants"


On 2020-08-31, Nathan Chancellor wrote:
>On Mon, Aug 31, 2020 at 05:23:21PM -0700, Nick Desaulniers wrote:
>> This reverts commit 87e0d4f0f37fb0c8c4aeeac46fff5e957738df79.
>>
>> This was fixed in clang-6; the minimum supported version of clang in the
>> kernel is clang-10 (10.0.1).
>>
>> Link: https://reviews.llvm.org/rL329300.
>> Link: https://github.com/ClangBuiltLinux/linux/issues/9
>> Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
>> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
>
>Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

How about expanding "This was fixed in clang-6" to be
-fno-merge-all-constants has been the default since clang-6?

(Both gcc|clang -fmerge-all-constants can cause an assertion failure for
the example on https://bugs.llvm.org/show_bug.cgi?id=18538 )

Reviewed-by: Fangrui Song <maskray@google.com>

>> ---
>> Makefile | 9 ---------
>> 1 file changed, 9 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 37739ee53f27..144ac6a073ff 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -932,15 +932,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
>> # disable invalid "can't wrap" optimizations for signed / pointers
>> KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
>>
>> -# clang sets -fmerge-all-constants by default as optimization, but this
>> -# is non-conforming behavior for C and in fact breaks the kernel, so we
>> -# need to disable it here generally.
>> -KBUILD_CFLAGS += $(call cc-option,-fno-merge-all-constants)
>> -
>> -# for gcc -fno-merge-all-constants disables everything, but it is fine
>> -# to have actual conforming behavior enabled.
>> -KBUILD_CFLAGS += $(call cc-option,-fmerge-constants)
>> -
>> # Make sure -fstack-check isn't enabled (like gentoo apparently did)
>> KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,)
>>
>> --
>> 2.28.0.402.g5ffc5be6b7-goog
>>
>
>--
>You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200901045516.GA1561318%40ubuntu-n2-xlarge-x86.

\
 
 \ /
  Last update: 2020-09-01 19:09    [W:2.263 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site