From 59265b9b769a0423700bd5a34bc9933e859e51c2 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 2 Mar 2022 15:34:58 +1030 Subject: [PATCH 6/6] elf: ELF_DYNAMIC_RELOCATE: order relr before rel/rela ld goes to some trouble to sort relative relocs first, so that ifunc resolvers that require relocated got entries have them relocated. Preserve that ordering. diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h index 320a9029f2..252f407a12 100644 --- a/elf/dynamic-link.h +++ b/elf/dynamic-link.h @@ -188,10 +188,10 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], do { \ int edr_lazy = elf_machine_runtime_setup ((map), (scope), (lazy), \ (consider_profile)); \ - ELF_DYNAMIC_DO_REL ((map), (scope), edr_lazy, skip_ifunc); \ - ELF_DYNAMIC_DO_RELA ((map), (scope), edr_lazy, skip_ifunc); \ if (((map) != &GL(dl_rtld_map) || DO_RTLD_BOOTSTRAP)) \ ELF_DYNAMIC_DO_RELR (map); \ + ELF_DYNAMIC_DO_REL ((map), (scope), edr_lazy, skip_ifunc); \ + ELF_DYNAMIC_DO_RELA ((map), (scope), edr_lazy, skip_ifunc); \ } while (0) #endif