[all-commits] [llvm/llvm-project] d30bc9: [Driver] Change multilib selection algorithm

Michael Platings via All-commits all-commits at lists.llvm.org
Thu Mar 23 23:58:59 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d30bc9e91241d69410fe1a878a66438dd752014f
  Author: Michael Platings <michael.platings at arm.com>
  Date:   2023-03-24 (Fri, 24 Mar 2023)

  Changed paths:
    M clang/include/clang/Driver/Multilib.h
    M clang/include/clang/Driver/MultilibBuilder.h
    M clang/lib/Driver/Multilib.cpp
    M clang/lib/Driver/MultilibBuilder.cpp
    M clang/lib/Driver/ToolChains/Fuchsia.cpp
    M clang/lib/Driver/ToolChains/OHOS.cpp
    M clang/unittests/Driver/MultilibTest.cpp

  Log Message:
  [Driver] Change multilib selection algorithm

The new algorithm is:
1. Find all multilibs with flags that are a subset of the requested
2. If more than one multilib matches, choose the last.

In addition a new selection mechanism is permitted via an overload of
MultilibSet::select() for which multiple multilibs are returned.
This allows layering multilibs on top of each other.

Since multilibs are now ordered within a list, they no longer need a
Priority field.

The new algorithm is different to the old algorithm, but in practise
the old algorithm was always used in such a way that the effect is the
The old algorithm was to find the set intersection of the requested
flags (with the first character of each removed) with each multilib's
flags (ditto), and for that intersection check whether the first
character matched. However, ignoring the first characters, the
requested flags were always a superset of all the multilibs flags.
Therefore the new algorithm can be used as a drop-in replacement.

The exception is Fuchsia, which needs adjusting slightly to set both
fexceptions and fno-exceptions flags.

Differential Revision: https://reviews.llvm.org/D142905

More information about the All-commits mailing list