1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-14 07:18:42 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-10-15 19:55:51 +09:00
parent 0fbdabcd84
commit 961205a662
2 changed files with 32 additions and 10 deletions

View File

@ -19,8 +19,9 @@
#include "tbb/partitioner.h"
#include <atomic>
#include <cstdlib>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
#include <unordered_set>
@ -159,27 +160,24 @@ protected:
class OutputEhdr : public OutputChunk {
public:
uint64_t get_size() const override {
return sizeof(hdr);
}
void writeTo(uint8_t *buf) override;
uint64_t get_size() const override;
ELF64LE::Ehdr hdr;
};
class OutputShdr : public OutputChunk {
public:
uint64_t get_size() const override {
return hdr.size() * sizeof(hdr[0]);
}
void writeTo(uint8_t *buf) override;
uint64_t get_size() const override;
std::vector<ELF64LE::Shdr> hdr;
};
class OutputPhdr : public OutputChunk {
public:
uint64_t get_size() const override {
return hdr.size() * sizeof(hdr[0]);
}
void writeTo(uint8_t *buf) override;
uint64_t get_size() const override;
std::vector<ELF64LE::Phdr> hdr;
};

View File

@ -1,5 +1,29 @@
#include "chibild.h"
void OutputEhdr::writeTo(uint8_t *buf) {
memcpy(buf + offset, &hdr, sizeof(hdr));
}
uint64_t OutputEhdr::get_size() const {
return sizeof(hdr);
}
void OutputShdr::writeTo(uint8_t *buf) {
memcpy(buf + offset, &hdr[0], get_size());
}
uint64_t OutputShdr::get_size() const {
return hdr.size() * sizeof(hdr[0]);
}
void OutputPhdr::writeTo(uint8_t *buf) {
memcpy(buf + offset, &hdr[0], get_size());
}
uint64_t OutputPhdr::get_size() const {
return hdr.size() * sizeof(hdr[0]);
}
OutputSection::OutputSection(StringRef name) : name(name) {}
uint64_t OutputSection::get_size() const {