소스 검색

LibELF: Perform .relr.dyn relocations before .rel.dyn

IFUNC resolvers depend on the resolved function's address having been
relocated by the time they are called. This means that relative
relocations have to be done first.

The linker is kind enough to put R_*_RELATIVE before R_*_IRELATIVE in
.rel.dyn, but .relr.dyn contains relative relocations too.
Daniel Bertalan 3 년 전
부모
커밋
ed5f110b40
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      Userland/Libraries/LibELF/DynamicLoader.cpp

+ 1 - 1
Userland/Libraries/LibELF/DynamicLoader.cpp

@@ -197,9 +197,9 @@ void DynamicLoader::do_main_relocations()
         }
     };
 
+    do_relr_relocations();
     m_dynamic_object->relocation_section().for_each_relocation(do_single_relocation);
     m_dynamic_object->plt_relocation_section().for_each_relocation(do_single_relocation);
-    do_relr_relocations();
 }
 
 Result<NonnullRefPtr<DynamicObject>, DlErrorMessage> DynamicLoader::load_stage_3(unsigned flags)