1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 10:27:48 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-11-17 13:30:33 +09:00
parent 8e313e7216
commit c91e9f95ee
3 changed files with 19 additions and 6 deletions

View File

@ -823,8 +823,7 @@ int main(int argc, char **argv) {
if (!config.is_static) {
out::interp = new InterpSection;
out::dynamic = new DynamicSection;
out::reldyn = new SpecialSection(".rela.dyn", SHT_RELA, SHF_ALLOC, 8,
sizeof(ELF64LE::Rela));
out::reldyn = new RelDynSection;
out::hash = new HashSection;
}
@ -959,9 +958,6 @@ int main(int argc, char **argv) {
out::symtab->shdr.sh_link = out::strtab->shndx;
out::relplt->shdr.sh_link = out::dynsym->shndx;
if (out::reldyn)
out::reldyn->shdr.sh_link = out::dynsym->shndx;
for (OutputChunk *chunk : chunks)
chunk->update_shdr();

15
mold.h
View File

@ -439,6 +439,19 @@ public:
}
};
class RelDynSection : public OutputChunk {
public:
RelDynSection() : OutputChunk(SYNTHETIC) {
name = ".rela.dyn";
shdr.sh_type = llvm::ELF::SHT_RELA;
shdr.sh_flags = llvm::ELF::SHF_ALLOC;
shdr.sh_entsize = sizeof(ELF64LE::Rela);
shdr.sh_addralign = 8;
}
void update_shdr() override;
};
class StrtabSection : public OutputChunk {
public:
StrtabSection(StringRef name, u64 flags) : OutputChunk(SYNTHETIC) {
@ -587,7 +600,7 @@ inline InterpSection *interp;
inline SpecialSection *got;
inline GotPltSection *gotplt;
inline SpecialSection *relplt;
inline SpecialSection *reldyn;
inline RelDynSection *reldyn;
inline DynamicSection *dynamic;
inline StrtabSection *strtab;
inline DynstrSection *dynstr;

View File

@ -179,6 +179,10 @@ static std::vector<u64> create_dynamic_section() {
return vec;
}
void RelDynSection::update_shdr() {
shdr.sh_link = out::dynsym->shndx;
}
void ShstrtabSection::update_shdr() {
shdr.sh_size = 1;
for (OutputChunk *chunk : out::chunks) {