diff --git a/elf/arch-riscv.cc b/elf/arch-riscv.cc index 8d545f09..caaf7673 100644 --- a/elf/arch-riscv.cc +++ b/elf/arch-riscv.cc @@ -768,7 +768,7 @@ template <> void InputSection::copy_contents_riscv(Context &ctx, u8 *buf) { // If a section is not relaxed, we can copy it as a one big chunk. if (extra.r_deltas.empty()) { - uncompress_to(ctx, buf); + copy_contents(ctx, buf); return; } diff --git a/elf/input-sections.cc b/elf/input-sections.cc index 3c4b3611..8e15ff18 100644 --- a/elf/input-sections.cc +++ b/elf/input-sections.cc @@ -69,14 +69,14 @@ void InputSection::uncompress(Context &ctx) { return; u8 *buf = new u8[sh_size]; - uncompress_to(ctx, buf); + copy_contents(ctx, buf); contents = std::string_view((char *)buf, sh_size); ctx.string_pool.emplace_back(buf); uncompressed = true; } template -void InputSection::uncompress_to(Context &ctx, u8 *buf) { +void InputSection::copy_contents(Context &ctx, u8 *buf) { if (!(shdr().sh_flags & SHF_COMPRESSED) || uncompressed) { memcpy(buf, contents.data(), contents.size()); return; @@ -448,7 +448,7 @@ void InputSection::write_to(Context &ctx, u8 *buf) { if constexpr (is_riscv) copy_contents_riscv(ctx, buf); else - uncompress_to(ctx, buf); + copy_contents(ctx, buf); // Apply relocations if (!ctx.arg.relocatable) { diff --git a/elf/mold.h b/elf/mold.h index 778fc523..d07a4b09 100644 --- a/elf/mold.h +++ b/elf/mold.h @@ -244,7 +244,7 @@ public: InputSection(Context &ctx, ObjectFile &file, i64 shndx); void uncompress(Context &ctx); - void uncompress_to(Context &ctx, u8 *buf); + void copy_contents(Context &ctx, u8 *buf); void scan_relocations(Context &ctx); void write_to(Context &ctx, u8 *buf); void apply_reloc_alloc(Context &ctx, u8 *base);