this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Universal 'dyld' command for multilib builds, cmake deps checking etc.

+549 -9
+2 -1
.gitmodules
··· 3 3 url = git://git.dolezel.info/libsshcxx.git 4 4 [submodule "src/darling-mach"] 5 5 path = src/darling-mach 6 - url = git@github.com:LubosD/darling-mach.git 6 + url = git://github.com/LubosD/darling-mach.git 7 +
+26
CMakeLists.txt
··· 6 6 cmake_policy(SET CMP0003 NEW) 7 7 endif(COMMAND cmake_policy) 8 8 9 + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/") 10 + 9 11 if (SUFFIX) 10 12 set(MULTILIB TRUE) 11 13 endif (SUFFIX) ··· 26 28 27 29 message(STATUS "This is a ${BITS}-bit build") 28 30 31 + include(FindPkgConfig) 32 + include(FindGnustepBase) 33 + include(FindGnustepCorebase) 34 + include(FindGnustepGui) 35 + include(FindLibkqueue) 36 + include(FindLibobjc2) 37 + include(FindOpal) 38 + 39 + pkg_check_modules(libbsd REQUIRED "libbsd >= 0.4.2") 40 + pkg_check_modules(libudev REQUIRED "libudev") 41 + 42 + find_package(GnustepBase REQUIRED) 43 + find_package(GnustepCorebase REQUIRED) 44 + find_package(GnustepGui REQUIRED) 45 + find_package(Libkqueue REQUIRED) 46 + find_package(Libobjc2 REQUIRED) 47 + find_package(Opal REQUIRED) 48 + 29 49 if (SUFFIX STREQUAL "32") 30 50 set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -m32") 31 51 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") ··· 49 69 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/libmach-o) 50 70 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/util) 51 71 include_directories(${CMAKE_BINARY_DIR}) # for config.h 72 + 73 + include_directories(${LIBGNUSTEPBASE_INCLUDE_DIR}) 74 + include_directories(${LIBGNUSTEPCOREBASE_INCLUDE_DIR}) 75 + include_directories(${LIBKQUEUE_INCLUDE_DIR}) 76 + include_directories(${LIBOBJC2_INCLUDE_DIR}) 77 + include_directories(${LIBOPAL_INCLUDE_DIR}) 52 78 53 79 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 54 80
+21
cmake_modules/FindGnustepBase.cmake
··· 1 + 2 + find_path(LIBGNUSTEPBASE_INCLUDE_DIR Foundation/NSBundle.h 3 + PATHS 4 + /usr/include 5 + /usr/local/include 6 + /usr/include/GNUstep 7 + /usr/local/include/GNUstep 8 + ) 9 + 10 + find_library(LIBGNUSTEPBASE_LIBRARY 11 + NAMES libgnustep-base.so 12 + PATHS /usr/lib /usr/local/lib 13 + ) 14 + 15 + if (LIBGNUSTEPBASE_INCLUDE_DIR AND LIBGNUSTEPBASE_LIBRARY) 16 + set(LIBGNUSTEPBASE_FOUND TRUE) 17 + set(LIBGNUSTEPBASE_LIBRARIES ${LIBGNUSTEPBASE_LIBRARY}) 18 + else (LIBGNUSTEPBASE_INCLUDE_DIR AND LIBGNUSTEPBASE_LIBRARY) 19 + set(LIBGNUSTEPBASE_FOUND FALSE) 20 + endif (LIBGNUSTEPBASE_INCLUDE_DIR AND LIBGNUSTEPBASE_LIBRARY) 21 +
+21
cmake_modules/FindGnustepCorebase.cmake
··· 1 + 2 + find_path(LIBGNUSTEPCOREBASE_INCLUDE_DIR CoreFoundation/CFString.h 3 + PATHS 4 + /usr/include 5 + /usr/local/include 6 + /usr/include/GNUstep 7 + /usr/local/include/GNUstep 8 + ) 9 + 10 + find_library(LIBGNUSTEPCOREBASE_LIBRARY 11 + NAMES libgnustep-corebase.so 12 + PATHS /usr/lib /usr/local/lib 13 + ) 14 + 15 + if (LIBGNUSTEPCOREBASE_INCLUDE_DIR AND LIBGNUSTEPCOREBASE_LIBRARY) 16 + set(LIBGNUSTEPCOREBASE_FOUND TRUE) 17 + set(LIBGNUSTEPCOREBASE_LIBRARIES ${LIBGNUSTEPCOREBASE_LIBRARY}) 18 + else (LIBGNUSTEPCOREBASE_INCLUDE_DIR AND LIBGNUSTEPCOREBASE_LIBRARY) 19 + set(LIBGNUSTEPCOREBASE_FOUND FALSE) 20 + endif (LIBGNUSTEPCOREBASE_INCLUDE_DIR AND LIBGNUSTEPCOREBASE_LIBRARY) 21 +
+21
cmake_modules/FindGnustepGui.cmake
··· 1 + 2 + find_path(LIBGNUSTEPGUI_INCLUDE_DIR AppKit/AppKit.h 3 + PATHS 4 + /usr/include 5 + /usr/local/include 6 + /usr/include/GNUstep 7 + /usr/local/include/GNUstep 8 + ) 9 + 10 + find_library(LIBGNUSTEPGUI_LIBRARY 11 + NAMES libgnustep-gui.so 12 + PATHS /usr/lib /usr/local/lib 13 + ) 14 + 15 + if (LIBGNUSTEPGUI_INCLUDE_DIR AND LIBGNUSTEPGUI_LIBRARY) 16 + set(LIBGNUSTEPGUI_FOUND TRUE) 17 + set(LIBGNUSTEPGUI_LIBRARIES ${LIBGNUSTEPGUI_LIBRARY}) 18 + else (LIBGNUSTEPGUI_INCLUDE_DIR AND LIBGNUSTEPGUI_LIBRARY) 19 + set(LIBGNUSTEPGUI_FOUND FALSE) 20 + endif (LIBGNUSTEPGUI_INCLUDE_DIR AND LIBGNUSTEPGUI_LIBRARY) 21 +
+20
cmake_modules/FindLibkqueue.cmake
··· 1 + 2 + find_path(LIBKQUEUE_INCLUDE_DIR sys/event.h 3 + PATHS 4 + "/usr/include" 5 + "/usr/local/include" 6 + PATH_SUFFIXES "kqueue" 7 + ) 8 + 9 + find_library(LIBKQUEUE_LIBRARY 10 + NAMES libkqueue.so 11 + PATHS /usr/lib /usr/local/lib 12 + ) 13 + 14 + if (LIBKQUEUE_INCLUDE_DIR AND LIBKQUEUE_LIBRARY) 15 + set(LIBKQUEUE_FOUND TRUE) 16 + set(LIBKQUEUE_LIBRARIES ${LIBKQUEUE_LIBRARY}) 17 + else (LIBKQUEUE_INCLUDE_DIR AND LIBKQUEUE_LIBRARY) 18 + set(LIBKQUEUE_FOUND FALSE) 19 + endif (LIBKQUEUE_INCLUDE_DIR AND LIBKQUEUE_LIBRARY) 20 +
+23
cmake_modules/FindLibobjc2.cmake
··· 1 + 2 + # This scripts looks for libobjc2 header files as distributed by the GNUstep Project 3 + # GCC's ancient libobjc will NOT do. 4 + 5 + find_path(LIBOBJC2_INCLUDE_DIR objc/objc-arc.h 6 + PATHS 7 + /usr/include 8 + /usr/local/include 9 + ) 10 + 11 + find_library(LIBOBJC2_LIBRARY 12 + NAMES libobjc.so.4 13 + PATHS /usr/lib /usr/local/lib 14 + ) 15 + 16 + if (LIBOBJC2_INCLUDE_DIR AND LIBOBJC2_LIBRARY) 17 + # try_compile(LIBOBJC2_RECENT # TODO 18 + set(LIBOBJC2_FOUND TRUE) 19 + set(LIBOBJC2_LIBRARIES ${LIBOBJC2_LIBRARY}) 20 + else (LIBOBJC2_INCLUDE_DIR AND LIBOBJC2_LIBRARY) 21 + set(LIBOBJC2_FOUND FALSE) 22 + endif (LIBOBJC2_INCLUDE_DIR AND LIBOBJC2_LIBRARY) 23 +
+21
cmake_modules/FindOpal.cmake
··· 1 + 2 + find_path(LIBOPAL_INCLUDE_DIR CoreGraphics/CoreGraphics.h 3 + PATHS 4 + /usr/include 5 + /usr/local/include 6 + /usr/include/GNUstep 7 + /usr/local/include/GNUstep 8 + ) 9 + 10 + find_library(LIBOPAL_LIBRARY 11 + NAMES libopal.so 12 + PATHS /usr/lib /usr/local/lib 13 + ) 14 + 15 + if (LIBOPAL_INCLUDE_DIR AND LIBOPAL_LIBRARY) 16 + set(LIBOPAL_FOUND TRUE) 17 + set(LIBOPAL_LIBRARIES ${LIBOPAL_LIBRARY}) 18 + else (LIBOPAL_INCLUDE_DIR AND LIBOPAL_LIBRARY) 19 + set(LIBOPAL_FOUND FALSE) 20 + endif (LIBOPAL_INCLUDE_DIR AND LIBOPAL_LIBRARY) 21 +
+312
include/darwin/mach-o/nlist.h
··· 1 + /* 2 + * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 3 + * 4 + * @APPLE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. Please obtain a copy of the License at 10 + * http://www.opensource.apple.com/apsl/ and read it before using this 11 + * file. 12 + * 13 + * The Original Code and all software distributed under the License are 14 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 + * Please see the License for the specific language governing rights and 19 + * limitations under the License. 20 + * 21 + * @APPLE_LICENSE_HEADER_END@ 22 + */ 23 + #ifndef _MACHO_NLIST_H_ 24 + #define _MACHO_NLIST_H_ 25 + /* $NetBSD: nlist.h,v 1.5 1994/10/26 00:56:11 cgd Exp $ */ 26 + 27 + /*- 28 + * Copyright (c) 1991, 1993 29 + * The Regents of the University of California. All rights reserved. 30 + * (c) UNIX System Laboratories, Inc. 31 + * All or some portions of this file are derived from material licensed 32 + * to the University of California by American Telephone and Telegraph 33 + * Co. or Unix System Laboratories, Inc. and are reproduced herein with 34 + * the permission of UNIX System Laboratories, Inc. 35 + * 36 + * Redistribution and use in source and binary forms, with or without 37 + * modification, are permitted provided that the following conditions 38 + * are met: 39 + * 1. Redistributions of source code must retain the above copyright 40 + * notice, this list of conditions and the following disclaimer. 41 + * 2. Redistributions in binary form must reproduce the above copyright 42 + * notice, this list of conditions and the following disclaimer in the 43 + * documentation and/or other materials provided with the distribution. 44 + * 3. All advertising materials mentioning features or use of this software 45 + * must display the following acknowledgement: 46 + * This product includes software developed by the University of 47 + * California, Berkeley and its contributors. 48 + * 4. Neither the name of the University nor the names of its contributors 49 + * may be used to endorse or promote products derived from this software 50 + * without specific prior written permission. 51 + * 52 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 53 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 54 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 55 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 56 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 57 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 58 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 59 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 60 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 61 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 62 + * SUCH DAMAGE. 63 + * 64 + * @(#)nlist.h 8.2 (Berkeley) 1/21/94 65 + */ 66 + #include <stdint.h> 67 + 68 + /* 69 + * Format of a symbol table entry of a Mach-O file for 32-bit architectures. 70 + * Modified from the BSD format. The modifications from the original format 71 + * were changing n_other (an unused field) to n_sect and the addition of the 72 + * N_SECT type. These modifications are required to support symbols in a larger 73 + * number of sections not just the three sections (text, data and bss) in a BSD 74 + * file. 75 + */ 76 + struct nlist { 77 + union { 78 + #ifndef __LP64__ 79 + char *n_name; /* for use when in-core */ 80 + #endif 81 + uint32_t n_strx; /* index into the string table */ 82 + } n_un; 83 + uint8_t n_type; /* type flag, see below */ 84 + uint8_t n_sect; /* section number or NO_SECT */ 85 + int16_t n_desc; /* see <mach-o/stab.h> */ 86 + uint32_t n_value; /* value of this symbol (or stab offset) */ 87 + }; 88 + 89 + /* 90 + * This is the symbol table entry structure for 64-bit architectures. 91 + */ 92 + struct nlist_64 { 93 + union { 94 + uint32_t n_strx; /* index into the string table */ 95 + } n_un; 96 + uint8_t n_type; /* type flag, see below */ 97 + uint8_t n_sect; /* section number or NO_SECT */ 98 + uint16_t n_desc; /* see <mach-o/stab.h> */ 99 + uint64_t n_value; /* value of this symbol (or stab offset) */ 100 + }; 101 + 102 + /* 103 + * Symbols with a index into the string table of zero (n_un.n_strx == 0) are 104 + * defined to have a null, "", name. Therefore all string indexes to non null 105 + * names must not have a zero string index. This is bit historical information 106 + * that has never been well documented. 107 + */ 108 + 109 + /* 110 + * The n_type field really contains four fields: 111 + * unsigned char N_STAB:3, 112 + * N_PEXT:1, 113 + * N_TYPE:3, 114 + * N_EXT:1; 115 + * which are used via the following masks. 116 + */ 117 + #define N_STAB 0xe0 /* if any of these bits set, a symbolic debugging entry */ 118 + #define N_PEXT 0x10 /* private external symbol bit */ 119 + #define N_TYPE 0x0e /* mask for the type bits */ 120 + #define N_EXT 0x01 /* external symbol bit, set for external symbols */ 121 + 122 + /* 123 + * Only symbolic debugging entries have some of the N_STAB bits set and if any 124 + * of these bits are set then it is a symbolic debugging entry (a stab). In 125 + * which case then the values of the n_type field (the entire field) are given 126 + * in <mach-o/stab.h> 127 + */ 128 + 129 + /* 130 + * Values for N_TYPE bits of the n_type field. 131 + */ 132 + #define N_UNDF 0x0 /* undefined, n_sect == NO_SECT */ 133 + #define N_ABS 0x2 /* absolute, n_sect == NO_SECT */ 134 + #define N_SECT 0xe /* defined in section number n_sect */ 135 + #define N_PBUD 0xc /* prebound undefined (defined in a dylib) */ 136 + #define N_INDR 0xa /* indirect */ 137 + 138 + /* 139 + * If the type is N_INDR then the symbol is defined to be the same as another 140 + * symbol. In this case the n_value field is an index into the string table 141 + * of the other symbol's name. When the other symbol is defined then they both 142 + * take on the defined type and value. 143 + */ 144 + 145 + /* 146 + * If the type is N_SECT then the n_sect field contains an ordinal of the 147 + * section the symbol is defined in. The sections are numbered from 1 and 148 + * refer to sections in order they appear in the load commands for the file 149 + * they are in. This means the same ordinal may very well refer to different 150 + * sections in different files. 151 + * 152 + * The n_value field for all symbol table entries (including N_STAB's) gets 153 + * updated by the link editor based on the value of it's n_sect field and where 154 + * the section n_sect references gets relocated. If the value of the n_sect 155 + * field is NO_SECT then it's n_value field is not changed by the link editor. 156 + */ 157 + #define NO_SECT 0 /* symbol is not in any section */ 158 + #define MAX_SECT 255 /* 1 thru 255 inclusive */ 159 + 160 + /* 161 + * Common symbols are represented by undefined (N_UNDF) external (N_EXT) types 162 + * who's values (n_value) are non-zero. In which case the value of the n_value 163 + * field is the size (in bytes) of the common symbol. The n_sect field is set 164 + * to NO_SECT. The alignment of a common symbol may be set as a power of 2 165 + * between 2^1 and 2^15 as part of the n_desc field using the macros below. If 166 + * the alignment is not set (a value of zero) then natural alignment based on 167 + * the size is used. 168 + */ 169 + #define GET_COMM_ALIGN(n_desc) (((n_desc) >> 8) & 0x0f) 170 + #define SET_COMM_ALIGN(n_desc,align) \ 171 + (n_desc) = (((n_desc) & 0xf0ff) | (((align) & 0x0f) << 8)) 172 + 173 + /* 174 + * To support the lazy binding of undefined symbols in the dynamic link-editor, 175 + * the undefined symbols in the symbol table (the nlist structures) are marked 176 + * with the indication if the undefined reference is a lazy reference or 177 + * non-lazy reference. If both a non-lazy reference and a lazy reference is 178 + * made to the same symbol the non-lazy reference takes precedence. A reference 179 + * is lazy only when all references to that symbol are made through a symbol 180 + * pointer in a lazy symbol pointer section. 181 + * 182 + * The implementation of marking nlist structures in the symbol table for 183 + * undefined symbols will be to use some of the bits of the n_desc field as a 184 + * reference type. The mask REFERENCE_TYPE will be applied to the n_desc field 185 + * of an nlist structure for an undefined symbol to determine the type of 186 + * undefined reference (lazy or non-lazy). 187 + * 188 + * The constants for the REFERENCE FLAGS are propagated to the reference table 189 + * in a shared library file. In that case the constant for a defined symbol, 190 + * REFERENCE_FLAG_DEFINED, is also used. 191 + */ 192 + /* Reference type bits of the n_desc field of undefined symbols */ 193 + #define REFERENCE_TYPE 0x7 194 + /* types of references */ 195 + #define REFERENCE_FLAG_UNDEFINED_NON_LAZY 0 196 + #define REFERENCE_FLAG_UNDEFINED_LAZY 1 197 + #define REFERENCE_FLAG_DEFINED 2 198 + #define REFERENCE_FLAG_PRIVATE_DEFINED 3 199 + #define REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY 4 200 + #define REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY 5 201 + 202 + /* 203 + * To simplify stripping of objects that use are used with the dynamic link 204 + * editor, the static link editor marks the symbols defined an object that are 205 + * referenced by a dynamicly bound object (dynamic shared libraries, bundles). 206 + * With this marking strip knows not to strip these symbols. 207 + */ 208 + #define REFERENCED_DYNAMICALLY 0x0010 209 + 210 + /* 211 + * For images created by the static link editor with the -twolevel_namespace 212 + * option in effect the flags field of the mach header is marked with 213 + * MH_TWOLEVEL. And the binding of the undefined references of the image are 214 + * determined by the static link editor. Which library an undefined symbol is 215 + * bound to is recorded by the static linker in the high 8 bits of the n_desc 216 + * field using the SET_LIBRARY_ORDINAL macro below. The ordinal recorded 217 + * references the libraries listed in the Mach-O's LC_LOAD_DYLIB, 218 + * LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, LC_LOAD_UPWARD_DYLIB, and 219 + * LC_LAZY_LOAD_DYLIB, etc. load commands in the order they appear in the 220 + * headers. The library ordinals start from 1. 221 + * For a dynamic library that is built as a two-level namespace image the 222 + * undefined references from module defined in another use the same nlist struct 223 + * an in that case SELF_LIBRARY_ORDINAL is used as the library ordinal. For 224 + * defined symbols in all images they also must have the library ordinal set to 225 + * SELF_LIBRARY_ORDINAL. The EXECUTABLE_ORDINAL refers to the executable 226 + * image for references from plugins that refer to the executable that loads 227 + * them. 228 + * 229 + * The DYNAMIC_LOOKUP_ORDINAL is for undefined symbols in a two-level namespace 230 + * image that are looked up by the dynamic linker with flat namespace semantics. 231 + * This ordinal was added as a feature in Mac OS X 10.3 by reducing the 232 + * value of MAX_LIBRARY_ORDINAL by one. So it is legal for existing binaries 233 + * or binaries built with older tools to have 0xfe (254) dynamic libraries. In 234 + * this case the ordinal value 0xfe (254) must be treated as a library ordinal 235 + * for compatibility. 236 + */ 237 + #define GET_LIBRARY_ORDINAL(n_desc) (((n_desc) >> 8) & 0xff) 238 + #define SET_LIBRARY_ORDINAL(n_desc,ordinal) \ 239 + (n_desc) = (((n_desc) & 0x00ff) | (((ordinal) & 0xff) << 8)) 240 + #define SELF_LIBRARY_ORDINAL 0x0 241 + #define MAX_LIBRARY_ORDINAL 0xfd 242 + #define DYNAMIC_LOOKUP_ORDINAL 0xfe 243 + #define EXECUTABLE_ORDINAL 0xff 244 + 245 + /* 246 + * The bit 0x0020 of the n_desc field is used for two non-overlapping purposes 247 + * and has two different symbolic names, N_NO_DEAD_STRIP and N_DESC_DISCARDED. 248 + */ 249 + 250 + /* 251 + * The N_NO_DEAD_STRIP bit of the n_desc field only ever appears in a 252 + * relocatable .o file (MH_OBJECT filetype). And is used to indicate to the 253 + * static link editor it is never to dead strip the symbol. 254 + */ 255 + #define N_NO_DEAD_STRIP 0x0020 /* symbol is not to be dead stripped */ 256 + 257 + /* 258 + * The N_DESC_DISCARDED bit of the n_desc field never appears in linked image. 259 + * But is used in very rare cases by the dynamic link editor to mark an in 260 + * memory symbol as discared and longer used for linking. 261 + */ 262 + #define N_DESC_DISCARDED 0x0020 /* symbol is discarded */ 263 + 264 + /* 265 + * The N_WEAK_REF bit of the n_desc field indicates to the dynamic linker that 266 + * the undefined symbol is allowed to be missing and is to have the address of 267 + * zero when missing. 268 + */ 269 + #define N_WEAK_REF 0x0040 /* symbol is weak referenced */ 270 + 271 + /* 272 + * The N_WEAK_DEF bit of the n_desc field indicates to the static and dynamic 273 + * linkers that the symbol definition is weak, allowing a non-weak symbol to 274 + * also be used which causes the weak definition to be discared. Currently this 275 + * is only supported for symbols in coalesed sections. 276 + */ 277 + #define N_WEAK_DEF 0x0080 /* coalesed symbol is a weak definition */ 278 + 279 + /* 280 + * The N_REF_TO_WEAK bit of the n_desc field indicates to the dynamic linker 281 + * that the undefined symbol should be resolved using flat namespace searching. 282 + */ 283 + #define N_REF_TO_WEAK 0x0080 /* reference to a weak symbol */ 284 + 285 + /* 286 + * The N_ARM_THUMB_DEF bit of the n_desc field indicates that the symbol is 287 + * a defintion of a Thumb function. 288 + */ 289 + #define N_ARM_THUMB_DEF 0x0008 /* symbol is a Thumb function (ARM) */ 290 + 291 + /* 292 + * The N_SYMBOL_RESOLVER bit of the n_desc field indicates that the 293 + * that the function is actually a resolver function and should 294 + * be called to get the address of the real function to use. 295 + * This bit is only available in .o files (MH_OBJECT filetype) 296 + */ 297 + #define N_SYMBOL_RESOLVER 0x0100 298 + 299 + #ifndef __STRICT_BSD__ 300 + #if __cplusplus 301 + extern "C" { 302 + #endif /* __cplusplus */ 303 + /* 304 + * The function nlist(3) from the C library. 305 + */ 306 + extern int nlist (const char *filename, struct nlist *list); 307 + #if __cplusplus 308 + } 309 + #endif /* __cplusplus */ 310 + #endif /* __STRICT_BSD__ */ 311 + 312 + #endif /* _MACHO_LIST_H_ */
+5
src/CoreFoundation/CMakeLists.txt
··· 21 21 NameTranslate.cpp 22 22 ) 23 23 24 + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${SUFFIX}/darling") 25 + #SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags") 26 + SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 27 + SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) 28 + 24 29 add_library(CoreFoundation SHARED ${CoreFoundation_SRCS}) 25 30 target_link_libraries(CoreFoundation -lgnustep-corebase objc.A.dylib) 26 31
+5
src/dyld/CMakeLists.txt
··· 44 44 45 45 install(TARGETS dyld${SUFFIX} DESTINATION bin) 46 46 47 + if (SUFFIX STREQUAL "64") 48 + add_executable(dyld dyld-multilib.c) 49 + install(TARGETS dyld DESTINATION bin) 50 + endif (SUFFIX STREQUAL "64") 51 +
+10 -8
src/dyld/binfmt_misc.cpp
··· 1 1 /* 2 2 This file is part of Darling. 3 3 4 - Copyright (C) 2012 Lubos Dolezel 4 + Copyright (C) 2012-2013 Lubos Dolezel 5 5 6 6 Darling is free software: you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by ··· 37 37 if (!reg.is_open()) 38 38 throw std::runtime_error("Cannot register the binfmt_misc handler, is binfmt_misc kernel support loaded and mounted?"); 39 39 40 - #ifdef __x86_64__ 40 + #if defined(__x86_64__) || defined(__powerpc64__) 41 41 reg << ":Mach-O 64bit:M::\\xcf\\xfa\\xed\\xfe::" << loader << ":\n"; 42 - #else 42 + #elif defined(__i386__) || defined(__powerpc__) 43 43 reg << ":Mach-O 32bit:M::\\xce\\xfa\\xed\\xfe::" << loader << ":\n"; 44 + #else 45 + # error Unuspported platform 44 46 #endif 45 47 reg.close(); 46 48 ··· 64 66 checkRoot(); 65 67 66 68 deregister("Mach-O Universal"); 67 - #ifdef __x86_64__ 68 - deregister("Mach-O 64bit"); 69 - #else 70 - deregister("Mach-O 32bit"); 71 - #endif 69 + 70 + if (sizeof(void*) == 8) 71 + deregister("Mach-O 64bit"); 72 + else 73 + deregister("Mach-O 32bit"); 72 74 } 73 75
+52
src/dyld/dyld-multilib.c
··· 1 + #include <sys/types.h> 2 + #include <sys/stat.h> 3 + #include <fcntl.h> 4 + #include <stdint.h> 5 + #include <unistd.h> 6 + #include <stdio.h> 7 + #include <errno.h> 8 + #include <string.h> 9 + #include <stdlib.h> 10 + 11 + void junction(const char* target, int argc, char** argv); 12 + 13 + int main(int argc, char** argv) 14 + { 15 + uint32_t signature; 16 + int fd; 17 + const char* target = "64"; 18 + 19 + fd = open(argv[1], O_RDONLY); 20 + 21 + // We let real dyld output all serious error messages 22 + // not to duplicate the functionality. 23 + if (fd < 0) 24 + junction(target, argc, argv); 25 + 26 + if (read(fd, &signature, 4) != 4) 27 + junction(target, argc, argv); 28 + 29 + if (signature == 0xfeedface) 30 + target = "32"; 31 + 32 + junction(target, argc, argv); 33 + return 1; 34 + } 35 + 36 + void junction(const char* target, int argc, char** argv) 37 + { 38 + char* targetPath = malloc(strlen(target) + 3); 39 + 40 + strcpy(targetPath, argv[0]); 41 + strcat(targetPath, target); 42 + 43 + argv[0] = targetPath; 44 + 45 + execvp(targetPath, argv); 46 + 47 + fprintf(stderr, "Darling dyld multilib junction failed to execute %s!\n", targetPath); 48 + free(targetPath); 49 + 50 + exit(errno); 51 + } 52 +
+7
src/libSystem/libc/misc.cpp
··· 2 2 #include "misc.h" 3 3 #include "trace.h" 4 4 #include <langinfo.h> 5 + #include <cstdlib> 5 6 6 7 const char* locale_charset() 7 8 { ··· 20 21 // p = 0; 21 22 return realloc(p,s); 22 23 } 24 + 25 + int __darwin_atexit(void (*function)(void)) 26 + { 27 + return atexit(function); 28 + } 29 +
+3
src/libSystem/libc/misc.h
··· 8 8 const char* locale_charset(); 9 9 int __darwin_sigsetjmp(sigjmp_buf b, int savesigs); 10 10 11 + // atexit() is strange, it seems to be always inlined and cannot be resolved with dlsym() 12 + int __darwin_atexit(void (*function)(void)); 13 + 11 14 } 12 15 13 16 #endif