File tree Expand file tree Collapse file tree 5 files changed +34
-0
lines changed Expand file tree Collapse file tree 5 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,9 @@ struct Configuration {
190
190
// Used for /thinlto-object-suffix-replace:
191
191
std::pair<llvm::StringRef, llvm::StringRef> thinLTOObjectSuffixReplace;
192
192
193
+ // Used for /lto-obj-path:
194
+ llvm::StringRef ltoObjPath;
195
+
193
196
uint64_t align = 4096 ;
194
197
uint64_t imageBase = -1 ;
195
198
uint64_t fileAlign = 512 ;
Original file line number Diff line number Diff line change @@ -1475,6 +1475,7 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) {
1475
1475
getOldNewOptions (args, OPT_thinlto_prefix_replace);
1476
1476
config->thinLTOObjectSuffixReplace =
1477
1477
getOldNewOptions (args, OPT_thinlto_object_suffix_replace);
1478
+ config->ltoObjPath = args.getLastArgValue (OPT_lto_obj_path);
1478
1479
// Handle miscellaneous boolean flags.
1479
1480
config->allowBind = args.hasFlag (OPT_allowbind, OPT_allowbind_no, true );
1480
1481
config->allowIsolation =
Original file line number Diff line number Diff line change @@ -177,6 +177,8 @@ std::vector<StringRef> BitcodeCompiler::compile() {
177
177
// files. After that, we exit from linker and ThinLTO backend runs in a
178
178
// distributed environment.
179
179
if (config->thinLTOIndexOnly ) {
180
+ if (!config->ltoObjPath .empty ())
181
+ saveBuffer (buf[0 ], config->ltoObjPath );
180
182
if (indexFile)
181
183
indexFile->close ();
182
184
return {};
Original file line number Diff line number Diff line change @@ -191,6 +191,9 @@ def thinlto_object_suffix_replace : P<
191
191
def thinlto_prefix_replace: P<
192
192
"thinlto-prefix-replace",
193
193
"'old;new' replace old prefix with new prefix in ThinLTO outputs">;
194
+ def lto_obj_path : P<
195
+ "lto-obj-path",
196
+ "output native object for merged LTO unit to this path">;
194
197
def dash_dash_version : Flag<["--"], "version">,
195
198
HelpText<"Print version information">;
196
199
defm threads: B<"threads",
Original file line number Diff line number Diff line change
1
+ ; REQUIRES: x86
2
+
3
+ ; Test to ensure that thinlto-index-only with lto-obj-path creates
4
+ ; the native object file.
5
+ ; RUN: opt -module-summary %s -o %t1.obj
6
+ ; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.obj
7
+ ; RUN: rm -f %t4.obj
8
+ ; RUN: lld-link -thinlto-index-only -lto-obj-path:%t4.obj -out:t3.exe \
9
+ ; RUN: -entry:main %t1.obj %t2.obj
10
+ ; RUN: llvm-readobj -h %t4.obj | FileCheck %s
11
+ ; RUN: llvm-nm %t4.obj 2>&1 | FileCheck %s -check-prefix=SYMBOLS
12
+ ; RUN: llvm-nm %t4.obj 2>&1 | count 1
13
+
14
+ ; CHECK: Format: COFF-x86-64
15
+ ; SYMBOLS: @feat.00
16
+
17
+ target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
18
+ target triple = "x86_64-pc-windows-msvc19.0.24215"
19
+
20
+ declare void @g (...)
21
+
22
+ define void @main () {
23
+ call void (...) @g ()
24
+ ret void
25
+ }
You can’t perform that action at this time.
0 commit comments