1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-28 02:44:48 +03:00
This commit is contained in:
Rui Ueyama 2021-03-31 14:16:09 +09:00
parent ceaab19706
commit f9f0d90791
3 changed files with 6 additions and 5 deletions

6
mold.h
View File

@ -579,7 +579,7 @@ public:
this->name = ".dynamic"; this->name = ".dynamic";
this->shdr.sh_type = SHT_DYNAMIC; this->shdr.sh_type = SHT_DYNAMIC;
this->shdr.sh_flags = SHF_ALLOC | SHF_WRITE; this->shdr.sh_flags = SHF_ALLOC | SHF_WRITE;
this->shdr.sh_addralign = 8; this->shdr.sh_addralign = E::wordsize;
this->shdr.sh_entsize = sizeof(ElfDyn<E>); this->shdr.sh_entsize = sizeof(ElfDyn<E>);
} }
@ -594,7 +594,7 @@ public:
this->name = ".symtab"; this->name = ".symtab";
this->shdr.sh_type = SHT_SYMTAB; this->shdr.sh_type = SHT_SYMTAB;
this->shdr.sh_entsize = sizeof(ElfSym<E>); this->shdr.sh_entsize = sizeof(ElfSym<E>);
this->shdr.sh_addralign = 8; this->shdr.sh_addralign = E::wordsize;
} }
void update_shdr(Context<E> &ctx) override; void update_shdr(Context<E> &ctx) override;
@ -759,7 +759,7 @@ public:
this->name = ".gnu.version_r"; this->name = ".gnu.version_r";
this->shdr.sh_type = SHT_GNU_VERNEED; this->shdr.sh_type = SHT_GNU_VERNEED;
this->shdr.sh_flags = SHF_ALLOC; this->shdr.sh_flags = SHF_ALLOC;
this->shdr.sh_addralign = 8; this->shdr.sh_addralign = E::wordsize;
} }
void update_shdr(Context<E> &ctx) override; void update_shdr(Context<E> &ctx) override;

View File

@ -119,7 +119,7 @@ std::vector<ElfPhdr<E>> create_phdr(Context<E> &ctx) {
}; };
// Create a PT_PHDR for the program header itself. // Create a PT_PHDR for the program header itself.
define(PT_PHDR, PF_R, 8, ctx.phdr); define(PT_PHDR, PF_R, E::wordsize, ctx.phdr);
// Create a PT_INTERP. // Create a PT_INTERP.
if (ctx.interp) if (ctx.interp)
@ -545,7 +545,7 @@ OutputSection<E>::OutputSection(std::string_view name, u32 type, u64 flags)
template <typename E> template <typename E>
OutputSection<E> * OutputSection<E> *
OutputSection<E>::get_instance(std::string_view name, u64 type, u64 flags) { OutputSection<E>::get_instance(std::string_view name, u64 type, u64 flags) {
if (name == ".eh_frame" && type == SHT_X86_64_UNWIND) if (E::e_machine == EM_X86_64 && type == SHT_X86_64_UNWIND)
type = SHT_PROGBITS; type = SHT_PROGBITS;
name = get_output_name(name); name = get_output_name(name);
@ -789,6 +789,7 @@ void PltGotSection<E>::copy_buf(Context<E> &ctx) {
template <typename E> template <typename E>
void RelPltSection<E>::update_shdr(Context<E> &ctx) { void RelPltSection<E>::update_shdr(Context<E> &ctx) {
this->shdr.sh_link = ctx.dynsym->shndx; this->shdr.sh_link = ctx.dynsym->shndx;
this->shdr.sh_info = ctx.gotplt->shndx;
} }
template <typename E> template <typename E>