mirror of
https://github.com/rui314/mold.git
synced 2024-12-27 10:23:41 +03:00
temporary
This commit is contained in:
parent
b083d1d955
commit
f6c24ad62a
3
mold.h
3
mold.h
@ -201,7 +201,7 @@ public:
|
||||
const ELF64LE::Shdr &shdr;
|
||||
|
||||
StringRef name;
|
||||
uint64_t addr;
|
||||
uint64_t vaddr;
|
||||
uint64_t fileoff;
|
||||
};
|
||||
|
||||
@ -318,6 +318,7 @@ public:
|
||||
}
|
||||
|
||||
void set_fileoff(uint64_t off) override;
|
||||
void set_vaddr(uint64_t va) override;
|
||||
|
||||
void set_alignment(uint32_t align) { shdr.sh_addralign = align; }
|
||||
|
||||
|
@ -108,10 +108,25 @@ void OutputPhdr::copy_to(uint8_t *buf) {
|
||||
}
|
||||
|
||||
void OutputSection::set_fileoff(uint64_t off) {
|
||||
if (shdr.sh_type & SHT_NOBITS) {
|
||||
shdr.sh_offset = off;
|
||||
for (InputSection *isec : chunks)
|
||||
isec->fileoff = off;
|
||||
return;
|
||||
}
|
||||
|
||||
shdr.sh_offset = off;
|
||||
for (int i = 0; i < chunks.size(); i++) {
|
||||
chunks[i]->fileoff = off;
|
||||
off += chunks[i]->shdr.sh_size;
|
||||
for (InputSection *isec : chunks) {
|
||||
isec->fileoff = off;
|
||||
off += isec->shdr.sh_size;
|
||||
}
|
||||
}
|
||||
|
||||
void OutputSection::set_vaddr(uint64_t va) {
|
||||
shdr.sh_addr = va;
|
||||
for (InputSection *isec : chunks) {
|
||||
isec->vaddr = va;
|
||||
va += isec->shdr.sh_size;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user