mirror of
https://github.com/rui314/mold.git
synced 2024-09-22 10:27:48 +03:00
temporary
This commit is contained in:
parent
17a9305bbc
commit
9ed1a00ff3
@ -26,7 +26,8 @@ void InputSection::copy_to(u8 *buf) {
|
||||
memcpy_nontemporal(buf, &data[0], data.size());
|
||||
}
|
||||
|
||||
void InputSection::scan_relocations(i32 &num_got, i32 &num_gotplt, i32 &num_plt) {
|
||||
void InputSection::scan_relocations(i32 &num_got, i32 &num_gotplt,
|
||||
i32 &num_plt, i32 &num_dynrel) {
|
||||
for (const ELF64LE::Rela &rel : rels) {
|
||||
Symbol *sym = file->get_symbol(rel.getSymbol(false));
|
||||
if (!sym || !sym->file)
|
||||
@ -46,11 +47,6 @@ void InputSection::scan_relocations(i32 &num_got, i32 &num_gotplt, i32 &num_plt)
|
||||
if (sym->got_offset == 0) {
|
||||
sym->got_offset = -1;
|
||||
num_got++;
|
||||
|
||||
if (sym->gotplt_offset == -1) {
|
||||
sym->gotplt_offset = 0;
|
||||
num_gotplt--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -68,13 +64,12 @@ void InputSection::scan_relocations(i32 &num_got, i32 &num_gotplt, i32 &num_plt)
|
||||
|
||||
std::lock_guard lock(sym->mu);
|
||||
if (sym->plt_offset == 0) {
|
||||
assert(sym->gotplt_offset == 0);
|
||||
sym->plt_offset = -1;
|
||||
num_plt++;
|
||||
}
|
||||
|
||||
if (sym->gotplt_offset == 0 && sym->got_offset == 0) {
|
||||
sym->gotplt_offset = -1;
|
||||
num_plt++;
|
||||
num_gotplt++;
|
||||
num_dynrel++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
6
main.cc
6
main.cc
@ -531,17 +531,19 @@ int main(int argc, char **argv) {
|
||||
std::atomic_int32_t num_got = 0;
|
||||
std::atomic_int32_t num_gotplt = 0;
|
||||
std::atomic_int32_t num_plt = 0;
|
||||
std::atomic_int32_t num_dynrel = 0;
|
||||
|
||||
for_each(files, [&](ObjectFile *file) {
|
||||
i32 got = 0, gotplt = 0, plt = 0;
|
||||
i32 got = 0, gotplt = 0, plt = 0, dynrel = 0;
|
||||
|
||||
for (InputSection *isec : file->sections)
|
||||
if (isec)
|
||||
isec->scan_relocations(got, gotplt, plt);
|
||||
isec->scan_relocations(got, gotplt, plt, dynrel);
|
||||
|
||||
num_got += got;
|
||||
num_gotplt += gotplt;
|
||||
num_plt += plt;
|
||||
num_dynrel += dynrel;
|
||||
});
|
||||
|
||||
out::got->size = num_got * 8;
|
||||
|
Loading…
Reference in New Issue
Block a user