Hi Mark,
The ifunc1, ifunc2, and ifunc3 tests currently fail on x86_64 x32 ABI
because the testcase crashes at runtime. The testcases run fine when not
prelinked.
In the case of ifunc1, the test tries to call the "lib2t2" function
directly, instead of using it as an indirect call, which leads to the
testcase aborting. In real code this would not cause an immediate crash,
but presumably would lead to undefined behaviour.
The attached patch fixes the problem by converting R_X86_64_32 conflict
relocations to R_X86_64_IRELATIVE (in the same way as R_X86_64_64
relocations are).
I've tested this with the cross_prelink branch and a suitably configured
cross-toolchain. I expect it would be fine on the master branch also,
but I can't test that.
Andrew Stubbs
Mentor Graphics/CodeSourcery
2016-12-09 Andrew Stubbs <a...@codesourcery.com>
* src/arch-x86_64.c (x86_64_prelink_conflict_rela): Also convert
R_X86_64_32 conflicts to R_X86_64_IRELATIVE for ifuncs.
---
src/arch-x86_64.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/arch-x86_64.c b/src/arch-x86_64.c
index dae66cd..6a97370 100644
--- a/src/arch-x86_64.c
+++ b/src/arch-x86_64.c
@@ -332,16 +332,13 @@ x86_64_prelink_conflict_rela (DSO *dso, struct prelink_info *info,
ret->r_info = GELF_R_INFO (0, (gelf_getclass (dso->elf) == ELFCLASS32 ? R_X86_64_32 : R_X86_64_64));
/* FALLTHROUGH */
case R_X86_64_JUMP_SLOT:
+ case R_X86_64_32:
case R_X86_64_64:
case R_X86_64_IRELATIVE:
ret->r_addend = value + rela->r_addend;
if (conflict != NULL && conflict->ifunc)
ret->r_info = GELF_R_INFO (0, R_X86_64_IRELATIVE);
break;
- case R_X86_64_32:
- value += rela->r_addend;
- ret->r_addend = value;
- break;
case R_X86_64_PC32:
ret->r_addend = value + rela->r_addend - rela->r_offset;
ret->r_info = GELF_R_INFO (0, R_X86_64_32);
--
2.8.1
--
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto