Index: lld/MachO/Driver.cpp =================================================================== --- lld/MachO/Driver.cpp +++ lld/MachO/Driver.cpp @@ -1041,9 +1041,11 @@ config->deadStripDylibs = args.hasArg(OPT_dead_strip_dylibs); config->demangle = args.hasArg(OPT_demangle); config->implicitDylibs = !args.hasArg(OPT_no_implicit_dylibs); - config->emitFunctionStarts = !args.hasArg(OPT_no_function_starts); + config->emitFunctionStarts = + args.hasFlag(OPT_function_starts, OPT_no_function_starts, true); config->emitBitcodeBundle = args.hasArg(OPT_bitcode_bundle); - config->emitDataInCodeInfo = !args.hasArg(OPT_no_data_in_code_info); + config->emitDataInCodeInfo = + args.hasFlag(OPT_data_in_code_info, OPT_no_data_in_code_info, true); config->dedupLiterals = args.hasArg(OPT_deduplicate_literals); // FIXME: Add a commandline flag for this too. Index: lld/MachO/Options.td =================================================================== --- lld/MachO/Options.td +++ lld/MachO/Options.td @@ -901,7 +901,7 @@ Flags<[HelpHidden]>, Group; def no_function_starts : Flag<["-"], "no_function_starts">, - HelpText<"Do not create a table of function start addresses">, + HelpText<"Do not create table of function start addresses">, Group; def no_objc_category_merging : Flag<["-"], "no_objc_category_merging">, HelpText<"Do not merge Objective-C categories into their classes">, @@ -1166,8 +1166,7 @@ Flags<[HelpHidden]>, Group; def data_in_code_info : Flag<["-"], "data_in_code_info">, - HelpText<"This option is undocumented in ld64">, - Flags<[HelpHidden]>, + HelpText<"Emit data-in-code information (default)">, Group; def no_data_in_code_info : Flag<["-"], "no_data_in_code_info">, HelpText<"Do not emit data-in-code information">, @@ -1225,8 +1224,7 @@ Flags<[HelpHidden]>, Group; def function_starts : Flag<["-"], "function_starts">, - HelpText<"This option is undocumented in ld64">, - Flags<[HelpHidden]>, + HelpText<"Create table of function start addresses (default)">, Group; def i : Flag<["-"], "i">, HelpText<"This option is undocumented in ld64">, Index: lld/test/MachO/data-in-code.s =================================================================== --- lld/test/MachO/data-in-code.s +++ lld/test/MachO/data-in-code.s @@ -4,7 +4,7 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/bar.s -o %t/bar.o -# RUN: %lld %t/foo.o %t/bar.o -o %t/main.exe +# RUN: %lld -lSystem %t/foo.o %t/bar.o -o %t/main.exe # RUN: llvm-otool -l %t/main.exe > %t/objdump # RUN: llvm-objdump --macho --data-in-code %t/main.exe >> %t/objdump # RUN: FileCheck %s < %t/objdump @@ -25,11 +25,16 @@ # CHECK-NEXT: [[#%x,TEXT + 28]] 24 JUMP_TABLE32 # CHECK-NEXT: [[#%x,TEXT + 68]] 12 JUMP_TABLE32 -# RUN: %lld %t/foo.o %t/bar.o -no_data_in_code_info -o %t/main.exe +# RUN: %lld -lSystem %t/foo.o %t/bar.o -no_data_in_code_info -o %t/main.exe # RUN: llvm-otool -l %t/main.exe | FileCheck --check-prefix=OMIT %s # OMIT-NOT: LC_DATA_IN_CODE +# RUN: %lld -lSystem %t/foo.o %t/bar.o -no_data_in_code_info -data_in_code_info -o %t/main.exe +# RUN: llvm-otool -l %t/main.exe > %t/objdump +# RUN: llvm-objdump --macho --data-in-code %t/main.exe >> %t/objdump +# RUN: FileCheck %s < %t/objdump + #--- foo.s .text .globl _main Index: lld/test/MachO/function-starts.s =================================================================== --- lld/test/MachO/function-starts.s +++ lld/test/MachO/function-starts.s @@ -3,7 +3,7 @@ # RUN: rm -rf %t; split-file %s %t # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/basic.s -o %t/basic.o -# RUN: %lld %t/basic.o -o %t/basic +# RUN: %lld -lSystem %t/basic.o -o %t/basic # RUN: llvm-objdump --syms %t/basic > %t/objdump # RUN: llvm-objdump --macho --function-starts %t/basic >> %t/objdump # RUN: FileCheck %s --check-prefix=BASIC < %t/objdump @@ -18,7 +18,7 @@ # BASIC: [[#MAIN]] # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/alias.s -o %t/alias.o -# RUN: %lld %t/alias.o -o %t/alias +# RUN: %lld -lSystem %t/alias.o -o %t/alias # RUN: llvm-objdump --syms %t/alias > %t/objdump # RUN: llvm-objdump --macho --function-starts %t/alias >> %t/objdump # RUN: FileCheck %s --check-prefix=ALIAS < %t/objdump @@ -36,6 +36,11 @@ # NO-FUNCTION-STARTS: basic-no-function-starts: # NO-FUNCTION-STARTS-EMPTY: +# RUN: %lld -lSystem %t/basic.o -no_function_starts -function_starts -o %t/basic-explicit +# RUN: llvm-objdump --syms %t/basic > %t/objdump +# RUN: llvm-objdump --macho --function-starts %t/basic >> %t/objdump +# RUN: FileCheck %s --check-prefix=BASIC < %t/objdump + #--- basic.s .section __TEXT,__text,regular,pure_instructions .globl _f1