Index: llvm/test/tools/llvm-readobj/ELF/mips-got.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/mips-got.test +++ llvm/test/tools/llvm-readobj/ELF/mips-got.test @@ -368,19 +368,30 @@ ## Check we report errors when dynamic tags, needed for dumping GOT, are missing. # RUN: yaml2obj --docnum=4 -DTAG1=DT_MIPS_LOCAL_GOTNO -DTAG2=DT_MIPS_GOTSYM %s -o %t.err1.o -# RUN: not llvm-readobj -A %t.err1.o 2>&1 | FileCheck %s -DFILE=%t.err1.o -check-prefix ERR1 +# RUN: llvm-readobj -A %t.err1.o 2>&1 | FileCheck %s -DFILE=%t.err1.o -check-prefixes=NO-OUTPUT,ERR1 -# ERR1: error: '[[FILE]]': cannot find PLTGOT dynamic tag +# NO-OUTPUT: LoadName: +# NO-OUTPUT-NEXT: There is no .MIPS.abiflags section in the file. +# NO-OUTPUT-NEXT: There is no .MIPS.options section in the file. +# NO-OUTPUT-NEXT: There is no .reginfo section in the file. + +# ERR1-NEXT: warning: '[[FILE]]': cannot find PLTGOT dynamic tag +# ERR1-EMPTY: +# ERR1-NOT: {{.}} # RUN: yaml2obj --docnum=4 -DTAG1=DT_PLTGOT -DTAG2=DT_MIPS_GOTSYM %s -o %t.err2.o -# RUN: not llvm-readobj -A %t.err2.o 2>&1 | FileCheck %s -DFILE=%t.err2.o -check-prefix ERR2 +# RUN: llvm-readobj -A %t.err2.o 2>&1 | FileCheck %s -DFILE=%t.err2.o -check-prefixes=NO-OUTPUT,ERR2 -# ERR2: error: '[[FILE]]': cannot find MIPS_LOCAL_GOTNO dynamic tag +# ERR2: warning: '[[FILE]]': cannot find MIPS_LOCAL_GOTNO dynamic tag +# ERR2-EMPTY: +# ERR2-NOT: {{.}} # RUN: yaml2obj --docnum=4 -DTAG1=DT_PLTGOT -DTAG2=DT_MIPS_LOCAL_GOTNO %s -o %t.err3.o -# RUN: not llvm-readobj -A %t.err3.o 2>&1 | FileCheck %s -DFILE=%t.err3.o -check-prefix ERR3 +# RUN: llvm-readobj -A %t.err3.o 2>&1 | FileCheck %s -DFILE=%t.err3.o -check-prefixes=NO-OUTPUT,ERR3 -# ERR3: error: '[[FILE]]': cannot find MIPS_GOTSYM dynamic tag +# ERR3: warning: '[[FILE]]': cannot find MIPS_GOTSYM dynamic tag +# ERR3-EMPTY: +# ERR3-NOT: {{.}} --- !ELF FileHeader: @@ -401,14 +412,18 @@ DynamicSymbols: [] # RUN: yaml2obj --docnum=5 -DVAL1=0xffff %s -o %t.err4.o -# RUN: not llvm-readobj -A %t.err4.o 2>&1 | FileCheck %s -DFILE=%t.err4.o -check-prefix=ERR4 +# RUN: llvm-readobj -A %t.err4.o 2>&1 | FileCheck %s -DFILE=%t.err4.o -check-prefixes=NO-OUTPUT,ERR4 -# ERR4: error: '[[FILE]]': DT_MIPS_GOTSYM value (65535) exceeds the number of dynamic symbols (1) +# ERR4: warning: '[[FILE]]': DT_MIPS_GOTSYM value (65535) exceeds the number of dynamic symbols (1) +# ERR4-EMPTY: +# ERR4-NOT: {{.}} # RUN: yaml2obj --docnum=5 -DVAL2=0xffff %s -o %t.err5.o -# RUN: not llvm-readobj -A %t.err5.o 2>&1 | FileCheck %s -DFILE=%t.err5.o -check-prefix=ERR5 +# RUN: llvm-readobj -A %t.err5.o 2>&1 | FileCheck %s -DFILE=%t.err5.o -check-prefixes=NO-OUTPUT,ERR5 -# ERR5: error: '[[FILE]]': there is no non-empty GOT section at 0xffff +# ERR5: warning: '[[FILE]]': there is no non-empty GOT section at 0xffff +# ERR5-EMPTY: +# ERR5-NOT: {{.}} --- !ELF FileHeader: Index: llvm/test/tools/llvm-readobj/ELF/mips-plt.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/mips-plt.test +++ llvm/test/tools/llvm-readobj/ELF/mips-plt.test @@ -89,14 +89,23 @@ ## Check we report errors when dynamic tags, needed for dumping PLT, are missing. # RUN: yaml2obj --docnum=2 -DTAG=DT_MIPS_PLTGOT %s -o %t.err1.o -# RUN: not llvm-readobj -A %t.err1.o 2>&1 | FileCheck %s -DFILE=%t.err1.o --check-prefix=ERR1 +# RUN: llvm-readobj -A %t.err1.o 2>&1 | FileCheck %s -DFILE=%t.err1.o --check-prefixes=NO-OUTPUT,ERR1 -# ERR1: error: '[[FILE]]': cannot find JMPREL dynamic tag +# NO-OUTPUT: LoadName: +# NO-OUTPUT-NEXT: There is no .MIPS.abiflags section in the file. +# NO-OUTPUT-NEXT: There is no .MIPS.options section in the file. +# NO-OUTPUT-NEXT: There is no .reginfo section in the file. + +# ERR1: warning: '[[FILE]]': cannot find JMPREL dynamic tag +# ERR1-EMPTY: +# ERR1-NOT: {{.}} # RUN: yaml2obj --docnum=2 -DTAG=DT_JMPREL %s -o %t.err2.o -# RUN: not llvm-readobj -A %t.err2.o 2>&1 | FileCheck %s -DFILE=%t.err2.o --check-prefix=ERR2 +# RUN: llvm-readobj -A %t.err2.o 2>&1 | FileCheck %s -DFILE=%t.err2.o --check-prefixes=NO-OUTPUT,ERR2 -# ERR2: error: '[[FILE]]': cannot find MIPS_PLTGOT dynamic tag +# ERR2: warning: '[[FILE]]': cannot find MIPS_PLTGOT dynamic tag +# ERR2-EMPTY: +# ERR2-NOT: {{.}} --- !ELF FileHeader: @@ -115,14 +124,18 @@ ## Check we report errors when we are unable to find PLTGOT/JMPREL sections. # RUN: yaml2obj --docnum=3 %s -DVAL1=0xffff -o %t.err3.o -# RUN: not llvm-readobj -A %t.err3.o 2>&1 | FileCheck %s -DFILE=%t.err3.o -check-prefix ERR3 +# RUN: llvm-readobj -A %t.err3.o 2>&1 | FileCheck %s -DFILE=%t.err3.o -check-prefixes=NO-OUTPUT,ERR3 -# ERR3: error: '[[FILE]]': there is no non-empty PLTGOT section at 0xffff +# ERR3: warning: '[[FILE]]': there is no non-empty PLTGOT section at 0xffff +# ERR3-EMPTY: +# ERR3-NOT: {{.}} # RUN: yaml2obj --docnum=3 %s -DVAL2=0xffff -o %t.err4.o -# RUN: not llvm-readobj -A %t.err4.o 2>&1 | FileCheck %s -DFILE=%t.err4.o -check-prefix ERR4 +# RUN: llvm-readobj -A %t.err4.o 2>&1 | FileCheck %s -DFILE=%t.err4.o -check-prefixes=NO-OUTPUT,ERR4 -# ERR4: error: '[[FILE]]': there is no non-empty RELPLT section at 0xffff +# ERR4: warning: '[[FILE]]': there is no non-empty RELPLT section at 0xffff +# ERR4-EMPTY: +# ERR4-NOT: {{.}} --- !ELF FileHeader: @@ -150,19 +163,25 @@ ## Check we report errors when we are unable to dump PLTGOT properly. # RUN: yaml2obj --docnum=3 -DVAL1=0x100 %s -o %t.err5.o -# RUN: not llvm-readobj -A %t.err5.o 2>&1 | FileCheck %s -DFILE=%t.err5.o -check-prefix ERR5 +# RUN: llvm-readobj -A %t.err5.o 2>&1 | FileCheck %s -DFILE=%t.err5.o -check-prefixes=NO-OUTPUT,ERR5 -# ERR5: error: '[[FILE]]': unable to read PLTGOT section content: section [index 2] has a sh_offset (0x70) + sh_size (0xffffffff) that is greater than the file size (0x280) +# ERR5: warning: '[[FILE]]': unable to read PLTGOT section content: section [index 2] has a sh_offset (0x70) + sh_size (0xffffffff) that is greater than the file size (0x280) +# ERR5-EMPTY: +# ERR5-NOT: {{.}} # RUN: yaml2obj --docnum=3 -DVAL2=0x100 -DLINK=0xaaaaaaaa %s -o %t.err6.o -# RUN: not llvm-readobj -A %t.err6.o 2>&1 | FileCheck %s -DFILE=%t.err6.o -check-prefix ERR6 +# RUN: llvm-readobj -A %t.err6.o 2>&1 | FileCheck %s -DFILE=%t.err6.o -check-prefixes=NO-OUTPUT,ERR6 -# ERR6: error: '[[FILE]]': unable to get a symbol table linked to the SHT_PROGBITS section with index 2: invalid section index: 2863311530 +# ERR6: warning: '[[FILE]]': unable to get a symbol table linked to the SHT_PROGBITS section with index 2: invalid section index: 2863311530 +# ERR6-EMPTY: +# ERR6-NOT: {{.}} # RUN: yaml2obj --docnum=3 -DVAL2=0x100 %s -o %t.err7.o -# RUN: not llvm-readobj -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o -check-prefix ERR7 +# RUN: llvm-readobj -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o -check-prefixes=NO-OUTPUT,ERR7 -# ERR7: error: '[[FILE]]': unable to get a string table for the SHT_DYNAMIC section with index 1: invalid sh_type for symbol table, expected SHT_SYMTAB or SHT_DYNSYM +# ERR7: warning: '[[FILE]]': unable to get a string table for the SHT_DYNAMIC section with index 1: invalid sh_type for symbol table, expected SHT_SYMTAB or SHT_DYNSYM +# ERR7-EMPTY: +# ERR7-NOT: {{.}} ## Check how we print PLT entries when they are unnamed section symbols. # RUN: yaml2obj --docnum=4 %s -o %t3 Index: llvm/tools/llvm-readobj/ELFDumper.cpp =================================================================== --- llvm/tools/llvm-readobj/ELFDumper.cpp +++ llvm/tools/llvm-readobj/ELFDumper.cpp @@ -2887,12 +2887,12 @@ printMipsReginfo(); MipsGOTParser Parser(*this); if (Error E = Parser.findGOT(dynamic_table(), dynamic_symbols())) - reportError(std::move(E), ObjF.getFileName()); + reportUniqueWarning(std::move(E)); else if (!Parser.isGotEmpty()) ELFDumperStyle->printMipsGOT(Parser); if (Error E = Parser.findPLT(dynamic_table())) - reportError(std::move(E), ObjF.getFileName()); + reportUniqueWarning(std::move(E)); else if (!Parser.isPltEmpty()) ELFDumperStyle->printMipsPLT(Parser); break;