Commit ba43b7b8 authored by Markus Trippelsdorf's avatar Markus Trippelsdorf Committed by Sasha Levin

x86/tools: Fix gcc-7 warning in relocs.c

[ Upstream commit 7ebb9167 ]

gcc-7 warns:

In file included from arch/x86/tools/relocs_64.c:17:0:
arch/x86/tools/relocs.c: In function ‘process_64’:
arch/x86/tools/relocs.c:953:2: warning: argument 1 null where non-null expected [-Wnonnull]
  qsort(r->offset, r->count, sizeof(r->offset[0]), cmp_relocs);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/x86/tools/relocs.h:6:0,
                 from arch/x86/tools/relocs_64.c:1:
/usr/include/stdlib.h:741:13: note: in a call to function ‘qsort’ declared here
 extern void qsort

This happens because relocs16 is not used for ELF_BITS == 64,
so there is no point in trying to sort it.

Make the sort_relocs(&relocs16) call 32bit only.
Signed-off-by: default avatarMarkus Trippelsdorf <markus@trippelsdorf.de>
Link: http://lkml.kernel.org/r/20161215124513.GA289@x4Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent e8264e67
...@@ -992,11 +992,12 @@ static void emit_relocs(int as_text, int use_real_mode) ...@@ -992,11 +992,12 @@ static void emit_relocs(int as_text, int use_real_mode)
die("Segment relocations found but --realmode not specified\n"); die("Segment relocations found but --realmode not specified\n");
/* Order the relocations for more efficient processing */ /* Order the relocations for more efficient processing */
sort_relocs(&relocs16);
sort_relocs(&relocs32); sort_relocs(&relocs32);
#if ELF_BITS == 64 #if ELF_BITS == 64
sort_relocs(&relocs32neg); sort_relocs(&relocs32neg);
sort_relocs(&relocs64); sort_relocs(&relocs64);
#else
sort_relocs(&relocs16);
#endif #endif
/* Print the relocations */ /* Print the relocations */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment