[PATCH] D25555: [ELF] - Do not crash when object has multiple SHT_MIPS_OPTIONS

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 04:19:43 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL284227: [ELF] - Do not crash when object has multiple SHT_MIPS_OPTIONS (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D25555?vs=74502&id=74657#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25555

Files:
  lld/trunk/ELF/InputFiles.cpp
  lld/trunk/test/ELF/invalid/mips-multiple-options.test


Index: lld/trunk/test/ELF/invalid/mips-multiple-options.test
===================================================================
--- lld/trunk/test/ELF/invalid/mips-multiple-options.test
+++ lld/trunk/test/ELF/invalid/mips-multiple-options.test
@@ -0,0 +1,25 @@
+# RUN: yaml2obj %s -o %t
+# RUN: not ld.lld %t -o %tout 2>&1 | FileCheck %s
+
+--- !ELF
+FileHeader:
+  Class:    ELFCLASS32
+  Data:     ELFDATA2LSB
+  Type:     ET_REL
+  Machine:  EM_MIPS
+  Flags:    [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
+
+Sections:
+  - Name:          .o1
+    Type:          SHT_MIPS_OPTIONS
+    Flags:         [ SHF_ALLOC, SHF_EXECINSTR ]
+    AddressAlign:  16
+    Content:       "010000000000000000000000"
+
+  - Name:          .o2
+    Type:          SHT_MIPS_OPTIONS
+    Flags:         [ SHF_ALLOC, SHF_EXECINSTR ]
+    AddressAlign:  16
+    Content:       "010000000000000000000000"
+
+# CHECK: multiple SHT_MIPS_OPTIONS sections are not allowed
Index: lld/trunk/ELF/InputFiles.cpp
===================================================================
--- lld/trunk/ELF/InputFiles.cpp
+++ lld/trunk/ELF/InputFiles.cpp
@@ -324,6 +324,9 @@
     MipsReginfo.reset(new MipsReginfoInputSection<ELFT>(this, &Sec, Name));
     return MipsReginfo.get();
   case SHT_MIPS_OPTIONS:
+    if (MipsOptions)
+      fatal(getFilename(this) +
+            ": multiple SHT_MIPS_OPTIONS sections are not allowed");
     MipsOptions.reset(new MipsOptionsInputSection<ELFT>(this, &Sec, Name));
     return MipsOptions.get();
   case SHT_MIPS_ABIFLAGS:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25555.74657.patch
Type: text/x-patch
Size: 1551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161014/66db84b9/attachment.bin>


More information about the llvm-commits mailing list