diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp index e4c908f0b0aaf9..c75eee2c441869 100644 --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -1349,10 +1349,10 @@ static void codegenDataGenerate() { assert(!fileName.empty()); raw_fd_ostream Output(fileName, EC, sys::fs::OF_None); if (EC) - error("fail to create raw_fd_ostream"); + error("fail to create " + fileName + ": " + EC.message()); if (auto E = Writer.write(Output)) - error("fail to write CGData"); + error("fail to write CGData: " + toString(std::move(E))); } static void foldIdenticalLiterals() { diff --git a/lld/MachO/Options.td b/lld/MachO/Options.td index 8c5c6a853f3cc7..70eb7c8b9e466b 100644 --- a/lld/MachO/Options.td +++ b/lld/MachO/Options.td @@ -162,8 +162,10 @@ def no_objc_category_merging : Flag<["-"], "no_objc_category_merging">, Group; def lto_debug_pass_manager: Flag<["--"], "lto-debug-pass-manager">, HelpText<"Debug new pass manager">, Group; -def codegen_data_generate_path : Joined<["--"], "codegen-data-generate-path=">, - HelpText<"Codegen data file path">, Group; +def codegen_data_generate_path : Separate<["--"], "codegen-data-generate-path">, Group; +def codegen_data_generate_path_eq : Joined<["--"], "codegen-data-generate-path=">, + Alias(codegen_data_generate_path)>, MetaVarName<"">, + HelpText<"Write the CG data to the specified path .">, Group; def cs_profile_generate: Flag<["--"], "cs-profile-generate">, HelpText<"Perform context sensitive PGO instrumentation">, Group; def cs_profile_path: Joined<["--"], "cs-profile-path=">, diff --git a/lld/test/MachO/cgdata-generate.s b/lld/test/MachO/cgdata-generate.s index 0f91070dd9cc0c..6295e33a39bd3b 100644 --- a/lld/test/MachO/cgdata-generate.s +++ b/lld/test/MachO/cgdata-generate.s @@ -6,10 +6,10 @@ # Synthesize raw cgdata without the header (24 byte) from the indexed cgdata. # RUN: llvm-cgdata --convert --format binary %t/raw-1.cgtext -o %t/raw-1.cgdata # RUN: od -t x1 -j 24 -An %t/raw-1.cgdata | tr -d '\n\r\t' | sed 's/ \+/ /g; s/^ *//; s/ *$//; s/ /,0x/g; s/^/0x/' > %t/raw-1-bytes.txt -# RUN: sed "s//$(cat %t/raw-1-bytes.txt)/g" %t/merge-1-template.s > %t/merge-1.s +# RUN: sed "s//$(cat %t/raw-1-bytes.txt)/g" %t/merge-template.s > %t/merge-1.s # RUN: llvm-cgdata --convert --format binary %t/raw-2.cgtext -o %t/raw-2.cgdata # RUN: od -t x1 -j 24 -An %t/raw-2.cgdata | tr -d '\n\r\t' | sed 's/ \+/ /g; s/^ *//; s/ *$//; s/ /,0x/g; s/^/0x/' > %t/raw-2-bytes.txt -# RUN: sed "s//$(cat %t/raw-2-bytes.txt)/g" %t/merge-2-template.s > %t/merge-2.s +# RUN: sed "s//$(cat %t/raw-2-bytes.txt)/g" %t/merge-template.s > %t/merge-2.s # RUN: llvm-mc -filetype obj -triple arm64-apple-darwin %t/merge-1.s -o %t/merge-1.o # RUN: llvm-mc -filetype obj -triple arm64-apple-darwin %t/merge-2.s -o %t/merge-2.o @@ -28,7 +28,7 @@ # We can also generate the merged codegen data from the executable that is not dead-stripped. # RUN: llvm-objdump -h %t/out| FileCheck %s -CHECK: __llvm_outline +# CHECK: __llvm_outline # RUN: llvm-cgdata --merge %t/out -o %t/merge-cgdata-exe # RUN: diff %t/merge-cgdata-exe %t/merge-cgdata @@ -42,7 +42,7 @@ CHECK: __llvm_outline # Ensure no __llvm_outline section remains in the executable. # RUN: llvm-objdump -h %t/out-strip | FileCheck %s --check-prefix=STRIP -STRIP-NOT: __llvm_outline +# STRIP-NOT: __llvm_outline #--- raw-1.cgtext :outlined_hash_tree @@ -60,11 +60,6 @@ STRIP-NOT: __llvm_outline SuccessorIds: [ ] ... -#--- merge-1-template.s -.section __DATA,__llvm_outline -_data: -.byte - #--- raw-2.cgtext :outlined_hash_tree 0: @@ -81,10 +76,10 @@ _data: SuccessorIds: [ ] ... -#--- merge-2-template.s +#--- merge-template.s .section __DATA,__llvm_outline _data: -.byte +.byte #--- main.s .globl _main