Skip to content
Snippets Groups Projects
Commit 4a4cdafa authored by Alessandro Di Federico's avatar Alessandro Di Federico
Browse files

Link libmy against the loader's executable

parent 4cb309fa
No related branches found
No related tags found
No related merge requests found
......@@ -50,23 +50,12 @@ add_library(eld STATIC dl.c eld.c elf-object.c)
add_executable(loader test.c)
target_link_libraries(loader eld)
# Create a copy of the loader executable forcing it to a shared object
# so it can be dynamically linked against other shared libraries
add_custom_command(
TARGET loader
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/loader
${CMAKE_CURRENT_BINARY_DIR}/main
COMMAND dd if=${CMAKE_CURRENT_SOURCE_DIR}/shared-library-id.bin
of=main seek=16 bs=1 conv=notrunc
)
# Test dynamic libraries
add_library(your SHARED libyour.c)
add_library(my SHARED libmy.c)
# Link libmy against libyour and the main executable
target_link_libraries(my your ":main")
target_link_libraries(my your ":loader")
add_dependencies(my loader)
# Simulation targets
......
......@@ -15,5 +15,4 @@ the previously loaded shared objects are searched in load order.
* Import sys/queue.h
* Add support for having different address spaces
* Add support for TLS relocations
* Let eld_init and eld_finish be called from crt
* Documentation
......@@ -13,7 +13,7 @@ int eld_init() {
SLIST_INIT(&elves);
elf_object_t *main_elf = eld_elf_object_new(STR_PAR("main"));
elf_object_t *main_elf = eld_elf_object_new(STR_PAR("loader"));
RETURN_ON_NULL(main_elf);
main_elf->dynamic_info_section = &_DYNAMIC;
RETURN_ON_ERROR(eld_elf_object_handle_dyn(main_elf));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment