Skip to content

Commit

Permalink
kernel/extable: Use address-of operator on section symbols
Browse files Browse the repository at this point in the history
Clang warns:

../kernel/extable.c:37:52: warning: array comparison always evaluates to
a constant [-Wtautological-compare]
        if (main_extable_sort_needed && __stop___ex_table > __start___ex_table) {
                                                          ^
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: ClangBuiltLinux#892
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
  • Loading branch information
nathanchance authored and intel-lab-lkp committed Feb 21, 2020
1 parent f5ae2ea commit f8e7c5d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/extable.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ u32 __initdata __visible main_extable_sort_needed = 1;
/* Sort the kernel's built-in exception table */
void __init sort_main_extable(void)
{
if (main_extable_sort_needed && __stop___ex_table > __start___ex_table) {
if (main_extable_sort_needed &&
&__stop___ex_table > &__start___ex_table) {
pr_notice("Sorting __ex_table...\n");
sort_extable(__start___ex_table, __stop___ex_table);
}
Expand Down

0 comments on commit f8e7c5d

Please sign in to comment.