Skip to content

Commit

Permalink
More correct attempt at R_*_COPY fixup.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 22, 2013
1 parent 0889c71 commit 2dddb01
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mojoelf.c
Expand Up @@ -931,9 +931,16 @@ static int do_fixup(ElfContext *ctx, const uint32 r_type, const uint32 r_sym,
// There are way more than these, but these seem to be the
// only ones average libraries use.
// Note libc.so.6 itself also seems to use: R_*_64, R_*_TPOFF64
// !!! FIXME: R_COPY is probably wrong.
// !!! FIXME: This is all x86-specific. Research x86_64.
case R_COPY:
if (!r_sym)
DLOPEN_FAIL("Bogus copy fixup");
// !!! FIXME: this should check the source and dest symbols,
// !!! FIXME: use the smaller size (but they _should_ match
// !!! FIXME: if everything is built correctly. Naturally, this
// !!! FIXME: will fail to be true eventually).
memcpy(fixup, (void *) addr, (ctx->symtab+r_sym)->st_size);
break;
case R_GLOB_DATA:
case R_JUMP_SLOT:
*fixup = addr;
Expand Down

0 comments on commit 2dddb01

Please sign in to comment.