1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-20 01:18:53 +03:00
mold/output_sections.cc
2020-10-20 15:04:18 +09:00

23 lines
455 B
C++

#include "chibild.h"
OutputSection::OutputSection(StringRef name) : name(name) {}
uint64_t OutputSection::get_size() const {
assert(size >= 0);
return size;
}
void OutputSection::set_offset(uint64_t off) {
offset = off;
for (InputSection *sec : sections) {
sec->offset = off;
off += sec->get_size();
}
size = off - offset;
}
void OutputSection::writeTo(uint8_t *buf) {
for (InputSection *sec : sections)
sec->writeTo(buf);
}