mirror of
https://github.com/rui314/mold.git
synced 2024-09-22 10:27:48 +03:00
temporary
This commit is contained in:
parent
1bfb79e67f
commit
bde5c4af0f
9
main.cc
9
main.cc
@ -143,10 +143,6 @@ static std::vector<OutputSection *> get_output_sections() {
|
||||
return vec;
|
||||
}
|
||||
|
||||
static std::vector<ELF64LE::Phdr> create_phdrs() {
|
||||
return {};
|
||||
}
|
||||
|
||||
static std::vector<ELF64LE::Shdr *>
|
||||
create_shdrs(ArrayRef<OutputChunk *> output_chunks) {
|
||||
static ELF64LE::Shdr null_entry = {};
|
||||
@ -304,7 +300,7 @@ int main(int argc, char **argv) {
|
||||
output_chunks.push_back(out::shdr);
|
||||
|
||||
// Create program header contents.
|
||||
out::phdr->hdr = create_phdrs();
|
||||
out::phdr->construct(output_chunks);
|
||||
|
||||
// Assign offsets to input sections
|
||||
uint64_t filesize = 0;
|
||||
@ -316,9 +312,6 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
// Fill section header.
|
||||
fill_shdrs(output_chunks);
|
||||
|
||||
{
|
||||
MyTimer t("unlink", before_copy);
|
||||
unlink_async(tg, config.output);
|
||||
|
16
mold.h
16
mold.h
@ -259,15 +259,21 @@ public:
|
||||
// Program header
|
||||
class OutputPhdr : public OutputChunk {
|
||||
public:
|
||||
void copy_to(uint8_t *buf) override {
|
||||
memcpy(buf + offset, &hdr[0], get_size());
|
||||
}
|
||||
void copy_to(uint8_t *buf) override;
|
||||
|
||||
uint64_t get_size() const override {
|
||||
return hdr.size() * sizeof(ELF64LE::Phdr[0]);
|
||||
return entries.size() * sizeof(ELF64LE::Phdr);
|
||||
}
|
||||
|
||||
std::vector<ELF64LE::Phdr> hdr;
|
||||
void construct(std::vector<OutputChunk *> §ions);
|
||||
|
||||
private:
|
||||
struct Phdr {
|
||||
ELF64LE::Phdr phdr;
|
||||
std::vector<InputSection *> members;
|
||||
};
|
||||
|
||||
std::vector<Phdr> entries;
|
||||
};
|
||||
|
||||
// Sections
|
||||
|
@ -33,6 +33,15 @@ void OutputEhdr::relocate(uint8_t *buf) {
|
||||
hdr->e_shstrndx = out::shstrtab->index;
|
||||
}
|
||||
|
||||
void OutputPhdr::copy_to(uint8_t *buf) {
|
||||
auto *p = (ELF64LE::Phdr *)buf;
|
||||
for (Phdr &ent : entries)
|
||||
*p++ = ent.phdr;
|
||||
}
|
||||
|
||||
void OutputPhdr::construct(std::vector<OutputChunk *> &chunks) {
|
||||
}
|
||||
|
||||
void OutputSection::set_offset(uint64_t off) {
|
||||
offset = off;
|
||||
for (int i = 0; i < chunks.size(); i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user