1
1
mirror of https://github.com/rui314/mold.git synced 2024-08-17 17:00:30 +03:00
This commit is contained in:
Rui Ueyama 2024-04-18 22:11:49 +09:00
parent fb3c6029d0
commit 852be4a465
3 changed files with 5 additions and 5 deletions

View File

@ -768,7 +768,7 @@ template <>
void InputSection<E>::copy_contents_riscv(Context<E> &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;
}

View File

@ -69,14 +69,14 @@ void InputSection<E>::uncompress(Context<E> &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 <typename E>
void InputSection<E>::uncompress_to(Context<E> &ctx, u8 *buf) {
void InputSection<E>::copy_contents(Context<E> &ctx, u8 *buf) {
if (!(shdr().sh_flags & SHF_COMPRESSED) || uncompressed) {
memcpy(buf, contents.data(), contents.size());
return;
@ -448,7 +448,7 @@ void InputSection<E>::write_to(Context<E> &ctx, u8 *buf) {
if constexpr (is_riscv<E>)
copy_contents_riscv(ctx, buf);
else
uncompress_to(ctx, buf);
copy_contents(ctx, buf);
// Apply relocations
if (!ctx.arg.relocatable) {

View File

@ -244,7 +244,7 @@ public:
InputSection(Context<E> &ctx, ObjectFile<E> &file, i64 shndx);
void uncompress(Context<E> &ctx);
void uncompress_to(Context<E> &ctx, u8 *buf);
void copy_contents(Context<E> &ctx, u8 *buf);
void scan_relocations(Context<E> &ctx);
void write_to(Context<E> &ctx, u8 *buf);
void apply_reloc_alloc(Context<E> &ctx, u8 *base);