aboutsummaryrefslogtreecommitdiff
path: root/lld/ELF/SyntheticSections.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-01-29 23:55:29 -0800
committerFangrui Song <i@maskray.me>2022-01-29 23:55:29 -0800
commit988a03c5851d183855026ef0b5bd8347e2217a2c (patch)
treed03269b6f3be530d6b0ab40438850bfe2b4dc518 /lld/ELF/SyntheticSections.cpp
parentc0b986aa0c4d40c2ff3c750ede33da9f23c1d734 (diff)
downloadllvm-988a03c5851d183855026ef0b5bd8347e2217a2c.zip
llvm-988a03c5851d183855026ef0b5bd8347e2217a2c.tar.gz
llvm-988a03c5851d183855026ef0b5bd8347e2217a2c.tar.bz2
[ELF] Add some Mips*Section to InStruct and change make<Mips*Section> to std::make_unique
Similar to D116143. My x86-64 lld executable is 20+KiB smaller.
Diffstat (limited to 'lld/ELF/SyntheticSections.cpp')
-rw-r--r--lld/ELF/SyntheticSections.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 176039d..1bcf9d1 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -100,7 +100,7 @@ template <class ELFT> void MipsAbiFlagsSection<ELFT>::writeTo(uint8_t *buf) {
}
template <class ELFT>
-MipsAbiFlagsSection<ELFT> *MipsAbiFlagsSection<ELFT>::create() {
+std::unique_ptr<MipsAbiFlagsSection<ELFT>> MipsAbiFlagsSection<ELFT>::create() {
Elf_Mips_ABIFlags flags = {};
bool create = false;
@@ -142,7 +142,7 @@ MipsAbiFlagsSection<ELFT> *MipsAbiFlagsSection<ELFT>::create() {
};
if (create)
- return make<MipsAbiFlagsSection<ELFT>>(flags);
+ return std::make_unique<MipsAbiFlagsSection<ELFT>>(flags);
return nullptr;
}
@@ -165,7 +165,7 @@ template <class ELFT> void MipsOptionsSection<ELFT>::writeTo(uint8_t *buf) {
}
template <class ELFT>
-MipsOptionsSection<ELFT> *MipsOptionsSection<ELFT>::create() {
+std::unique_ptr<MipsOptionsSection<ELFT>> MipsOptionsSection<ELFT>::create() {
// N64 ABI only.
if (!ELFT::Is64Bits)
return nullptr;
@@ -204,7 +204,7 @@ MipsOptionsSection<ELFT> *MipsOptionsSection<ELFT>::create() {
}
};
- return make<MipsOptionsSection<ELFT>>(reginfo);
+ return std::make_unique<MipsOptionsSection<ELFT>>(reginfo);
}
// MIPS .reginfo section.
@@ -222,7 +222,7 @@ template <class ELFT> void MipsReginfoSection<ELFT>::writeTo(uint8_t *buf) {
}
template <class ELFT>
-MipsReginfoSection<ELFT> *MipsReginfoSection<ELFT>::create() {
+std::unique_ptr<MipsReginfoSection<ELFT>> MipsReginfoSection<ELFT>::create() {
// Section should be alive for O32 and N32 ABIs only.
if (ELFT::Is64Bits)
return nullptr;
@@ -249,7 +249,7 @@ MipsReginfoSection<ELFT> *MipsReginfoSection<ELFT>::create() {
sec->getFile<ELFT>()->mipsGp0 = r->ri_gp_value;
};
- return make<MipsReginfoSection<ELFT>>(reginfo);
+ return std::make_unique<MipsReginfoSection<ELFT>>(reginfo);
}
InputSection *elf::createInterpSection() {
@@ -3813,7 +3813,10 @@ void InStruct::reset() {
gotPlt.reset();
igotPlt.reset();
ppc64LongBranchTarget.reset();
+ mipsAbiFlags.reset();
mipsGot.reset();
+ mipsOptions.reset();
+ mipsReginfo.reset();
mipsRldMap.reset();
partEnd.reset();
partIndex.reset();