Add the option "obj-files" that will print out the intermediate object files during ThinLTO. This is similar to "save-temps", but doesn't output intermediate bitcode files.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I don't believe so, or at least it's not exactly the behavior I would like. The behavior I see with save-temps that I wanted to replicate with this option is that save-temps outputs the object code in this way:
$ ld.gold -plugin LLVMgold.so -plugin-opt=save-temps -r -o x.o a.o b.o $ ls x.o x.o1 x.o2 a.o b.o
Where x.o1 is the object code for a.o and x.o2 is the object code for b.o. Retaining this ordering is important to my use case---i.e., live patching the Linux kernel. From what I can tell, obj-path outputs .o files to temporary files with no special ordering to the filenames.
obj-path should produce the same order as save-temps because they use the same code path -- they both work by setting Filename to a non-empty string, which causes us to follow the code path that appends task identifiers and use non-temporary files. If you're seeing something different, maybe that should be fixed instead?
I may have spoken too soon. obj_path requires a path to the filename you want to use. This is okay, but when used in a Makefile it becomes difficult:
LDFLAGS_GOLD := -plugin $(CLANG_LIBS)/LLVMgold.so \ -plugin-opt=-code-model=kernel \ -plugin-opt=obj_path=
What should be the value for obj_path here? I can't specify a single filename as the output files from one run of ld.gold will overwrite previous ones.
I'm not sure, I'm not an expert on the Linux build system. There's probably some link rule somewhere that contains something like -o $@, maybe you can change it to say -o $@ -plugin-opt=obj-path=$@.o?