diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-04-16 06:22:53 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-04-16 06:22:53 +0000 |
commit | 057094c6f6bfacf22808ff7f70e895616d9474cc (patch) | |
tree | ce31919a4f671c85ea8f928ed7920aaad068aff5 | |
parent | 60536ee625baff7d1518b009e0dc7e0ce9a44c48 (diff) | |
download | bcm5719-llvm-057094c6f6bfacf22808ff7f70e895616d9474cc.tar.gz bcm5719-llvm-057094c6f6bfacf22808ff7f70e895616d9474cc.zip |
COFF: fix an off by one error
Adjust the tests to validate the number of auxiliary entries used to store the
filename.
Thanks to majnemer's sharp eye for catching the missing - 1 in the round up
calculation.
llvm-svn: 206359
-rw-r--r-- | llvm/lib/MC/WinCOFFObjectWriter.cpp | 2 | ||||
-rw-r--r-- | llvm/test/MC/COFF/file.s | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp index e98777894a7..27dc5a12a69 100644 --- a/llvm/lib/MC/WinCOFFObjectWriter.cpp +++ b/llvm/lib/MC/WinCOFFObjectWriter.cpp @@ -638,7 +638,7 @@ void WinCOFFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm, for (auto FI = Asm.file_names_begin(), FE = Asm.file_names_end(); FI != FE; ++FI) { // round up to calculate the number of auxiliary symbols required - unsigned Count = (FI->size() + COFF::SymbolSize) / COFF::SymbolSize; + unsigned Count = (FI->size() + COFF::SymbolSize - 1) / COFF::SymbolSize; COFFSymbol *file = createSymbol(".file"); file->Data.StorageClass = COFF::IMAGE_SYM_CLASS_FILE; diff --git a/llvm/test/MC/COFF/file.s b/llvm/test/MC/COFF/file.s index a258693839c..72eee90842a 100644 --- a/llvm/test/MC/COFF/file.s +++ b/llvm/test/MC/COFF/file.s @@ -2,16 +2,16 @@ // RUN: | FileCheck %s -check-prefix CHECK-PRINT .file "null-padded.asm" -// CHECK-PRINT: .file +// CHECK-PRINT: (nx 1) {{0x[0-9]+}} .file // CHECK-PRINT-NEXT: AUX null-padded.asm{{$}} .file "eighteen-chars.asm" -// CHECK-PRINT: .file +// CHECK-PRINT: (nx 1) {{0x[0-9]+}} .file // CHECK-PRINT-NEXT: AUX eighteen-chars.asm{{$}} .file "multiple-auxiliary-entries.asm" -// CHECK-PRINT: .file +// CHECK-PRINT: (nx 2) {{0x[0-9]+}} .file // CHECK-PRINT-NEXT: AUX multiple-auxiliary-entries.asm{{$}} |