Sometimes it's useful to emit assembly after LTO stage to modify it manually. Emitting precodegen bitcode file (via save-temps plugin option) and then feeding it to llc doesn't always give the same binary as original.
This patch is simpler alternative to https://reviews.llvm.org/D24020.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Nit on patch description: use [gold] not [LTO] since this is about the gold plugin specifically, and not a change to the LTO API. Also, please add a gold test.
tools/gold/gold-plugin.cpp | ||
---|---|---|
1081 | Rather than doing this copying, I think you could modify the invocation of getOutputFileName so that it sets Filename to output_name (or maybe output_name + ".s"?) in this case. I.e. see what it does when the output type is OT_SAVE_TEMPS. Then it should emit the assemble to the desired file directly. |
Updated title, added test and removed copying files.
I decided not to add '.s' to the filename, because then user can also name it as "out.s" and it will be "out.s.s" which seems unnatural.
LGTM, with a change to the gold invocations to make the test more portable.
test/tools/gold/X86/emit-asm.ll | ||
---|---|---|
4 | Please add "-m elf_x86_64" to the gold invocations. |
Added "-m elf_x86_64" to the gold invocation.
@tejohnson, can you please commit this patch on my behalf?
Please add "-m elf_x86_64" to the gold invocations.