Skip to content

Commit 3ec4dbc

Browse files
committed
Address comments from ellishg
1 parent dc90e82 commit 3ec4dbc

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

lld/MachO/Driver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,10 +1349,10 @@ static void codegenDataGenerate() {
13491349
assert(!fileName.empty());
13501350
raw_fd_ostream Output(fileName, EC, sys::fs::OF_None);
13511351
if (EC)
1352-
error("fail to create raw_fd_ostream");
1352+
error("fail to create " + fileName + ": " + EC.message());
13531353

13541354
if (auto E = Writer.write(Output))
1355-
error("fail to write CGData");
1355+
error("fail to write CGData: " + toString(std::move(E)));
13561356
}
13571357

13581358
static void foldIdenticalLiterals() {

lld/MachO/Options.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,10 @@ def no_objc_category_merging : Flag<["-"], "no_objc_category_merging">,
162162
Group<grp_lld>;
163163
def lto_debug_pass_manager: Flag<["--"], "lto-debug-pass-manager">,
164164
HelpText<"Debug new pass manager">, Group<grp_lld>;
165-
def codegen_data_generate_path : Joined<["--"], "codegen-data-generate-path=">,
166-
HelpText<"Codegen data file path">, Group<grp_lld>;
165+
def codegen_data_generate_path : Separate<["--"], "codegen-data-generate-path">, Group<grp_lld>;
166+
def codegen_data_generate_path_eq : Joined<["--"], "codegen-data-generate-path=">,
167+
Alias<!cast<Separate>(codegen_data_generate_path)>, MetaVarName<"<cgdata>">,
168+
HelpText<"Write the CG data to the specified path <cgdata>.">, Group<grp_lld>;
167169
def cs_profile_generate: Flag<["--"], "cs-profile-generate">,
168170
HelpText<"Perform context sensitive PGO instrumentation">, Group<grp_lld>;
169171
def cs_profile_path: Joined<["--"], "cs-profile-path=">,

lld/test/MachO/cgdata-generate.s

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
# Synthesize raw cgdata without the header (24 byte) from the indexed cgdata.
77
# RUN: llvm-cgdata --convert --format binary %t/raw-1.cgtext -o %t/raw-1.cgdata
88
# 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
9-
# RUN: sed "s/<RAW_1_BYTES>/$(cat %t/raw-1-bytes.txt)/g" %t/merge-1-template.s > %t/merge-1.s
9+
# RUN: sed "s/<RAW_BYTES>/$(cat %t/raw-1-bytes.txt)/g" %t/merge-template.s > %t/merge-1.s
1010
# RUN: llvm-cgdata --convert --format binary %t/raw-2.cgtext -o %t/raw-2.cgdata
1111
# 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
12-
# RUN: sed "s/<RAW_2_BYTES>/$(cat %t/raw-2-bytes.txt)/g" %t/merge-2-template.s > %t/merge-2.s
12+
# RUN: sed "s/<RAW_BYTES>/$(cat %t/raw-2-bytes.txt)/g" %t/merge-template.s > %t/merge-2.s
1313

1414
# RUN: llvm-mc -filetype obj -triple arm64-apple-darwin %t/merge-1.s -o %t/merge-1.o
1515
# RUN: llvm-mc -filetype obj -triple arm64-apple-darwin %t/merge-2.s -o %t/merge-2.o
@@ -28,7 +28,7 @@
2828

2929
# We can also generate the merged codegen data from the executable that is not dead-stripped.
3030
# RUN: llvm-objdump -h %t/out| FileCheck %s
31-
CHECK: __llvm_outline
31+
# CHECK: __llvm_outline
3232
# RUN: llvm-cgdata --merge %t/out -o %t/merge-cgdata-exe
3333
# RUN: diff %t/merge-cgdata-exe %t/merge-cgdata
3434

@@ -42,7 +42,7 @@ CHECK: __llvm_outline
4242

4343
# Ensure no __llvm_outline section remains in the executable.
4444
# RUN: llvm-objdump -h %t/out-strip | FileCheck %s --check-prefix=STRIP
45-
STRIP-NOT: __llvm_outline
45+
# STRIP-NOT: __llvm_outline
4646

4747
#--- raw-1.cgtext
4848
:outlined_hash_tree
@@ -60,11 +60,6 @@ STRIP-NOT: __llvm_outline
6060
SuccessorIds: [ ]
6161
...
6262

63-
#--- merge-1-template.s
64-
.section __DATA,__llvm_outline
65-
_data:
66-
.byte <RAW_1_BYTES>
67-
6863
#--- raw-2.cgtext
6964
:outlined_hash_tree
7065
0:
@@ -81,10 +76,10 @@ _data:
8176
SuccessorIds: [ ]
8277
...
8378

84-
#--- merge-2-template.s
79+
#--- merge-template.s
8580
.section __DATA,__llvm_outline
8681
_data:
87-
.byte <RAW_2_BYTES>
82+
.byte <RAW_BYTES>
8883

8984
#--- main.s
9085
.globl _main

0 commit comments

Comments
 (0)