1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 18:40:59 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-10-26 10:03:17 +09:00
parent fc7d792853
commit da438af6ef
3 changed files with 5 additions and 4 deletions

View File

@ -320,7 +320,7 @@ int main(int argc, char **argv) {
int i = 0;
while (i < output_chunks.size() && !output_chunks[i]->is_bss()) {
int j = i + 1;
while (j < output_chunks.size() && !output_chunks[j]->starts_segment &&
while (j < output_chunks.size() && !output_chunks[j]->starts_new_ptload &&
!output_chunks[j]->is_bss())
j++;
@ -366,7 +366,7 @@ int main(int argc, char **argv) {
if (last->is_bss())
fileoff = last->shdr.sh_offset;
else
fileoff = last->shdr.sh_offset + last->shdr.sh_size;
fileoff = last->shdr.sh_offset + last->get_filesz();
}
for (OutputChunk *chunk : output_chunks) {

2
mold.h
View File

@ -234,7 +234,7 @@ public:
virtual uint64_t get_filesz() const = 0;
StringRef name;
bool starts_segment = false;
bool starts_new_ptload = false;
ELF64LE::Shdr shdr = {};
};

View File

@ -100,7 +100,8 @@ void OutputPhdr::construct(std::vector<OutputChunk *> &chunks) {
ent.phdr.p_align = std::max(ent.phdr.p_align, chunk->shdr.sh_addralign);
for (Phdr &ent : entries)
ent.members.front()->starts_segment = true;
if (ent.phdr.p_type == PT_LOAD)
ent.members.front()->starts_new_ptload = true;
}
void OutputPhdr::copy_to(uint8_t *buf) {