Skip to content

Commit 0214a8c

Browse files
Markus Trippelsdorfgregkh
authored andcommitted
x86/tools: Fix gcc-7 warning in relocs.c
commit 7ebb916782949621ff6819acf373a06902df7679 upstream. 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: Markus Trippelsdorf <markus@trippelsdorf.de> Link: http://lkml.kernel.org/r/20161215124513.GA289@x4 Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e952c29 commit 0214a8c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

arch/x86/tools/relocs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,11 +992,12 @@ static void emit_relocs(int as_text, int use_real_mode)
992992
die("Segment relocations found but --realmode not specified\n");
993993

994994
/* Order the relocations for more efficient processing */
995-
sort_relocs(&relocs16);
996995
sort_relocs(&relocs32);
997996
#if ELF_BITS == 64
998997
sort_relocs(&relocs32neg);
999998
sort_relocs(&relocs64);
999+
#else
1000+
sort_relocs(&relocs16);
10001001
#endif
10011002

10021003
/* Print the relocations */

0 commit comments

Comments
 (0)