[PATCH] D34764: Introduce FileEdit utility
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 28 10:56:07 PDT 2017
rnk added a comment.
@chandlerc I think we have use cases for file splitting in the linker. Many interesting test cases require two object files, and it's annoying to have to make a separate file in %S/Inputs just for this. Consider lld/test/COFF/reloc-discarded.s. I recently added this and I need to make a COFF object that defines a global in a comdat. This is the RUN: line I used to do that:
# RUN: echo -e '.section .bss,"bw",discard,main_global\n.global main_global\n main_global:\n .long 0' | \
# RUN: llvm-mc - -filetype=obj -o %t1.obj -triple x86_64-windows-msvc
That's pretty unreadable. I would much rather write:
# RUN: FileEdit %s %t
# RUN: llvm-mc %t/a.s -o %t/a.obj -filetype=obj -triple x86_64-windows-msvc
# RUN: llvm-mc %t/b.s -o %t/b.obj -filetype=obj -triple x86_64-windows-msvc
# RUN: lld-link %t/a.obj %t/b.obj -entry ...
# SPLIT: a.s
.section .bss,"bw",discard,main_global
.globl main_global
main_global:
.long 0
# SPLIT: b.s
.section .bss,"bw",discard,main_global
.globl main_global
main_global:
.long 0
...
Editors would enable assembly syntax highlighting, even. You can apply the same technique to Clang tests that need headers.
https://reviews.llvm.org/D34764
More information about the llvm-commits
mailing list