1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-27 10:23:41 +03:00
This commit is contained in:
Rui Ueyama 2021-05-05 23:37:48 +09:00
parent f0b1d5096c
commit 92a3e78ee0
4 changed files with 8 additions and 8 deletions

View File

@ -564,11 +564,11 @@ int do_main(int argc, char **argv) {
ctx.reldyn->sort(ctx); ctx.reldyn->sort(ctx);
// Zero-clear paddings between sections // Zero-clear paddings between sections
clear_padding(ctx, filesize); clear_padding(ctx);
if (ctx.buildid) { if (ctx.buildid) {
Timer t(ctx, "build_id"); Timer t(ctx, "build_id");
ctx.buildid->write_buildid(ctx, filesize); ctx.buildid->write_buildid(ctx);
} }
t_copy.stop(); t_copy.stop();

4
mold.h
View File

@ -780,7 +780,7 @@ public:
void update_shdr(Context<E> &ctx) override; void update_shdr(Context<E> &ctx) override;
void copy_buf(Context<E> &ctx) override; void copy_buf(Context<E> &ctx) override;
void write_buildid(Context<E> &ctx, i64 filesize); void write_buildid(Context<E> &ctx);
static constexpr i64 HEADER_SIZE = 16; static constexpr i64 HEADER_SIZE = 16;
}; };
@ -1275,7 +1275,7 @@ template <typename E> void scan_rels(Context<E> &);
template <typename E> void apply_version_script(Context<E> &); template <typename E> void apply_version_script(Context<E> &);
template <typename E> void parse_symbol_version(Context<E> &); template <typename E> void parse_symbol_version(Context<E> &);
template <typename E> void compute_import_export(Context<E> &); template <typename E> void compute_import_export(Context<E> &);
template <typename E> void clear_padding(Context<E> &, i64 filesize); template <typename E> void clear_padding(Context<E> &);
template <typename E> i64 get_section_rank(Context<E> &, OutputChunk<E> *chunk); template <typename E> i64 get_section_rank(Context<E> &, OutputChunk<E> *chunk);
template <typename E> i64 set_osec_offsets(Context<E> &); template <typename E> i64 set_osec_offsets(Context<E> &);
template <typename E> void fix_synthetic_symbols(Context<E> &); template <typename E> void fix_synthetic_symbols(Context<E> &);

View File

@ -1567,7 +1567,7 @@ static std::vector<u8> get_uuid_v4(Context<E> &ctx) {
} }
template <typename E> template <typename E>
void BuildIdSection<E>::write_buildid(Context<E> &ctx, i64 filesize) { void BuildIdSection<E>::write_buildid(Context<E> &ctx) {
switch (ctx.arg.build_id.kind) { switch (ctx.arg.build_id.kind) {
case BuildId::HEX: case BuildId::HEX:
write_vector(ctx.buf + this->shdr.sh_offset + HEADER_SIZE, write_vector(ctx.buf + this->shdr.sh_offset + HEADER_SIZE,

View File

@ -581,7 +581,7 @@ void compute_import_export(Context<E> &ctx) {
} }
template <typename E> template <typename E>
void clear_padding(Context<E> &ctx, i64 filesize) { void clear_padding(Context<E> &ctx) {
Timer t(ctx, "clear_padding"); Timer t(ctx, "clear_padding");
auto zero = [&](OutputChunk<E> *chunk, i64 next_start) { auto zero = [&](OutputChunk<E> *chunk, i64 next_start) {
@ -593,7 +593,7 @@ void clear_padding(Context<E> &ctx, i64 filesize) {
for (i64 i = 1; i < ctx.chunks.size(); i++) for (i64 i = 1; i < ctx.chunks.size(); i++)
zero(ctx.chunks[i - 1], ctx.chunks[i]->shdr.sh_offset); zero(ctx.chunks[i - 1], ctx.chunks[i]->shdr.sh_offset);
zero(ctx.chunks.back(), filesize); zero(ctx.chunks.back(), ctx.output_file->filesize);
} }
// We want to sort output chunks in the following order. // We want to sort output chunks in the following order.
@ -802,7 +802,7 @@ void fix_synthetic_symbols(Context<E> &ctx) {
template void apply_version_script(Context<E> &ctx); \ template void apply_version_script(Context<E> &ctx); \
template void parse_symbol_version(Context<E> &ctx); \ template void parse_symbol_version(Context<E> &ctx); \
template void compute_import_export(Context<E> &ctx); \ template void compute_import_export(Context<E> &ctx); \
template void clear_padding(Context<E> &ctx, i64 filesize); \ template void clear_padding(Context<E> &ctx); \
template i64 get_section_rank(Context<E> &ctx, OutputChunk<E> *chunk); \ template i64 get_section_rank(Context<E> &ctx, OutputChunk<E> *chunk); \
template i64 set_osec_offsets(Context<E> &ctx); \ template i64 set_osec_offsets(Context<E> &ctx); \
template void fix_synthetic_symbols(Context<E> &ctx); template void fix_synthetic_symbols(Context<E> &ctx);