From 92fd50c069c0ddd3267d6ef87791d6adff35e40d Mon Sep 17 00:00:00 2001 From: kib Date: Tue, 27 Nov 2018 13:14:13 +0000 Subject: [PATCH] MFC r340675: rtld: when immediate bind mode is requested, process irelocs in PLT immediately after other PLT relocs. --- libexec/rtld-elf/rtld.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index dbbdbace34e..1fc83be3bfd 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -132,6 +132,7 @@ static int relocate_object(Obj_Entry *obj, bool bind_now, Obj_Entry *rtldobj, int flags, RtldLockState *lockstate); static int relocate_objects(Obj_Entry *, bool, Obj_Entry *, int, RtldLockState *); +static int resolve_object_ifunc(Obj_Entry *, bool, int, RtldLockState *); static int resolve_objects_ifunc(Obj_Entry *first, bool bind_now, int flags, RtldLockState *lockstate); static int rtld_dirname(const char *, char *); @@ -2873,9 +2874,11 @@ relocate_object(Obj_Entry *obj, bool bind_now, Obj_Entry *rtldobj, if (reloc_plt(obj) == -1) return (-1); /* Relocate the jump slots if we are doing immediate binding. */ - if (obj->bind_now || bind_now) - if (reloc_jmpslots(obj, flags, lockstate) == -1) + if (obj->bind_now || bind_now) { + if (reloc_jmpslots(obj, flags, lockstate) == -1 || + resolve_object_ifunc(obj, true, flags, lockstate) == -1) return (-1); + } /* * Process the non-PLT IFUNC relocations. The relocations are -- 2.45.0