add_darling_exe improvements, pass correct argc to dyld

This commit is contained in:
Lubos Dolezel 2017-01-17 15:42:31 +01:00
parent 37e922d770
commit 864c4942b1
3 changed files with 4 additions and 4 deletions

View File

@ -12,7 +12,7 @@ FUNCTION(add_darling_executable exe)
add_executable(${exe} ${files})
set_property(TARGET ${exe} APPEND_STRING PROPERTY
LINK_FLAGS " ${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_BINARY_DIR}/src/csu/CMakeFiles/csu.dir ")
LINK_FLAGS " ${CMAKE_EXE_LINKER_FLAGS} -nostdlib ${CMAKE_BINARY_DIR}/src/csu/CMakeFiles/csu.dir/crt1.10.6.o ")
use_ld64(${exe})
add_dependencies(${exe} csu)
ENDFUNCTION(add_darling_executable)

View File

@ -44,7 +44,7 @@ target_link_libraries(system_dyld PRIVATE system_c system_kernel compiler_rt lau
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_SAVED} -nostdlib")
add_darling_executable(system_loader
add_executable(system_loader
src/dyldAPIs.cpp
src/dyld.cpp
src/dyld_gdb.cpp
@ -65,7 +65,7 @@ add_darling_executable(system_loader
hell.c
)
#use_ld64(system_loader)
use_ld64(system_loader)
set_target_properties(system_loader PROPERTIES OUTPUT_NAME "dyld")
set_property(TARGET system_loader APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-dylinker -Wl,-dead_strip -nostdlib -Wl,-e,__dyld_start")
target_link_libraries(system_loader libc_static system_blocks_static unwind_static system_kernel_static system_m_static cxxabi_static keymgr_static compiler_rt_static system_duct_static)

View File

@ -80,7 +80,7 @@ int main(int argc, const char** argv)
for (int i = argc; i >= 1; i--)
*(sp-(pushCount++)) = (void*) argv[i];
*(sp-(pushCount++)) = (void*) (uintptr_t)(argc);
*(sp-(pushCount++)) = (void*) (uintptr_t)(argc-1);
*(sp-(pushCount++)) = (void*) mh;
JUMPX(pushCount, entryPoint);