[cfe-dev] Usage of clang::driver::options::DriverOption (-Xarch_ & gcc toolchain)

Fangrui Song via cfe-dev cfe-dev at lists.llvm.org
Sun Jul 12 23:30:50 PDT 2020


Currently, DriverOption is used in two places to decide whether an option

(a) ... can follow -Xarch_* (HIP: C++ Heterogeneous-Compute Interface for Portability)
   or -Xarch_i386/-Xarch_x86_64 (Darwin)
(b) ... can be forwarded to GCC (in clang/lib/Driver/ToolChains/Gnu.cpp
   clang::driver::tools::gcc::Common::ConstructJob)

The two use cases seem very different. For (b), is
clang::driver::tools::gcc::Common, I guess it may historically have more use
cases but nowadays it seems to be only used by some bare metal like drivers to
construct linker command lines. Is my understanding correct?

If yes, should we instead mark a list of options which should be forwarded to GCC
for linking (not too few, but much fewer than the options not marked as
DriverOption).  I think such options can be found in the *link section of gcc -dumpspecs's output.


More information about the cfe-dev mailing list