1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-26 01:44:29 +03:00

Improve i386 compatibility

This commit is contained in:
Rui Ueyama 2021-05-19 21:38:29 +09:00
parent d055ab3563
commit 0a8dcc1459
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ void PltSection<I386>::copy_buf(Context<I386> &ctx) {
0xe9, 0, 0, 0, 0, // jmp .PLT0@PC
};
memcpy(ent, data, sizeof(data));
*(u32 *)(ent + 2) = sym->get_gotplt_addr(ctx) - sym->get_plt_addr(ctx);
*(u32 *)(ent + 2) = sym->get_gotplt_addr(ctx) - ctx.got->shdr.sh_addr;
} else {
static const u8 data[] = {
0xff, 0x25, 0, 0, 0, 0, // jmp *foo@GOT

View File

@ -934,7 +934,7 @@ void DynsymSection<E>::copy_buf(Context<E> &ctx) {
} else if (sym.file->is_dso || sym.esym().is_undef()) {
esym.st_shndx = SHN_UNDEF;
esym.st_size = 0;
if (!ctx.arg.shared && sym.has_plt(ctx) && !sym.has_got(ctx)) {
if (!ctx.arg.pic && sym.has_plt(ctx) && !sym.has_got(ctx)) {
// Emit an address for a canonical PLT
esym.st_value = sym.get_plt_addr(ctx);
}