forked from OSchip/llvm-project
Move code for MIPS from createInputSection to initializeSections.
We already have code for ARM in initializeSections, so this is more consistent. Differential Revision: https://reviews.llvm.org/D22833 llvm-svn: 276811
This commit is contained in:
parent
8a5c9ea9ba
commit
3b452a7a22
|
@ -252,6 +252,14 @@ void elf::ObjectFile<ELFT>::initializeSections(
|
||||||
// they can be used to reason about object compatibility.
|
// they can be used to reason about object compatibility.
|
||||||
Sections[I] = &InputSection<ELFT>::Discarded;
|
Sections[I] = &InputSection<ELFT>::Discarded;
|
||||||
break;
|
break;
|
||||||
|
case SHT_MIPS_REGINFO:
|
||||||
|
MipsReginfo.reset(new MipsReginfoInputSection<ELFT>(this, &Sec));
|
||||||
|
Sections[I] = MipsReginfo.get();
|
||||||
|
break;
|
||||||
|
case SHT_MIPS_OPTIONS:
|
||||||
|
MipsOptions.reset(new MipsOptionsInputSection<ELFT>(this, &Sec));
|
||||||
|
Sections[I] = MipsOptions.get();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Sections[I] = createInputSection(Sec);
|
Sections[I] = createInputSection(Sec);
|
||||||
}
|
}
|
||||||
|
@ -298,19 +306,6 @@ elf::ObjectFile<ELFT>::createInputSection(const Elf_Shdr &Sec) {
|
||||||
if (Config->StripDebug && Name.startswith(".debug"))
|
if (Config->StripDebug && Name.startswith(".debug"))
|
||||||
return &InputSection<ELFT>::Discarded;
|
return &InputSection<ELFT>::Discarded;
|
||||||
|
|
||||||
// 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) {
|
|
||||||
switch (Sec.sh_type) {
|
|
||||||
case SHT_MIPS_REGINFO:
|
|
||||||
MipsReginfo.reset(new MipsReginfoInputSection<ELFT>(this, &Sec));
|
|
||||||
return MipsReginfo.get();
|
|
||||||
case SHT_MIPS_OPTIONS:
|
|
||||||
MipsOptions.reset(new MipsOptionsInputSection<ELFT>(this, &Sec));
|
|
||||||
return MipsOptions.get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The linker merges EH (exception handling) frames and creates a
|
// The linker merges EH (exception handling) frames and creates a
|
||||||
// .eh_frame_hdr section for runtime. So we handle them with a special
|
// .eh_frame_hdr section for runtime. So we handle them with a special
|
||||||
// class. For relocatable outputs, they are just passed through.
|
// class. For relocatable outputs, they are just passed through.
|
||||||
|
|
Loading…
Reference in New Issue