r.r_offset = rel.getOffset();
r.setSymbolAndType(rel.getSymIndex(getPartition().dynSymTab.get()),
rel.type, false);
- if (config->isRela)
- r.r_addend = rel.computeAddend();
+ r.r_addend = config->isRela ? rel.computeAddend() : 0;
if (r.getType(config->isMips64EL) == target->relativeRel)
relatives.push_back(r);
//
// For Rela, we also want to sort by r_addend when r_info is the same. This
// enables us to group by r_addend as well.
- llvm::stable_sort(nonRelatives, [](const Elf_Rela &a, const Elf_Rela &b) {
+ llvm::sort(nonRelatives, [](const Elf_Rela &a, const Elf_Rela &b) {
if (a.r_info != b.r_info)
return a.r_info < b.r_info;
- if (config->isRela)
+ if (a.r_addend != b.r_addend)
return a.r_addend < b.r_addend;
- return false;
+ return a.r_offset < b.r_offset;
});
// Group relocations with the same r_info. Note that each group emits a group