1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-11 05:46:58 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-12-18 10:56:56 +09:00
parent c8fc713ff0
commit b834b86cc0
3 changed files with 6 additions and 7 deletions

View File

@ -45,10 +45,9 @@ void InputSection::copy_buf() {
u8 *base = out::buf + output_section->shdr.sh_offset + offset;
ElfRela *dynrel = nullptr;
if (out::reldyn) {
if (out::reldyn)
dynrel = (ElfRela *)(out::buf + out::reldyn->shdr.sh_offset +
file->reldyn_offset + reldyn_offset);
}
for (int i = 0; i < rels.size(); i++) {
const ElfRela &rel = rels[i];
@ -171,7 +170,7 @@ void InputSection::scan_relocations() {
if (!(shdr.sh_flags & SHF_ALLOC))
return;
reldyn_offset = file->num_reldyn * sizeof(ElfRela);
reldyn_offset = file->num_dynrel * sizeof(ElfRela);
for (int i = 0; i < rels.size(); i++) {
const ElfRela &rel = rels[i];
@ -210,11 +209,11 @@ void InputSection::scan_relocations() {
if (sym.is_imported) {
rel_types[i] = R_DYN;
sym.flags |= NEEDS_DYNSYM;
file->num_reldyn++;
file->num_dynrel++;
} else {
rel_types[i] = R_ABS;
if (sym.needs_relative_rel())
file->num_reldyn++;
file->num_dynrel++;
}
break;
case R_X86_64_PC32:

2
mold.h
View File

@ -689,7 +689,7 @@ public:
const bool is_in_archive;
std::atomic_bool has_error = ATOMIC_VAR_INIT(false);
u64 num_reldyn = 0;
u64 num_dynrel = 0;
u64 reldyn_offset = 0;
u64 local_symtab_offset = 0;

View File

@ -161,7 +161,7 @@ void RelDynSection::update_shdr() {
for (ObjectFile *file : out::objs) {
file->reldyn_offset = n * sizeof(ElfRela);
n += file->num_reldyn;
n += file->num_dynrel;
}
shdr.sh_size = n * sizeof(ElfRela);