1
1
mirror of https://github.com/rui314/mold.git synced 2025-01-06 07:58:34 +03:00
This commit is contained in:
Rui Ueyama 2021-01-28 13:28:45 +09:00
parent 6a5ce0bc07
commit 754eb455bf

28
icf.cc
View File

@ -169,13 +169,12 @@ static void gather_sections(std::vector<Digest> &digests,
InputSection &isec = *sections[i];
for (i64 j = 0; j < isec.rels.size(); j++) {
if (isec.has_fragments[j])
continue;
ElfRela &rel = isec.rels[j];
Symbol &sym = *isec.file->symbols[rel.r_sym];
if (!sym.fragref.frag && sym.input_section)
num_edges[i]++;
if (!isec.has_fragments[j]) {
ElfRela &rel = isec.rels[j];
Symbol &sym = *isec.file->symbols[rel.r_sym];
if (!sym.fragref.frag && sym.input_section)
num_edges[i]++;
}
}
});
@ -190,15 +189,14 @@ static void gather_sections(std::vector<Digest> &digests,
i64 idx = edge_indices[i];
for (i64 j = 0; j < isec.rels.size(); j++) {
if (isec.has_fragments[j])
continue;
if (!isec.has_fragments[j]) {
ElfRela &rel = isec.rels[j];
Symbol &sym = *isec.file->symbols[rel.r_sym];
ElfRela &rel = isec.rels[j];
Symbol &sym = *isec.file->symbols[rel.r_sym];
if (!sym.fragref.frag && sym.input_section) {
assert(sym.input_section->icf_idx != -1);
edges[idx++] = sym.input_section->icf_idx;
if (!sym.fragref.frag && sym.input_section) {
assert(sym.input_section->icf_idx != -1);
edges[idx++] = sym.input_section->icf_idx;
}
}
}
});