1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-27 10:23:41 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-10-25 12:53:07 +09:00
parent 98b1d165dc
commit 89d7780116

View File

@ -51,11 +51,15 @@ void OutputPhdr::construct(std::vector<OutputChunk *> &chunks) {
entries.push_back({phdr, members});
};
// Create a PT_PHDR for the program header itself.
add(PT_PHDR, PF_R, {out::phdr});
// Create an PT_INTERP.
if (out::interp)
add(PT_INTERP, PF_R, {out::interp});
add(PT_LOAD, PF_R, {});
// Create PT_LOAD segments.
add(PT_LOAD, PF_R, {});
for (OutputChunk *chunk : chunks) {
if (!(chunk->hdr.sh_flags & SHF_ALLOC))
break;
@ -66,6 +70,16 @@ void OutputPhdr::construct(std::vector<OutputChunk *> &chunks) {
else
add(PT_LOAD, flags, {chunk});
}
// Create a PT_TLS.
for (int i = 0; i < chunks.size(); i++) {
if (chunks[i]->hdr.sh_flags & SHF_TLS) {
std::vector<OutputChunk *> vec = {chunks[i++]};
while (i < chunks.size() && (chunks[i]->hdr.sh_flags & SHF_TLS))
vec.push_back(chunks[i++]);
add(PT_TLS, to_phdr_flags(chunks[i]->hdr.sh_flags), vec);
}
}
}
void OutputSection::set_offset(uint64_t off) {