llvm-project/llvm/test/tools/yaml2obj/ELF
Joel E. Denny 28412d1800 [lit] Implement DEFINE and REDEFINE directives
These directives define per-test lit substitutions.  The concept was
discussed at
<https://discourse.llvm.org/t/iterating-lit-run-lines/62596/10>.

For example, the following directives can be inserted into a test file
to define `%{cflags}` and `%{fcflags}` substitutions with empty
initial values, which serve as the parameters of another newly defined
`%{check}` substitution:

```
// DEFINE: %{cflags} =
// DEFINE: %{fcflags} =

// DEFINE: %{check} = %clang_cc1 %{cflags} -emit-llvm -o - %s | \
// DEFINE:            FileCheck %{fcflags} %s
```

The following directives then redefine the parameters before each use
of `%{check}`:

```
// REDEFINE: %{cflags} = -foo
// REDEFINE: %{fcflags} = -check-prefix=FOO
// RUN: %{check}

// REDEFINE: %{cflags} = -bar
// REDEFINE: %{fcflags} = -check-prefix=BAR
// RUN: %{check}
```

Of course, `%{check}` would typically be more elaborate, increasing
the benefit of the reuse.

One issue is that the strings `DEFINE:` and `REDEFINE:` already appear
in 5 tests.  This patch adjusts those tests not to use those strings.
Our prediction is that, in the vast majority of cases, if a test
author mistakenly uses one of those strings for another purpose, the
text appearing after the string will not happen to have the syntax
required for these directives.  Thus, the test author will discover
the mistake immediately when lit reports the syntax error.

This patch also expands the documentation on existing lit substitution
behavior.

Reviewed By: jhenderson, MaskRay, awarzynski

Differential Revision: https://reviews.llvm.org/D132513
2022-09-21 11:32:05 -04:00
..
DWARF [test] Use host platform specific error message substitution in lit tests 2021-03-05 07:21:53 -05:00
abiversion.yaml Reland "[lib/Support/YAMLTraits] - Don't print leading zeroes when dumping Hex8/Hex16/Hex32 types." (https://reviews.llvm.org/D90930). 2020-11-18 13:08:46 +03:00
arm-exidx-section.yaml [obj2yaml,yaml2obj] - Refine how we set/dump the sh_entsize field. 2021-01-13 11:52:40 +03:00
bb-addr-map.yaml [Propeller] Encode address offsets of basic blocks relative to the end of the previous basic blocks. 2022-06-28 07:42:54 -07:00
call-graph-profile-section.yaml [LLD][LLVM] CG Graph profile using relocations 2021-06-24 09:09:33 -07:00
class-endianness.yaml
comdat-broken-info.yaml
comdat-broken-members.yaml
comdat-broken.yaml [test] Avoid llvm-readelf/llvm-readobj one-dash long options and deprecated aliases (e.g. --file-headers) 2021-07-15 10:26:21 -07:00
content-array.yaml
custom-fill.yaml [yaml2obj] - ProgramHeaders: introduce FirstSec/LastSec instead of Sections list. 2020-11-09 13:00:50 +03:00
custom-null-section.yaml [lit] Implement DEFINE and REDEFINE directives 2022-09-21 11:32:05 -04:00
duplicate-section-names.yaml [test] Avoid llvm-readelf/llvm-readobj one-dash long options and deprecated aliases (e.g. --file-headers) 2021-07-15 10:26:21 -07:00
duplicate-symbol-names.yaml [llvm-readobj] Make -s and -t match llvm-readelf 2021-06-29 11:56:26 -07:00
dynamic-relocations.yaml
dynamic-section-i386.yaml [yaml2obj] - ProgramHeaders: introduce FirstSec/LastSec instead of Sections list. 2020-11-09 13:00:50 +03:00
dynamic-section-raw-content.yaml
dynamic-section.yaml
dynamic-symbols.yaml [yaml2obj,obj2yaml] - Make Symbol::Section field optional. 2020-12-04 13:45:47 +03:00
dynsym-section.yaml
dynsymtab-implicit-sections-size-content.yaml
eflags.yaml
emachine.yaml
empty-symbols.yaml
ent-size.yaml
gnu-hash-section.yaml
gnu-unique-symbols.yaml
group.yaml [obj2yaml,yaml2obj] - Fix issues with creating/dumping group sections. 2021-01-12 14:07:42 +03:00
hash-section.yaml
header-elfdatanone.yaml
header-osabi.yaml
header-sh-fields.yaml [yaml2obj] - ProgramHeaders: introduce FirstSec/LastSec instead of Sections list. 2020-11-09 13:00:50 +03:00
implicit-sections-addr.yaml
implicit-sections-info.yaml
implicit-sections-types.yaml
implicit-sections.yaml
invalid-docnum.yaml
linker-options.yaml
llvm-addrsig-section.yaml
llvm-deplibs-section.yaml
local-symbols.yaml
mips-abi-flags.yaml
no-phdrs.yaml
nobits.yaml
none-value.yaml
note-section.yaml [yaml2obj] Handle NT_* string values in for ELF note types 2021-02-09 16:59:22 +00:00
output-limit.yaml
override-shaddralign.yaml
override-shflags.yaml
override-shname.yaml [yaml2obj/obj2yaml] - Improve dumping/creating of ELF versioning sections. 2021-01-21 10:36:48 +03:00
override-shoffset.yaml [yaml2obj/obj2yaml] - Improve dumping/creating of ELF versioning sections. 2021-01-21 10:36:48 +03:00
override-shsize.yaml [yaml2obj/obj2yaml] - Improve dumping/creating of ELF versioning sections. 2021-01-21 10:36:48 +03:00
override-shtype.yaml [yaml2obj/obj2yaml] - Improve dumping/creating of ELF versioning sections. 2021-01-21 10:36:48 +03:00
program-header-address.yaml [yaml2obj] - ProgramHeaders: introduce FirstSec/LastSec instead of Sections list. 2020-11-09 13:00:50 +03:00
program-header-align.yaml [yaml2obj] - ProgramHeaders: introduce FirstSec/LastSec instead of Sections list. 2020-11-09 13:00:50 +03:00
program-header-nobits.yaml [yaml2obj] - ProgramHeaders: introduce FirstSec/LastSec instead of Sections list. 2020-11-09 13:00:50 +03:00
program-header-size-offset.yaml [yaml2obj] - ProgramHeaders: introduce FirstSec/LastSec instead of Sections list. 2020-11-09 13:00:50 +03:00
program-header.yaml [yaml2obj] - ProgramHeaders: introduce FirstSec/LastSec instead of Sections list. 2020-11-09 13:00:50 +03:00
reloc-sec-entry-size.yaml
reloc-sec-info.yaml
reloc-sec.yaml
relocation-addend.yaml
relocation-explicit-symbol-index.yaml
relocation-implicit-symbol-index.yaml [llvm-readobj] - For SHT_REL relocations, don't display an addend. 2020-12-14 12:03:00 +03:00
relocation-missing-symbol.yaml
relocation-type.yaml
relr-section.yaml
retain-section.yaml [ELF] Use SHF_SUNW_NODISCARD instead of SHF_GNU_RETAIN on Solaris 2022-02-23 15:41:43 +01:00
section-address-assign.yaml
section-headers-exclude.yaml [LLD][LLVM] CG Graph profile using relocations 2021-06-24 09:09:33 -07:00
section-headers.yaml [yaml2obj] Fix bug when referencing items in SectionHeaderTable 2021-06-16 10:02:22 +01:00
section-link.yaml
section-offset.yaml
section-ordering.yaml
section-size-content.yaml
section-type.yaml
section-unnamed.yaml
sh-addralign.yaml
shstrtab.yaml [llvm-readobj] Switch command line parsing from llvm::cl to OptTable 2021-07-12 10:14:42 -07:00
sht-symtab-shndx.yaml [llvm-readelf/obj] - Add support of multiple SHT_SYMTAB_SHNDX sections. 2021-01-13 11:36:43 +03:00
stack-sizes.yaml
strtab-implicit-sections.yaml
symbol-binding.yaml
symbol-index-invalid.yaml
symbol-index.yaml
symbol-name.yaml
symbol-size.yaml [yaml2obj/obj2yaml] - Make Value/Size fields of Symbol optional. 2020-12-16 13:49:57 +03:00
symbol-stother.yaml
symbol-type.yaml
symbol-value.yaml [yaml2obj/obj2yaml] - Make Value/Size fields of Symbol optional. 2020-12-16 13:49:57 +03:00
symbol-visibility.yaml
symbols-binding-order.yaml
symtab-implicit-sections-flags.yaml
symtab-implicit-sections-size-content.yaml
symtab-shlink.yaml
symtab-shtype.yaml
verdef-section.yaml [yaml2obj, obj2yaml] - Implement section header table as a special Chunk. 2021-01-25 13:08:08 +03:00
verneed-section.yaml [yaml2obj, obj2yaml] - Implement section header table as a special Chunk. 2021-01-25 13:08:08 +03:00
versym-section.yaml [yaml2obj, obj2yaml] - Implement section header table as a special Chunk. 2021-01-25 13:08:08 +03:00