1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-10 10:57:55 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-10-20 10:32:32 +09:00
parent 09c8d598c9
commit 2b974da232
3 changed files with 21 additions and 1 deletions

View File

@ -176,10 +176,11 @@ class InputSection : public InputChunk {
public:
InputSection(ObjectFile *file, const ELF64LE::Shdr *hdr, StringRef name);
void copy_to(uint8_t *buf) override;
void relocate(uint8_t *buf) override {}
void relocate(uint8_t *buf) override;
uint64_t get_size() const;
ObjectFile *file;
ArrayRef<ELF64LE::Rela> rels;
OutputSection *output_section;
StringRef output_section_name;
int64_t offset = -1;

View File

@ -76,6 +76,20 @@ void ObjectFile::initialize_sections() {
}
}
}
for (int i = 0; i < elf_sections.size(); i++) {
const ELF64LE::Shdr &shdr = elf_sections[i];
if (shdr.sh_type != SHT_RELA)
continue;
if (shdr.sh_info >= sections.size())
error(toString(this) + ": invalid relocated section index: " +
Twine(shdr.sh_info));
InputSection *target = sections[shdr.sh_info];
if (target)
target->rels = CHECK(obj.relas(shdr), this);
}
}
void ObjectFile::initialize_symbols() {

View File

@ -45,6 +45,11 @@ void InputSection::copy_to(uint8_t *buf) {
memcpy(buf + offset, &data[0], data.size());
}
void InputSection::relocate(uint8_t *buf) {
if (hdr->sh_type == SHT_NOBITS || hdr->sh_size == 0)
return;
}
std::string toString(InputSection *isec) {
return (toString(isec->file) + ":(" + isec->name + ")").str();
}