@@ -320,6 +320,45 @@ static LLEXT_CONST uint8_t multi_file_ext[] ELF_ALIGN = {
320320LLEXT_LOAD_UNLOAD (multi_file )
321321#endif
322322
323+ #ifndef CONFIG_USERSPACE
324+ static LLEXT_CONST uint8_t export_dependent_ext [] ELF_ALIGN = {
325+ #include "export_dependent.inc"
326+ };
327+
328+ static LLEXT_CONST uint8_t export_dependency_ext [] ELF_ALIGN = {
329+ #include "export_dependency.inc"
330+ };
331+
332+ ZTEST (llext , test_inter_ext )
333+ {
334+ const void * dependency_buf = export_dependency_ext ;
335+ const void * dependent_buf = export_dependent_ext ;
336+ struct llext_buf_loader buf_loader_dependency =
337+ LLEXT_BUF_LOADER (dependency_buf , sizeof (hello_world_ext ));
338+ struct llext_buf_loader buf_loader_dependent =
339+ LLEXT_BUF_LOADER (dependent_buf , sizeof (export_dependent_ext ));
340+ struct llext_loader * loader_dependency = & buf_loader_dependency .loader ;
341+ struct llext_loader * loader_dependent = & buf_loader_dependent .loader ;
342+ const struct llext_load_param ldr_parm = LLEXT_LOAD_PARAM_DEFAULT ;
343+ struct llext * ext_dependency = NULL , * ext_dependent = NULL ;
344+ int ret = llext_load (loader_dependency , "inter_ext_dependency" , & ext_dependency , & ldr_parm );
345+
346+ zassert_ok (ret , "dependency load should succeed" );
347+
348+ ret = llext_load (loader_dependent , "export_dependent" , & ext_dependent , & ldr_parm );
349+
350+ zassert_ok (ret , "dependent load should succeed" );
351+
352+ int (* test_entry_fn )() = llext_find_sym (& ext_dependent -> exp_tab , "test_entry" );
353+
354+ zassert_not_null (test_entry_fn , "test_dependent should be an exported symbol" );
355+ test_entry_fn ();
356+
357+ llext_unload (& ext_dependent );
358+ llext_unload (& ext_dependency );
359+ }
360+ #endif
361+
323362#if defined(CONFIG_LLEXT_TYPE_ELF_RELOCATABLE ) && defined(CONFIG_XTENSA )
324363static LLEXT_CONST uint8_t pre_located_ext [] ELF_ALIGN = {
325364 #include "pre_located.inc"
0 commit comments