mirror of
https://github.com/rui314/mold.git
synced 2024-12-29 11:24:36 +03:00
temporary
This commit is contained in:
parent
b04c7f407d
commit
17a9305bbc
@ -344,22 +344,6 @@ void ObjectFile::convert_common_symbols() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<i32, i32, i32> ObjectFile::scan_relocations() {
|
|
||||||
i32 num_got = 0;
|
|
||||||
i32 num_gotplt = 0;
|
|
||||||
i32 num_plt = 0;
|
|
||||||
|
|
||||||
for (InputSection *isec : sections) {
|
|
||||||
if (isec) {
|
|
||||||
auto [got, gotplt, plt] = isec->scan_relocations();
|
|
||||||
num_got += got;
|
|
||||||
num_gotplt += gotplt;
|
|
||||||
num_plt += plt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {num_got, num_gotplt, num_plt};
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFile::fix_sym_addrs() {
|
void ObjectFile::fix_sym_addrs() {
|
||||||
for (Symbol *sym : symbols) {
|
for (Symbol *sym : symbols) {
|
||||||
if (sym->file != this)
|
if (sym->file != this)
|
||||||
|
@ -26,11 +26,7 @@ void InputSection::copy_to(u8 *buf) {
|
|||||||
memcpy_nontemporal(buf, &data[0], data.size());
|
memcpy_nontemporal(buf, &data[0], data.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<i32, i32, i32> InputSection::scan_relocations() {
|
void InputSection::scan_relocations(i32 &num_got, i32 &num_gotplt, i32 &num_plt) {
|
||||||
i32 num_got = 0;
|
|
||||||
i32 num_gotplt = 0;
|
|
||||||
i32 num_plt = 0;
|
|
||||||
|
|
||||||
for (const ELF64LE::Rela &rel : rels) {
|
for (const ELF64LE::Rela &rel : rels) {
|
||||||
Symbol *sym = file->get_symbol(rel.getSymbol(false));
|
Symbol *sym = file->get_symbol(rel.getSymbol(false));
|
||||||
if (!sym || !sym->file)
|
if (!sym || !sym->file)
|
||||||
@ -84,8 +80,6 @@ std::tuple<i32, i32, i32> InputSection::scan_relocations() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {num_got, num_gotplt, num_plt};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputSection::relocate(u8 *buf) {
|
void InputSection::relocate(u8 *buf) {
|
||||||
|
7
main.cc
7
main.cc
@ -533,7 +533,12 @@ int main(int argc, char **argv) {
|
|||||||
std::atomic_int32_t num_plt = 0;
|
std::atomic_int32_t num_plt = 0;
|
||||||
|
|
||||||
for_each(files, [&](ObjectFile *file) {
|
for_each(files, [&](ObjectFile *file) {
|
||||||
auto [got, gotplt, plt] = file->scan_relocations();
|
i32 got = 0, gotplt = 0, plt = 0;
|
||||||
|
|
||||||
|
for (InputSection *isec : file->sections)
|
||||||
|
if (isec)
|
||||||
|
isec->scan_relocations(got, gotplt, plt);
|
||||||
|
|
||||||
num_got += got;
|
num_got += got;
|
||||||
num_gotplt += gotplt;
|
num_gotplt += gotplt;
|
||||||
num_plt += plt;
|
num_plt += plt;
|
||||||
|
3
mold.h
3
mold.h
@ -210,7 +210,7 @@ public:
|
|||||||
|
|
||||||
void copy_to(u8 *buf);
|
void copy_to(u8 *buf);
|
||||||
void relocate(u8 *buf);
|
void relocate(u8 *buf);
|
||||||
std::tuple<i32, i32, i32> scan_relocations();
|
void scan_relocations(i32 &num_got, i32 &num_gotplt, i32 &num_plt);
|
||||||
|
|
||||||
ObjectFile *file;
|
ObjectFile *file;
|
||||||
OutputSection *output_section;
|
OutputSection *output_section;
|
||||||
@ -514,7 +514,6 @@ public:
|
|||||||
void hanlde_undefined_weak_symbols();
|
void hanlde_undefined_weak_symbols();
|
||||||
void eliminate_duplicate_comdat_groups();
|
void eliminate_duplicate_comdat_groups();
|
||||||
void convert_common_symbols();
|
void convert_common_symbols();
|
||||||
std::tuple<i32, i32, i32> scan_relocations();
|
|
||||||
void fix_sym_addrs();
|
void fix_sym_addrs();
|
||||||
void compute_symtab();
|
void compute_symtab();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user