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

It is faster and more correct method than string comparision.

llvm-svn: 276807
This commit is contained in:
Simon Atanasyan 2016-07-26 21:11:26 +00:00
parent 77a9c7949d
commit 72170d2753

View File

@ -301,11 +301,11 @@ elf::ObjectFile<ELFT>::createInputSection(const Elf_Shdr &Sec) {
// 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();
}