[all-commits] [llvm/llvm-project] 16aa4a: [Multilib] Custom flags YAML parsing
Victor Campos via All-commits
all-commits at lists.llvm.org
Tue Jan 14 06:03:06 PST 2025
Branch: refs/heads/users/vhscampos/multilib-flags-yaml-parsing
Home: https://github.com/llvm/llvm-project
Commit: 16aa4a010c22288ba363e4ab680a38fe0b6a327d
https://github.com/llvm/llvm-project/commit/16aa4a010c22288ba363e4ab680a38fe0b6a327d
Author: Victor Campos <victor.campos at arm.com>
Date: 2025-01-14 (Tue, 14 Jan 2025)
Changed paths:
M clang/include/clang/Driver/Multilib.h
M clang/lib/Driver/Multilib.cpp
A clang/test/Driver/baremetal-multilib-custom-flags-parsing.yaml
Log Message:
-----------
[Multilib] Custom flags YAML parsing
This patch is the first step to extend the current multilib system to
support the selection of library variants which do not correspond to
existing command-line options.
Proposal can be found in
https://discourse.llvm.org/t/rfc-multilib-custom-flags/81058
The multilib mechanism supports libraries that target code generation or
language options such as `--target`, `-mcpu`, `-mfpu`,
`-mbranch-protection`. However, some library variants are particular to
features that do not correspond to any command-line options. Examples
include variants for multithreading and semihosting.
This work introduces a way to instruct the multilib system to consider
these features in library selection. This particular patch comprises a
new section in `multilib.yaml` to declare flags for which no option
exists. Henceforth this sort of flag will be called `custom flag` for
clarity.
The `multilib.yaml` file will have a new section called Flags which
contains the declarations of the target’s custom flags:
```yaml
Flags:
- Name: multithreaded
Values:
- Name: no-multithreaded
MacroDefines: [__SINGLE_THREAD__]
- Name: multithreaded
Default: no-multithreaded
- Name: io
Values:
- Name: io-none
- Name: io-semihosting
MacroDefines: [SEMIHOSTING]
- Name: io-linux-syscalls
MacroDefines: [LINUX_SYSCALLS, HOSTED=1]
Default: io-none
```
- Name: the name to categorize a flag.
- Values: a list of possible values.
- Default: it specifies which value this flag should take if not
specified in the command-line invocation. It must be one value from the
Values field.
Each flag Value follows this description:
- Name (required): the name of the custom flag value (string). This is
the string to be used in `-fmultilib-flag=<string>`.
- MacroDefines (optional): a list of strings to be used as macro
definitions. Each string
is fed into the driver as ``-D<string>``.
A Default value is useful to save users from specifying custom flags
that have a most commonly used value.
The namespace of flag values is common across all flags. This means that
flag values must be unique.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list