* [PATCH v2] dynamic_debug: Use address-of operator on section symbols
@ 2020-02-20 5:13 Nathan Chancellor
2020-03-19 1:59 ` Nathan Chancellor
0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2020-02-20 5:13 UTC (permalink / raw)
To: Jason Baron
Cc: linux-kernel, clang-built-linux, Nathan Chancellor, Nick Desaulniers
Clang warns:
../lib/dynamic_debug.c:1034:24: warning: array comparison always
evaluates to false [-Wtautological-compare]
if (__start___verbose == __stop___verbose) {
^
1 warning generated.
These are not true arrays, they are linker defined symbols, which are
just addresses. Using the address of operator silences the warning and
does not change the resulting assembly with either clang/ld.lld or
gcc/ld (tested with diff + objdump -Dr).
Link: https://github.com/ClangBuiltLinux/linux/issues/894
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
v1 -> v2: https://lore.kernel.org/lkml/20200219045423.54190-5-natechancellor@gmail.com/
* No longer a series because there is no prerequisite patch.
* Use address-of operator instead of casting to unsigned long.
lib/dynamic_debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index aae17d9522e5..8f199f403ab5 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1031,7 +1031,7 @@ static int __init dynamic_debug_init(void)
int n = 0, entries = 0, modct = 0;
int verbose_bytes = 0;
- if (__start___verbose == __stop___verbose) {
+ if (&__start___verbose == &__stop___verbose) {
pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n");
return 1;
}
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] dynamic_debug: Use address-of operator on section symbols
2020-02-20 5:13 [PATCH v2] dynamic_debug: Use address-of operator on section symbols Nathan Chancellor
@ 2020-03-19 1:59 ` Nathan Chancellor
2020-03-19 20:03 ` Jason Baron
0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2020-03-19 1:59 UTC (permalink / raw)
To: Jason Baron; +Cc: linux-kernel, clang-built-linux, Nick Desaulniers
On Wed, Feb 19, 2020 at 10:13:20PM -0700, Nathan Chancellor wrote:
> Clang warns:
>
> ../lib/dynamic_debug.c:1034:24: warning: array comparison always
> evaluates to false [-Wtautological-compare]
> if (__start___verbose == __stop___verbose) {
> ^
> 1 warning generated.
>
> These are not true arrays, they are linker defined symbols, which are
> just addresses. Using the address of operator silences the warning and
> does not change the resulting assembly with either clang/ld.lld or
> gcc/ld (tested with diff + objdump -Dr).
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/894
> Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> v1 -> v2: https://lore.kernel.org/lkml/20200219045423.54190-5-natechancellor@gmail.com/
>
> * No longer a series because there is no prerequisite patch.
> * Use address-of operator instead of casting to unsigned long.
>
> lib/dynamic_debug.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index aae17d9522e5..8f199f403ab5 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -1031,7 +1031,7 @@ static int __init dynamic_debug_init(void)
> int n = 0, entries = 0, modct = 0;
> int verbose_bytes = 0;
>
> - if (__start___verbose == __stop___verbose) {
> + if (&__start___verbose == &__stop___verbose) {
> pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n");
> return 1;
> }
> --
> 2.25.1
>
Gentle ping for review/acceptance.
Cheers,
Nathan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] dynamic_debug: Use address-of operator on section symbols
2020-03-19 1:59 ` Nathan Chancellor
@ 2020-03-19 20:03 ` Jason Baron
2020-03-19 21:43 ` Nathan Chancellor
0 siblings, 1 reply; 4+ messages in thread
From: Jason Baron @ 2020-03-19 20:03 UTC (permalink / raw)
To: Nathan Chancellor
Cc: linux-kernel, clang-built-linux, Nick Desaulniers, Andrew Morton
On 3/18/20 9:59 PM, Nathan Chancellor wrote:
> On Wed, Feb 19, 2020 at 10:13:20PM -0700, Nathan Chancellor wrote:
>> Clang warns:
>>
>> ../lib/dynamic_debug.c:1034:24: warning: array comparison always
>> evaluates to false [-Wtautological-compare]
>> if (__start___verbose == __stop___verbose) {
>> ^
>> 1 warning generated.
>>
>> These are not true arrays, they are linker defined symbols, which are
>> just addresses. Using the address of operator silences the warning and
>> does not change the resulting assembly with either clang/ld.lld or
>> gcc/ld (tested with diff + objdump -Dr).
>>
>> Link: https://github.com/ClangBuiltLinux/linux/issues/894
>> Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
>> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
>> ---
>> v1 -> v2: https://lore.kernel.org/lkml/20200219045423.54190-5-natechancellor@gmail.com/
>>
>> * No longer a series because there is no prerequisite patch.
>> * Use address-of operator instead of casting to unsigned long.
>>
>> lib/dynamic_debug.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
>> index aae17d9522e5..8f199f403ab5 100644
>> --- a/lib/dynamic_debug.c
>> +++ b/lib/dynamic_debug.c
>> @@ -1031,7 +1031,7 @@ static int __init dynamic_debug_init(void)
>> int n = 0, entries = 0, modct = 0;
>> int verbose_bytes = 0;
>>
>> - if (__start___verbose == __stop___verbose) {
>> + if (&__start___verbose == &__stop___verbose) {
>> pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n");
>> return 1;
>> }
>> --
>> 2.25.1
>>
>
> Gentle ping for review/acceptance.
>
> Cheers,
> Nathan
Works for me.
Acked-by: Jason Baron <jbaron@akamai.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] dynamic_debug: Use address-of operator on section symbols
2020-03-19 20:03 ` Jason Baron
@ 2020-03-19 21:43 ` Nathan Chancellor
0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2020-03-19 21:43 UTC (permalink / raw)
To: Jason Baron, Andrew Morton
Cc: linux-kernel, clang-built-linux, Nick Desaulniers, Andrew Morton
On Thu, Mar 19, 2020 at 04:03:39PM -0400, Jason Baron wrote:
>
>
> On 3/18/20 9:59 PM, Nathan Chancellor wrote:
> > On Wed, Feb 19, 2020 at 10:13:20PM -0700, Nathan Chancellor wrote:
> >> Clang warns:
> >>
> >> ../lib/dynamic_debug.c:1034:24: warning: array comparison always
> >> evaluates to false [-Wtautological-compare]
> >> if (__start___verbose == __stop___verbose) {
> >> ^
> >> 1 warning generated.
> >>
> >> These are not true arrays, they are linker defined symbols, which are
> >> just addresses. Using the address of operator silences the warning and
> >> does not change the resulting assembly with either clang/ld.lld or
> >> gcc/ld (tested with diff + objdump -Dr).
> >>
> >> Link: https://github.com/ClangBuiltLinux/linux/issues/894
> >> Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
> >> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> >> ---
> >> v1 -> v2: https://lore.kernel.org/lkml/20200219045423.54190-5-natechancellor@gmail.com/
> >>
> >> * No longer a series because there is no prerequisite patch.
> >> * Use address-of operator instead of casting to unsigned long.
> >>
> >> lib/dynamic_debug.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> >> index aae17d9522e5..8f199f403ab5 100644
> >> --- a/lib/dynamic_debug.c
> >> +++ b/lib/dynamic_debug.c
> >> @@ -1031,7 +1031,7 @@ static int __init dynamic_debug_init(void)
> >> int n = 0, entries = 0, modct = 0;
> >> int verbose_bytes = 0;
> >>
> >> - if (__start___verbose == __stop___verbose) {
> >> + if (&__start___verbose == &__stop___verbose) {
> >> pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n");
> >> return 1;
> >> }
> >> --
> >> 2.25.1
> >>
> >
> > Gentle ping for review/acceptance.
> >
> > Cheers,
> > Nathan
>
> Works for me.
>
> Acked-by: Jason Baron <jbaron@akamai.com>
Thank you!
Andrew, I assume you'll pick this up?
Cheers,
Nathan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-19 21:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-20 5:13 [PATCH v2] dynamic_debug: Use address-of operator on section symbols Nathan Chancellor
2020-03-19 1:59 ` Nathan Chancellor
2020-03-19 20:03 ` Jason Baron
2020-03-19 21:43 ` Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®