+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(argv[i], "-dependency_info") == 0 ) {
+ snapshotArgCount = 0;
+ ++i;
+ // previously handled by buildSearchPaths()
+ }
+ else if ( strcmp(arg, "-export_dynamic") == 0 ) {
+ fExportDynamic = true;
+ }
+ else if ( strcmp(arg, "-force_symbols_coalesce_list") == 0 ) {
+ snapshotFileArgIndex = 1;
+ loadExportFile(argv[++i], "-force_symbols_coalesce_list", fForceCoalesceSymbols);
+ }
+ else if ( strcmp(arg, "-add_linker_option") == 0 ) {
+ // ex: -add_linker_option '-framework Foundation'
+ const char* optString = argv[++i];
+ if ( optString == NULL )
+ throw "-add_linker_option missing <option>";
+ // break up into list of tokens at whitespace
+ std::vector<const char*> opts;
+ char* buffer = strdup(optString);
+ char* start = buffer;
+ for (char* s = buffer; ; ++s) {
+ if ( isspace(*s) ) {
+ *s = '\0';
+ opts.push_back(start);
+ start = s+1;
+ }
+ else if ( *s == '\0' ) {
+ opts.push_back(start);
+ break;
+ }
+ }
+ fLinkerOptions.push_back(opts);
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-allow_simulator_linking_to_macosx_dylibs") == 0 ) {
+ fAllowSimulatorToLinkWithMacOSX = true;
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-keep_dwarf_unwind") == 0 ) {
+ fKeepDwarfUnwindForcedOn = true;
+ fKeepDwarfUnwindForcedOff = false;
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-no_keep_dwarf_unwind") == 0 ) {
+ fKeepDwarfUnwindForcedOn = false;
+ fKeepDwarfUnwindForcedOff = true;
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-verbose_optimization_hints") == 0 ) {
+ fVerboseOptimizationHints = true;
+ }
+ else if ( strcmp(arg, "-ignore_optimization_hints") == 0 ) {
+ fIgnoreOptimizationHints = true;
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-no_dtrace_dof") == 0 ) {
+ fGenerateDtraceDOF = false;
+ }
+ else if ( strcmp(arg, "-rename_section") == 0 ) {
+ if ( (argv[i+1]==NULL) || (argv[i+2]==NULL) || (argv[i+3]==NULL) || (argv[i+4]==NULL) )
+ throw "-rename_section missing <segment> <section> <segment> <section>";
+ addSectionRename(argv[i+1], argv[i+2], argv[i+3], argv[i+4]);
+ i += 4;
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-rename_segment") == 0 ) {
+ if ( (argv[i+1]==NULL) || (argv[i+2]==NULL) )
+ throw "-rename_segment missing <existing-segment> <new-segment>";
+ addSegmentRename(argv[i+1], argv[i+2]);
+ i += 2;
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-move_to_ro_segment") == 0 ) {
+ if ( (argv[i+1]==NULL) || (argv[i+2]==NULL) )
+ throw "-move_to_ro_segment missing <segment> <symbol-list-file>";
+ addSymbolMove(argv[i+1], argv[i+2], fSymbolsMovesCode, "-move_to_ro_segment");
+ i += 2;
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-move_to_rw_segment") == 0 ) {
+ if ( (argv[i+1]==NULL) || (argv[i+2]==NULL) )
+ throw "-move_to_rw_segment missing <segment> <symbol-list-file>";
+ addSymbolMove(argv[i+1], argv[i+2], fSymbolsMovesData, "-move_to_rw_segment");
+ i += 2;
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-trace_symbol_layout") == 0 ) {
+ fTraceSymbolLayout = true;
+ }
+ else if ( strcmp(arg, "-no_branch_islands") == 0 ) {
+ fAllowBranchIslands = false;
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-segment_order") == 0 ) {
+ // ex: -segment_order __TEXT:__DATA:__JUNK
+ const char* optString = argv[++i];
+ if ( optString == NULL )
+ throw "-segment_order missing colon separated <segment-list>";
+ if ( !fSegmentOrder.empty() )
+ throw "-segment_order used more than once";
+ // break up into list of tokens at colon
+ char* buffer = strdup(optString);
+ char* start = buffer;
+ for (char* s = buffer; ; ++s) {
+ if ( *s == ':' ) {
+ *s = '\0';
+ fSegmentOrder.push_back(start);
+ start = s+1;
+ }
+ else if ( *s == '\0' ) {
+ fSegmentOrder.push_back(start);
+ break;
+ }
+ }
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-section_order") == 0 ) {
+ // ex: -section_order __DATA __data:__const:__nl_pointers
+ if ( (argv[i+1]==NULL) || (argv[i+2]==NULL) )
+ throw "-section_order missing <segment> <section-list>";
+ const char* segName = argv[++i];
+ const char* optString = argv[++i];
+ if ( sectionOrder(segName) != NULL )
+ throwf("-section_order %s ... used more than once", segName);
+ SectionOrderList dummy;
+ fSectionOrder.push_back(dummy);
+ SectionOrderList& entry = fSectionOrder.back();
+ entry.segmentName = segName;
+ // break up into list of tokens at colon
+ char* buffer = strdup(optString);
+ char* start = buffer;
+ for (char* s = buffer; ; ++s) {
+ if ( *s == ':' ) {
+ *s = '\0';
+ entry.sectionOrder.push_back(start);
+ start = s+1;
+ }
+ else if ( *s == '\0' ) {
+ entry.sectionOrder.push_back(start);
+ break;
+ }
+ }
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-application_extension") == 0 ) {
+ fMarkAppExtensionSafe = true;
+ fCheckAppExtensionSafe = true;
+ }
+ else if ( strcmp(arg, "-no_application_extension") == 0 ) {
+ fMarkAppExtensionSafe = false;
+ fCheckAppExtensionSafe = false;
+ }
+ else if ( strcmp(arg, "-add_ast_path") == 0 ) {
+ const char* path = argv[++i];
+ if ( path == NULL )
+ throw "-add_ast_path missing <option>";
+ fASTFilePaths.push_back(path);
+ }
+ else if ( strcmp(arg, "-force_load_swift_libs") == 0 ) {
+ fForceLoadSwiftLibs = true;
+ }
+ else if ( strcmp(arg, "-not_for_dyld_shared_cache") == 0 ) {
+ fSharedRegionEligibleForceOff = true;
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-dirty_data_list") == 0 ) {
+ if ( argv[i+1] == NULL )
+ throw "-dirty_data_list missing <symbol-list-file>";
+ addSymbolMove("__DATA_DIRTY", argv[i+1], fSymbolsMovesData, "-dirty_data_list");
+ ++i;
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-data_const") == 0 ) {
+ fUseDataConstSegmentForceOn = true;
+ cannotBeUsedWithBitcode(arg);
+ }
+ else if ( strcmp(arg, "-no_data_const") == 0 ) {
+ fUseDataConstSegmentForceOff = true;
+ cannotBeUsedWithBitcode(arg);
+ }
+ // put this last so that it does not interfer with other options starting with 'i'
+ else if ( strncmp(arg, "-i", 2) == 0 ) {
+ const char* colon = strchr(arg, ':');
+ if ( colon == NULL )
+ throwf("unknown option: %s", arg);
+ Options::AliasPair pair;
+ char* temp = new char[colon-arg];
+ strlcpy(temp, &arg[2], colon-arg-1);
+ pair.realName = &colon[1];
+ pair.alias = temp;
+ fAliases.push_back(pair);