this repo has no description
1
fork

Configure Feed

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

motool: fixed installation and added ext. reloc and rebase support

+54 -2
+7
src/motool/CMakeLists.txt
··· 11 11 motool.cpp 12 12 ) 13 13 14 + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${SUFFIX}/darling") 15 + #SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags") 16 + SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 17 + SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) 18 + 14 19 add_executable(motool ${motool_SRCS}) 15 20 target_link_libraries(motool mach-o) 16 21 22 + install(TARGETS motool DESTINATION bin) 23 +
+47 -2
src/motool/motool.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 ··· 31 31 #include <cstring> 32 32 #include <iomanip> 33 33 34 - enum OpMode { ModeDylibs, ModeSymbols, ModeExports, ModeBinds, ModeSegments }; 34 + enum OpMode { ModeDylibs, ModeSymbols, ModeExports, ModeBinds, ModeSegments, ModeRelocations, ModeRebases }; 35 35 36 36 void printBinInfo(const char* path, const char* arch, const char* opt); 37 37 OpMode getOpMode(const char* opt); ··· 64 64 "\t-s --symbols\tList symbols\n" 65 65 "\t-e --exports\tList exports\n" 66 66 "\t-b --binds\tList binds\n" 67 + "\t-r --reloc\tList external relocations\n" 68 + "\t-a --rebases\tList rebases\n" 67 69 "\t-g --segments\tList segments and sections\n" 68 70 "\t-f --fat\tList FAT Mach-O architectures\n" 69 71 "\n"; ··· 236 238 237 239 break; 238 240 } 241 + case ModeRebases: 242 + { 243 + std::cout << "Rebases:\n"; 244 + 245 + for (MachO::Rebase* r : macho->rebases()) 246 + { 247 + std::cout << "\t at [0x" << std::hex << std::setfill('0'); 248 + 249 + if (macho->is64()) 250 + std::cout << std::setw(16); 251 + else 252 + std::cout << std::setw(8); 253 + 254 + std::cout << r->vmaddr << std::dec << std::setw(0) << "]\n"; 255 + } 256 + break; 257 + } 258 + case ModeRelocations: 259 + { 260 + std::cout << "External relocations:\n"; 261 + 262 + for (MachO::Relocation* r : macho->relocations()) 263 + { 264 + std::cout << '\t' << r->name << " at " << "[0x" << std::hex << std::setfill('0'); 265 + 266 + if (macho->is64()) 267 + std::cout << std::setw(16); 268 + else 269 + std::cout << std::setw(8); 270 + 271 + std::cout << r->addr << std::setw(0) << "] "; 272 + 273 + if (r->pcrel) 274 + std::cout << "PC-REL"; 275 + std::cout << std::endl; 276 + } 277 + break; 278 + } 279 + 239 280 } 240 281 241 282 delete macho; ··· 255 296 return ModeBinds; 256 297 else if (!strcmp(opt, "-g") || !strcmp(opt, "--segments")) 257 298 return ModeSegments; 299 + else if (!strcmp(opt, "-r") || !strcmp(opt, "--reloc")) 300 + return ModeRelocations; 301 + else if (!strcmp(opt, "-a") || !strcmp(opt, "--rebases")) 302 + return ModeRebases; 258 303 else 259 304 { 260 305 std::stringstream ss;