[all-commits] [llvm/llvm-project] 872798: [Driver] Add exclusive-group feature to multilib.y...
Simon Tatham via All-commits
all-commits at lists.llvm.org
Fri Dec 1 04:00:34 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8727982bdfb84ce4adbd138c146a6b7ecaf98fdb
https://github.com/llvm/llvm-project/commit/8727982bdfb84ce4adbd138c146a6b7ecaf98fdb
Author: Simon Tatham <simon.tatham at arm.com>
Date: 2023-12-01 (Fri, 01 Dec 2023)
Changed paths:
M clang/include/clang/Driver/Multilib.h
M clang/lib/Driver/Multilib.cpp
A clang/test/Driver/baremetal-multilib-exclusive-group.yaml
A clang/test/Driver/baremetal-multilib-group-error.yaml
Log Message:
-----------
[Driver] Add exclusive-group feature to multilib.yaml. (#69447)
This allows a YAML-based multilib configuration to specify explicitly
that a subset of its library directories are alternatives to each
other, i.e. at most one of that subset should be selected.
So if you have multiple sysroots each including a full set of headers
and libraries, you can mark them as members of the same mutually
exclusive group, and then you'll be sure that only one of them is
selected, even if two or more are compatible with the compile options.
This is particularly important in multilib setups including the libc++
headers, where selecting the include directories from two different
sysroots can cause an actual build failure. This occurs when including
<stdio.h>, for example: libc++'s stdio.h is included first, and will
try to use `#include_next` to fetch the underlying libc's version. But
if there are two include directories from separate multilibs, then
both of their C++ include directories will end up on the include path
first, followed by both the C directories. So the `#include_next` from
the first libc++ stdio.h will include the second libc++ stdio.h, which
will do nothing because it has the same include guard macro, and the
libc header won't ever be included at all.
If more than one of the options in an exclusive group matches the
given flags, the last one wins.
The syntax for specifying this in multilib.yaml is to define a Groups
section in which you specify your group names, and for each one,
declare it to have Type: Exclusive. (This reserves space in the syntax
for maybe adding other group types later, such as a group of mutually
_dependent_ things that you must have all or none of.) Then each
Variant record that's a member of a group has a Group: property giving
that group's name.
More information about the All-commits
mailing list