Skip to content

Commit

Permalink
Merge pull request #222 from bugaevc/no-virtual-prefix-squash
Browse files Browse the repository at this point in the history
Get of rid of the VirtualPrefix, use the new 'darling' binary
  • Loading branch information
LubosD authored Jan 5, 2017
2 parents 667cb9a + cf7e9d6 commit 0b95b74
Show file tree
Hide file tree
Showing 45 changed files with 285 additions and 1,303 deletions.
32 changes: 31 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,35 @@ add_subdirectory(src)
if (NOT DARLING_NO_EXECUTABLES)
install(FILES etc/dylib.conf etc/version.conf
DESTINATION libexec/darling/etc/darling)
endif (NOT DARLING_NO_EXECUTABLES)
install(FILES etc/resolv.conf
DESTINATION libexec/darling/etc)

install(DIRECTORY DESTINATION libexec/darling/Volumes)
install(DIRECTORY DESTINATION libexec/darling/Volumes/SystemRoot)
InstallSymlink(/ ${CMAKE_INSTALL_PREFIX}/libexec/darling/Volumes/DarlingEmulatedDrive)

install(DIRECTORY DESTINATION libexec/darling/proc)

install(DIRECTORY DESTINATION libexec/darling/var)
install(DIRECTORY DESTINATION libexec/darling/var/root)
install(DIRECTORY DESTINATION libexec/darling/var/run)
InstallSymlink(/dev/log ${CMAKE_INSTALL_PREFIX}/libexec/darling/var/run/syslog)

install(DIRECTORY DESTINATION libexec/darling/usr)
install(DIRECTORY DESTINATION libexec/darling/usr/local)
install(DIRECTORY DESTINATION libexec/darling/usr/local/share)
InstallSymlink(/Volumes/SystemRoot${CMAKE_INSTALL_PREFIX}/share/darling ${CMAKE_INSTALL_PREFIX}/libexec/darling/usr/local/share/darling)

InstallSymlink(/Volumes/SystemRoot/dev ${CMAKE_INSTALL_PREFIX}/libexec/darling/dev)
InstallSymlink(/Volumes/SystemRoot/tmp ${CMAKE_INSTALL_PREFIX}/libexec/darling/tmp)
InstallSymlink(/Volumes/SystemRoot/home ${CMAKE_INSTALL_PREFIX}/libexec/darling/Users)

InstallSymlink(/proc/self/mounts ${CMAKE_INSTALL_PREFIX}/libexec/darling/etc/mtab)
InstallSymlink(/Volumes/SystemRoot/etc/passwd ${CMAKE_INSTALL_PREFIX}/libexec/darling/etc/passwd)
InstallSymlink(/Volumes/SystemRoot/etc/group ${CMAKE_INSTALL_PREFIX}/libexec/darling/etc/group)

install(DIRECTORY DESTINATION libexec/darling/etc/ld.so.conf.d)
install(CODE "execute_process(COMMAND bash ${DARLING_TOP_DIRECTORY}/src/setup-ld-so.sh WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/libexec/darling)")
InstallSymlink(/Volumes/SystemRoot/lib ${CMAKE_INSTALL_PREFIX}/libexec/darling/lib)
InstallSymlink(/Volumes/SystemRoot/lib64 ${CMAKE_INSTALL_PREFIX}/libexec/darling/lib64)
endif (NOT DARLING_NO_EXECUTABLES)
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ make
make install
````

To build the new, experimental `darling` executable:

````
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../Toolchain-x86_64.cmake -DNEW_DARLING=TRUE
make
make install
chmod +s $(which darling)
````

#### For running i386 OS X binaries

<a href="http://teamcity.dolezel.info/viewType.html?buildTypeId=Darling_DebianStableX8664&guest=1">
Expand Down
2 changes: 2 additions & 0 deletions etc/resolv.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nameserver 8.8.8.8
nameserver 8.8.4.4
4 changes: 3 additions & 1 deletion src/darling-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#define DYLD_PATH "${CMAKE_INSTALL_PREFIX}/bin/dyld"

#define ETC_DARLING_PATH "/etc/darling"
// Path where the system root gets "mounted" inside the prefix
#define SYSTEM_ROOT "/Volumes/SystemRoot"

#cmakedefine MULTILIB
#cmakedefine FRAMEWORK_COREAUDIO
Expand All @@ -17,7 +19,7 @@
#ifndef __APPLE__

/*
* Credit:
* Credit:
*
* David Chisnall
* http://comments.gmane.org/gmane.comp.desktop.etoile.devel/1556
Expand Down
15 changes: 3 additions & 12 deletions src/dyld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,14 @@ add_executable(dyld-bin ${dyld_SRCS})
set_target_properties(dyld-bin PROPERTIES OUTPUT_NAME dyld${SUFFIX})
target_link_libraries(dyld-bin dyld darling-util mach-o)

if (NEW_DARLING)
add_executable(darling darling.c)
endif (NEW_DARLING)
add_executable(darling darling.c)

if (NOT DARLING_NO_EXECUTABLES)
add_executable(dyldd dyldd.cpp)
target_link_libraries(dyldd dyld darling-util mach-o)
install(TARGETS dyldd DESTINATION bin)
if (NEW_DARLING)
install(TARGETS darling DESTINATION bin)
else (NEW_DARLING)
install(PROGRAMS darling DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif(NEW_DARLING)
install(TARGETS darling DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE SETUID)
add_library(dexe_startup STATIC darling-so-start.S)
endif (NOT DARLING_NO_EXECUTABLES)

Expand All @@ -62,5 +55,3 @@ if (BITS EQUAL 64)
set_target_properties(dyld-multilib PROPERTIES OUTPUT_NAME dyld)
install(TARGETS dyld-multilib DESTINATION bin)
endif (BITS EQUAL 64)


236 changes: 0 additions & 236 deletions src/dyld/darling

This file was deleted.

18 changes: 17 additions & 1 deletion src/dyld/darling-so-start.S
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@

.text

// For running executables from inside the prefix
dyld_path:
.ascii SYSTEM_ROOT
.string DYLD_PATH

// Additionally, we support running them from the host system
dyld_host_path:
.string DYLD_PATH

proc_self_exe:
Expand Down Expand Up @@ -56,6 +62,17 @@ strcat_end:
movl $__NR_execve, %eax
syscall

// If we failed to find dyld under the system root,
// try again without it
leaq dyld_host_path(%rip), %rdi // exec path
movq %rsp, %rsi // argv
movl 0(%rsp), %ecx // argc
leaq 16(%rsp, %rcx, 8), %rdx // envp
movq %rdi, (%rsi) // overwrite argc with dyld_path

movl $__NR_execve, %eax
syscall

fail:
movl $2, %edi
leaq failure_msg(%rip), %rsi
Expand All @@ -64,4 +81,3 @@ fail:
syscall

ud2

Loading

0 comments on commit 0b95b74

Please sign in to comment.