1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-28 19:04:27 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-10-22 19:19:20 +09:00
parent 3f74a8a2fa
commit d5e912f85c
2 changed files with 16 additions and 1 deletions

View File

@ -86,6 +86,17 @@ void InputSection::relocate(uint8_t *buf) {
}
}
uint64_t StringTableSection::addString(StringRef s) {
uint64_t ret = contents.size();
contents += s.str();
contents += "\0";
return ret;
}
void StringTableSection::copy_to(uint8_t *buf) {
memcpy(buf + offset, &contents[0], contents.size());
}
std::string toString(InputSection *isec) {
return (toString(isec->file) + ":(" + isec->name + ")").str();
}

6
mold.h
View File

@ -201,7 +201,10 @@ public:
uint64_t addString(StringRef s);
void copy_to(uint8_t *buf) override;
uint64_t get_size() const override { return 0; }
uint64_t get_size() const override { return contents.size(); }
private:
std::string contents;
};
class GenericSection : public InputChunk {
@ -337,6 +340,7 @@ namespace out {
extern OutputEhdr *ehdr;
extern OutputShdr *shdr;
extern OutputPhdr *phdr;
extern StringTableSection *shstrtab;
}
//