mirror of
https://github.com/rui314/mold.git
synced 2024-11-14 07:18:42 +03:00
temporary
This commit is contained in:
parent
071c3b2453
commit
9370d89f16
16
mold.h
16
mold.h
@ -337,6 +337,20 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class SymtabSection : public OutputChunk {
|
||||
public:
|
||||
void add(const ELF64LE::Sym &sym, uint64_t name, uint64_t value);
|
||||
|
||||
void copy_to(uint8_t *buf) override {
|
||||
memcpy(buf + shdr.sh_offset, &contents[0], contents.size());
|
||||
}
|
||||
|
||||
uint64_t get_size() const override { return contents.size(); }
|
||||
|
||||
private:
|
||||
std::vector<ELF64LE::Sym> contents;
|
||||
};
|
||||
|
||||
class StringTableSection : public OutputChunk {
|
||||
public:
|
||||
StringTableSection(StringRef name) {
|
||||
@ -368,6 +382,8 @@ extern OutputEhdr *ehdr;
|
||||
extern OutputShdr *shdr;
|
||||
extern OutputPhdr *phdr;
|
||||
extern InterpSection *interp;
|
||||
extern SymtabSection *symtab;
|
||||
extern StringTableSection *strtab;
|
||||
extern StringTableSection *shstrtab;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,8 @@ OutputEhdr *out::ehdr;
|
||||
OutputShdr *out::shdr;
|
||||
OutputPhdr *out::phdr;
|
||||
InterpSection *out::interp;
|
||||
SymtabSection *out::symtab;
|
||||
StringTableSection *out::strtab;
|
||||
StringTableSection *out::shstrtab;
|
||||
|
||||
std::vector<OutputSection *> OutputSection::all_instances;
|
||||
@ -168,3 +170,10 @@ OutputSection::get_instance(StringRef name, uint64_t flags, uint32_t type) {
|
||||
return osec;
|
||||
return new OutputSection(name, flags, type);
|
||||
}
|
||||
|
||||
void SymtabSection::add(const ELF64LE::Sym &sym, uint64_t name, uint64_t value) {
|
||||
contents.push_back(sym);
|
||||
contents.back().st_shndx = get_section_idx(out::shstrtab);
|
||||
contents.back().st_name = name;
|
||||
contents.back().st_value = value;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user