x86, relocs: avoid calling qsort() with NULL pointer
PATCH 1/1 x86, relocs: avoid calling qsort() with NULL pointer
Current gcc trunk inserts a trap into arch/x86/tools/relocs:
% arch/x86/tools/relocs --realmode arch/x86/realmode/rm/realmode.elf
[1] 31456 illegal hardware instruction arch/x86/tools/relocs --realmode arch/x86/realmode/rm/realmode.elf
This happens because in the case of ELF_BITS==32 qsort is called with a NULL pointer.
Signed-off-by Markus Trippelsdorf <[email protected]>
arch/x86/tools/relocs.c +2 -1
@@ -976,7 +976,8 @@ static void emit_relocs(int as_text, int use_real_mode)/* Order the relocations for more efficient processing */ sort_relocs (&relocs16);sort_relocs (&relocs32); -sort_relocs (&relocs64); +if (ELF_BITS ==64 ) +sort_relocs (&relocs64);/* Print the relocations */ if (as_text) {
Signature · 1 line
Markus