mirror of
https://github.com/rui314/mold.git
synced 2024-10-05 09:07:10 +03:00
Rename
This commit is contained in:
parent
f89e0aa367
commit
48c8321344
8
main.cc
8
main.cc
@ -217,8 +217,8 @@ static void create_synthetic_sections() {
|
||||
add(out::dynsym = new DynsymSection);
|
||||
add(out::dynstr = new DynstrSection);
|
||||
add(out::eh_frame = new EhFrameSection);
|
||||
add(out::copyrel = new CopyrelSection(".dynbss"));
|
||||
add(out::copyrel_relro = new CopyrelSection(".dynbss.rel.ro"));
|
||||
add(out::dynbss = new DynbssSection(".dynbss"));
|
||||
add(out::dynbss_relro = new DynbssSection(".dynbss.rel.ro"));
|
||||
|
||||
if (!config.dynamic_linker.empty())
|
||||
add(out::interp = new InterpSection);
|
||||
@ -581,9 +581,9 @@ static void scan_rels() {
|
||||
sym->copyrel_readonly = file->is_readonly(sym);
|
||||
|
||||
if (sym->copyrel_readonly)
|
||||
out::copyrel_relro->add_symbol(sym);
|
||||
out::dynbss_relro->add_symbol(sym);
|
||||
else
|
||||
out::copyrel->add_symbol(sym);
|
||||
out::dynbss->add_symbol(sym);
|
||||
|
||||
for (Symbol *alias : file->find_aliases(sym)) {
|
||||
alias->has_copyrel = true;
|
||||
|
14
mold.h
14
mold.h
@ -837,13 +837,13 @@ public:
|
||||
static constexpr i64 HEADER_SIZE = 12;
|
||||
};
|
||||
|
||||
class CopyrelSection : public OutputChunk {
|
||||
class DynbssSection : public OutputChunk {
|
||||
public:
|
||||
CopyrelSection(std::string_view name) : OutputChunk(SYNTHETIC) {
|
||||
DynbssSection(std::string_view name) : OutputChunk(SYNTHETIC) {
|
||||
this->name = name;
|
||||
shdr.sh_type = SHT_NOBITS;
|
||||
shdr.sh_flags = SHF_ALLOC | SHF_WRITE;
|
||||
shdr.sh_addralign = 32;
|
||||
shdr.sh_addralign = 64;
|
||||
}
|
||||
|
||||
void add_symbol(Symbol *sym);
|
||||
@ -1291,8 +1291,8 @@ inline SymtabSection *symtab;
|
||||
inline DynsymSection *dynsym;
|
||||
inline EhFrameSection *eh_frame;
|
||||
inline EhFrameHdrSection *eh_frame_hdr;
|
||||
inline CopyrelSection *copyrel;
|
||||
inline CopyrelSection *copyrel_relro;
|
||||
inline DynbssSection *dynbss;
|
||||
inline DynbssSection *dynbss_relro;
|
||||
inline VersymSection *versym;
|
||||
inline VerneedSection *verneed;
|
||||
inline VerdefSection *verdef;
|
||||
@ -1387,8 +1387,8 @@ inline u64 Symbol::get_addr() const {
|
||||
|
||||
if (has_copyrel) {
|
||||
return copyrel_readonly
|
||||
? out::copyrel_relro->shdr.sh_addr + value
|
||||
: out::copyrel->shdr.sh_addr + value;
|
||||
? out::dynbss_relro->shdr.sh_addr + value
|
||||
: out::dynbss->shdr.sh_addr + value;
|
||||
}
|
||||
|
||||
if (plt_idx != -1 && esym->st_type == STT_GNU_IFUNC)
|
||||
|
@ -600,8 +600,8 @@ i64 GotSection::get_reldyn_size() const {
|
||||
if (tlsld_idx != -1)
|
||||
n++;
|
||||
|
||||
n += out::copyrel->symbols.size();
|
||||
n += out::copyrel_relro->symbols.size();
|
||||
n += out::dynbss->symbols.size();
|
||||
n += out::dynbss_relro->symbols.size();
|
||||
|
||||
return n * sizeof(ElfRela);
|
||||
}
|
||||
@ -643,10 +643,10 @@ void GotSection::copy_buf() {
|
||||
if (tlsld_idx != -1)
|
||||
*rel++ = {get_tlsld_addr(), R_X86_64_DTPMOD64, 0, 0};
|
||||
|
||||
for (Symbol *sym : out::copyrel->symbols)
|
||||
for (Symbol *sym : out::dynbss->symbols)
|
||||
*rel++ = {sym->get_addr(), R_X86_64_COPY, sym->dynsym_idx, 0};
|
||||
|
||||
for (Symbol *sym : out::copyrel_relro->symbols)
|
||||
for (Symbol *sym : out::dynbss_relro->symbols)
|
||||
*rel++ = {sym->get_addr(), R_X86_64_COPY, sym->dynsym_idx, 0};
|
||||
}
|
||||
|
||||
@ -860,7 +860,7 @@ void DynsymSection::copy_buf() {
|
||||
|
||||
if (sym.has_copyrel) {
|
||||
esym.st_shndx = sym.copyrel_readonly
|
||||
? out::copyrel_relro->shndx : out::copyrel->shndx;
|
||||
? out::dynbss_relro->shndx : out::dynbss->shndx;
|
||||
esym.st_value = sym.get_addr();
|
||||
} else if (sym.file->is_dso || sym.esym->is_undef()) {
|
||||
esym.st_shndx = SHN_UNDEF;
|
||||
@ -1290,7 +1290,7 @@ u64 EhFrameSection::get_addr(const Symbol &sym) {
|
||||
Fatal() << isec.file << ": .eh_frame has bad symbol: " << sym;
|
||||
}
|
||||
|
||||
void CopyrelSection::add_symbol(Symbol *sym) {
|
||||
void DynbssSection::add_symbol(Symbol *sym) {
|
||||
if (sym->has_copyrel)
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user