[lld] r276807 - [ELF][MIPS] Use section type to recognize .reginfo and .MIPS.options sections

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 14:11:26 PDT 2016


Author: atanasyan
Date: Tue Jul 26 16:11:26 2016
New Revision: 276807

URL: http://llvm.org/viewvc/llvm-project?rev=276807&view=rev
Log:
[ELF][MIPS] Use section type to recognize .reginfo and .MIPS.options sections

It is faster and more correct method than string comparision.

Modified:
    lld/trunk/ELF/InputFiles.cpp

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=276807&r1=276806&r2=276807&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Jul 26 16:11:26 2016
@@ -301,11 +301,11 @@ elf::ObjectFile<ELFT>::createInputSectio
   // A MIPS object file has a special sections that contain register
   // usage info, which need to be handled by the linker specially.
   if (Config->EMachine == EM_MIPS) {
-    if (Name == ".reginfo") {
+    switch (Sec.sh_type) {
+    case SHT_MIPS_REGINFO:
       MipsReginfo.reset(new MipsReginfoInputSection<ELFT>(this, &Sec));
       return MipsReginfo.get();
-    }
-    if (Name == ".MIPS.options") {
+    case SHT_MIPS_OPTIONS:
       MipsOptions.reset(new MipsOptionsInputSection<ELFT>(this, &Sec));
       return MipsOptions.get();
     }




More information about the llvm-commits mailing list