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

temporary

This commit is contained in:
Rui Ueyama 2020-10-21 09:50:21 +09:00
parent 0fdd833ac4
commit 92dbc24c00
2 changed files with 5 additions and 3 deletions

View File

@ -116,8 +116,9 @@ static std::vector<ELF64LE::Phdr> create_phdrs() {
static std::vector<ELF64LE::Shdr> static std::vector<ELF64LE::Shdr>
create_shdrs(ArrayRef<OutputChunk *> output_chunks) { create_shdrs(ArrayRef<OutputChunk *> output_chunks) {
std::vector<ELF64LE::Shdr> vec; std::vector<ELF64LE::Shdr> vec;
vec.push_back({});
for (OutputChunk *chunk : output_chunks) for (OutputChunk *chunk : output_chunks)
if (ELF64LE::Shdr *hdr = chunk->get_shdr()) if (const ELF64LE::Shdr *hdr = chunk->get_shdr())
vec.push_back(*hdr); vec.push_back(*hdr);
return vec; return vec;
} }

5
mold.h
View File

@ -243,7 +243,7 @@ public:
uint64_t get_offset() const { return offset; } uint64_t get_offset() const { return offset; }
virtual uint64_t get_size() const = 0; virtual uint64_t get_size() const = 0;
virtual StringRef get_name() const { return ""; } virtual StringRef get_name() const { return ""; }
virtual ELF64LE::Shdr *get_shdr() const { return nullptr; } virtual const ELF64LE::Shdr *get_shdr() const { return nullptr; }
protected: protected:
int64_t offset = -1; int64_t offset = -1;
@ -314,12 +314,13 @@ public:
void set_offset(uint64_t off) override; void set_offset(uint64_t off) override;
StringRef get_name() const override { return name; } StringRef get_name() const override { return name; }
ELF64LE::Shdr *get_shdr() const override { return nullptr; } const ELF64LE::Shdr *get_shdr() const override { return &hdr; }
std::vector<InputChunk *> chunks; std::vector<InputChunk *> chunks;
StringRef name; StringRef name;
private: private:
ELF64LE::Shdr hdr = {};
uint64_t file_offset = 0; uint64_t file_offset = 0;
uint64_t on_file_size = -1; uint64_t on_file_size = -1;
}; };