1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/tools/llvm-rc/windres-format.test
Martin Storsjö 2a1f29ca9f [llvm-rc] Add a GNU windres-like frontend to llvm-rc
This primarily parses a different set of options and invokes the same
resource compiler as llvm-rc normally. Additionally, it can convert
directly to an object file (which in MSVC style setups is done with the
separate cvtres tool, or by the linker).

(GNU windres also supports other conversions; from coff object file back
to .res, and from .res or object file back to .rc form; that's not yet
implemented.)

The other bigger complication lies in being able to imply or pass the
intended target triple, to let clang find the corresponding mingw sysroot
for finding include files, and for specifying the default output object
machine format.

It can be implied from the tool triple prefix, like
`<triple>-[llvm-]windres` or picked up from the windres option e.g.
`-F pe-x86-64`. In GNU windres, that option takes BFD style format names
such as pe-i386 or pe-x86-64. As libbfd in binutils doesn't support
Windows on ARM, there's no such canonical name for the ARM targets.
Therefore, as an LLVM specific extension, this option is extended to
allow passing full triples, too.

Differential Revision: https://reviews.llvm.org/D100756
2021-04-26 22:04:29 +03:00

41 lines
1.7 KiB
Plaintext

; Check that the various input/output formats (rc/res/coff) are implied
; from file suffixes.
; RUN: rm -f %t.res
; RUN: llvm-windres --no-preprocess %p/Inputs/tag-stringtable-basic.rc %t.res
; RUN: llvm-readobj %t.res | FileCheck %s --check-prefix=CHECK-RES
; RUN: rm -f %t.o
; RUN: llvm-windres --no-preprocess -F pe-x86-64 %p/Inputs/tag-stringtable-basic.rc %t.o
; RUN: llvm-readobj --coff-resources %t.o | FileCheck %s --check-prefix=CHECK-OBJ
; RUN: rm -f %t.obj
; RUN: llvm-windres -F pe-x86-64 %t.res %t.obj
; RUN: llvm-readobj --coff-resources %t.obj | FileCheck %s --check-prefix=CHECK-OBJ
; Check that we can specify the input/output file types explicitly.
; Also check options for specifying the input/output file names.
; RUN: cat %p/Inputs/tag-stringtable-basic.rc > %t-anonymous
; RUN: rm -f %t-anonymous2
; RUN: llvm-windres --no-preprocess -O res -J rc -o %t-anonymous2 -i %t-anonymous
; RUN: llvm-readobj %t-anonymous2 | FileCheck %s --check-prefix=CHECK-RES
; RUN: rm -f %t-anonymous3
; RUN: llvm-windres -F pe-x86-64 -J res -O coff -i%t-anonymous2 -o%t-anonymous3
; RUN: llvm-readobj --coff-resources %t-anonymous3 | FileCheck %s --check-prefix=CHECK-OBJ
; CHECK-RES: Resource type (int): STRINGTABLE
; CHECK-OBJ: Format: COFF-x86-64
; CHECK-OBJ: Resources [
; CHECK-OBJ: Total Number of Resources:
; Check for format conversions that currently aren't supported.
; RUN: not llvm-windres -F pe-x86-64 -J res -O rc -i%t-anonymous2 -o%t-anonymous 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR-OUTPUT
; RUN: not llvm-windres -F pe-x86-64 -J coff -O res -i%t-anonymous3 -o%t-anonymous2 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR-INPUT
; CHECK-ERROR-OUTPUT: Unsupported output format
; CHECK-ERROR-INPUT: Unsupported input format