lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221013204151.skzateatn2keencb@google.com>
Date:   Thu, 13 Oct 2022 13:41:51 -0700
From:   Fangrui Song <maskray@...gle.com>
To:     Nathan Chancellor <nathan@...nel.org>
Cc:     Nick Desaulniers <ndesaulniers@...gle.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Michal Marek <michal.lkml@...kovi.net>,
        Tom Rix <trix@...hat.com>, linux-kbuild@...r.kernel.org,
        linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] kbuild: add -fno-discard-value-names to cmd_cc_ll_c

On 2022-10-13, Nathan Chancellor wrote:
>On Fri, Oct 07, 2022 at 01:32:36PM -0700, Nick Desaulniers wrote:
>> When debugging LLVM IR, it can be handy for clang to not discard value
>> names used for local variables and parameters. Compare the generated IR.
>>
>> Implicit Default (-fdiscard-value-names):
>>   define i32 @core_sys_select(i32 %0, ptr %1, ptr %2, ptr %3, ptr %4) {
>>     %6 = alloca i64
>>     %7 = alloca %struct.poll_wqueues
>>     %8 = alloca [64 x i32]
>>
>> Explicit -fno-discard-value-names:
>>   define i32 @core_sys_select(i32 %n, ptr %inp, ptr %outp, ptr %exp,
>>                               ptr %end_time) {
>>     %expire.i = alloca i64
>>     %table.i = alloca %struct.poll_wqueues
>>     %stack_fds = alloca [64 x i32]
>>
>> The rule for generating human readable LLVM IR (.ll) is only useful as a
>> debugging feature:
>>
>> $ make LLVM=1 fs/select.ll
>>
>> Clang defaults to -fdiscard-value-names to save memory when generating
>> LLVM IR. For debugging purposes, the improvement in readability at a
>> cost of more verbose IR is a cost we're happy to pay.

A LLVM_ENABLE_ASSEERTIONS=off build of Clang defaults to -fdiscard-value-names.

A LLVM_ENABLE_ASSEERTIONS=on build of Clang defaults to -fno-discard-value-names.

See clang/lib/Driver/ToolChains/Clang.cpp:5030

>> Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
>
>Thanks for the patch!
>
>Link: https://github.com/ClangBuiltLinux/linux/issues/1467
>Reviewed-by: Nathan Chancellor <nathan@...nel.org>

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

>> ---
>>  scripts/Makefile.build | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
>> index 27be77c0d6d8..d0e4f476dfee 100644
>> --- a/scripts/Makefile.build
>> +++ b/scripts/Makefile.build
>> @@ -140,7 +140,7 @@ $(obj)/%.symtypes : $(src)/%.c FORCE
>>  # LLVM assembly
>>  # Generate .ll files from .c
>>  quiet_cmd_cc_ll_c = CC $(quiet_modtag)  $@
>> -      cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -o $@ $<
>> +      cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -fno-discard-value-names -o $@ $<
>>
>>  $(obj)/%.ll: $(src)/%.c FORCE
>>  	$(call if_changed_dep,cc_ll_c)
>>
>> base-commit: 93ed07a23fd08b8613f64cf0a15d7fbdaca010fd
>> --
>> 2.38.0.rc2.412.g84df46c1b4-goog
>>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ