mirror of
https://github.com/rui314/mold.git
synced 2024-12-27 10:23:41 +03:00
wip
This commit is contained in:
parent
92725015a5
commit
dbb742b70c
17
passes.cc
17
passes.cc
@ -814,6 +814,15 @@ i64 set_osec_offsets(Context<E> &ctx) {
|
||||
return fileoff;
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
static i64 get_num_irelative_relocs(Context<E> &ctx) {
|
||||
i64 n = 0;
|
||||
for (Symbol<E> *sym : ctx.got->got_syms)
|
||||
if (sym->get_type() == STT_GNU_IFUNC)
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
void fix_synthetic_symbols(Context<E> &ctx) {
|
||||
auto start = [](Symbol<E> *sym, OutputChunk<E> *chunk) {
|
||||
@ -854,13 +863,9 @@ void fix_synthetic_symbols(Context<E> &ctx) {
|
||||
start(ctx.__rel_iplt_start, ctx.reldyn);
|
||||
|
||||
// __rel_iplt_end
|
||||
i64 num_irelatives = 0;
|
||||
for (Symbol<E> *sym : ctx.got->got_syms)
|
||||
if (sym->get_type() == STT_GNU_IFUNC)
|
||||
num_irelatives++;
|
||||
ctx.__rel_iplt_end->shndx = ctx.reldyn->shndx;
|
||||
ctx.__rel_iplt_end->value =
|
||||
ctx.reldyn->shdr.sh_addr + num_irelatives * sizeof(ElfRel<E>);
|
||||
ctx.__rel_iplt_end->value = ctx.reldyn->shdr.sh_addr +
|
||||
get_num_irelative_relocs(ctx) * sizeof(ElfRel<E>);
|
||||
|
||||
// __{init,fini}_array_{start,end}
|
||||
for (OutputChunk<E> *chunk : ctx.chunks) {
|
||||
|
Loading…
Reference in New Issue
Block a user