1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-29 11:24:36 +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>
create_shdrs(ArrayRef<OutputChunk *> output_chunks) {
std::vector<ELF64LE::Shdr> vec;
vec.push_back({});
for (OutputChunk *chunk : output_chunks)
if (ELF64LE::Shdr *hdr = chunk->get_shdr())
if (const ELF64LE::Shdr *hdr = chunk->get_shdr())
vec.push_back(*hdr);
return vec;
}

5
mold.h
View File

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