Skip to content

Commit

Permalink
Rename a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
rui314 committed Mar 11, 2023
1 parent d1c998f commit 6521c66
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion macho/dead-strip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static void visit(Context<E> &ctx, Subsection<E> *subsec) {
visit(ctx, rec.personality->subsec);

if (rec.fde) {
visit(ctx, rec.fde->func);
visit(ctx, rec.fde->subsec);
visit(ctx, rec.fde->lsda);
}
}
Expand Down
14 changes: 7 additions & 7 deletions macho/input-files.cc
Original file line number Diff line number Diff line change
Expand Up @@ -677,14 +677,14 @@ void ObjectFile<E>::parse_eh_frame(Context<E> &ctx) {
});
} else {
u64 addr = *(il64 *)(data.data() + 8) + eh_frame_sec->addr + offset + 8;
Subsection<E> *func = find_subsection(ctx, addr);
if (!func)
Subsection<E> *subsec = find_subsection(ctx, addr);
if (!subsec)
Fatal(ctx) << *this << ": __unwind_info: FDE with invalid function"
<< " reference at 0x" << std::hex << offset;

if (!func->has_compact_unwind) {
if (!subsec->has_compact_unwind) {
fdes.push_back(FdeRecord<E>{
.func = func,
.subsec = subsec,
.input_addr = (u32)(eh_frame_sec->addr + offset),
});
}
Expand All @@ -694,7 +694,7 @@ void ObjectFile<E>::parse_eh_frame(Context<E> &ctx) {
}

sort(fdes, [](const FdeRecord<E> &a, const FdeRecord<E> &b) {
return a.func->input_addr < b.func->input_addr;
return a.subsec->input_addr < b.subsec->input_addr;
});

for (CieRecord<E> &cie : cies)
Expand Down Expand Up @@ -734,10 +734,10 @@ void ObjectFile<E>::associate_compact_unwind(Context<E> &ctx) {
// unwind record that points to it.
for (FdeRecord<E> &fde : fdes) {
unwind_records.push_back(UnwindRecord<E>{
.subsec = fde.func,
.subsec = fde.subsec,
.fde = &fde,
.input_offset = 0,
.code_len = fde.func->input_size,
.code_len = fde.subsec->input_size,
});
}

Expand Down
2 changes: 1 addition & 1 deletion macho/mold.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ struct FdeRecord {
void copy_to(Context<E> &ctx);

CieRecord<E> *cie = nullptr;
Subsection<E> *func = nullptr;
Subsection<E> *subsec = nullptr;
Subsection<E> *lsda = nullptr;
u32 input_addr = 0;
u32 output_offset = (u32)-1;
Expand Down
8 changes: 4 additions & 4 deletions macho/output-chunks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2193,7 +2193,7 @@ void CieRecord<E>::copy_to(Context<E> &ctx) {

template <typename E>
void FdeRecord<E>::parse(Context<E> &ctx) {
ObjectFile<E> &file = func->isec->file;
ObjectFile<E> &file = subsec->isec->file;

auto find_cie = [&](u32 addr) {
for (CieRecord<E> &cie : file.cies)
Expand Down Expand Up @@ -2226,7 +2226,7 @@ void FdeRecord<E>::parse(Context<E> &ctx) {

template <typename E>
std::string_view FdeRecord<E>::get_contents() const {
ObjectFile<E> &file = func->isec->file;
ObjectFile<E> &file = subsec->isec->file;
const char *data = file.mf->get_contents().data() + file.eh_frame_sec->offset +
input_addr - file.eh_frame_sec->addr;
return {data, (size_t)*(ul32 *)data + 4};
Expand All @@ -2245,7 +2245,7 @@ void FdeRecord<E>::copy_to(Context<E> &ctx) {

// Relocate function start address
u64 output_addr = ctx.eh_frame.hdr.addr + output_offset;
*(ul64 *)(buf + 8) = (i32)(func->get_addr(ctx) - output_addr - 8);
*(ul64 *)(buf + 8) = (i32)(subsec->get_addr(ctx) - output_addr - 8);

if (lsda) {
u8 *aug = buf + 24;
Expand All @@ -2264,7 +2264,7 @@ void EhFrameSection<E>::compute_size(Context<E> &ctx) {
// Remove dead CIEs and FDEs
tbb::parallel_for_each(ctx.objs, [&](ObjectFile<E> *file) {
std::erase_if(file->fdes, [](FdeRecord<E> &fde) {
return !fde.func->is_alive;
return !fde.subsec->is_alive;
});

for (FdeRecord<E> &fde : file->fdes)
Expand Down

0 comments on commit 6521c66

Please sign in to comment.