[PATCH] D27770: [ELF][MIPS] Allow .MIPS.abiflags larger than one Elf_Mips_ABIFlags struct

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 10:34:31 PST 2016


ruiu added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:138
+    const auto Size = Sec->Data.size();
+    constexpr auto ABIFlagsSize = sizeof(Elf_Mips_ABIFlags);
+    if (Size < ABIFlagsSize) {
----------------
atanasyan wrote:
> I do not think we need `constexpr` here. Plain `const` is enough.
We don't even sprinkle `const` that much, but we avoid `auto` as long as its type is obvious by RHS. So please avoid `auto` here.


================
Comment at: ELF/SyntheticSections.cpp:139-143
+    if (Size < ABIFlagsSize) {
+      error(Filename + ": invalid size of .MIPS.abiflags section: got " +
+            Twine(Size) + " instead of " + Twine(ABIFlagsSize));
       return nullptr;
     }
----------------
I think the next `if` covers this case, no? If `Size < ABIFlagsSize`, its modulo is not zero.


https://reviews.llvm.org/D27770





More information about the llvm-commits mailing list