[PATCH] D83648: [Driver] Fix integrated_as definition by setting it as a DriverOption

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 12 22:59:38 PDT 2020


MaskRay added a comment.

In D83648#2146472 <https://reviews.llvm.org/D83648#2146472>, @pzheng wrote:

> Actually, this patch won't change --help because it just reduced some duplication by extracting the common part (" the integrated assembler") of the help message into the "help" of "OptOutFFlag". Sorry for the confusion.
>
> The real fix here is to restore "integrated_as" as a DriverOption. Without this, when we have -fintegrated-as on a link line, it will be passed to the linker and cause the linker to fail because it is not a valid linker flag.


The description is not correct. The actual difference is:

  static bool forwardToGCC(const Option &O) {
    // Don't forward inputs from the original command line.  They are added from
    // InputInfoList.
    return O.getKind() != Option::InputClass &&
           !O.hasFlag(options::DriverOption) && !O.hasFlag(options::LinkerInput);
  }

If `clang::driver::tools::gcc::Common` is selected, DriverOption modified options are not forwarded to gcc.

`clang -target x86_64-linux -fintegrated-as a.o '-###'` => no -fintegrated-as

`clang -target x86_64 -fintegrated-as a.o '-###'` => `"/usr/bin/gcc" "-fintegrated-as" "-m64" "-o" "a.out" "a.o"`

In this sense, all -f options not recognized by GCC should have a DriverOption tag.... I don't think we have properly tagged all options.



================
Comment at: clang/test/Driver/integrated-as.c:10
 
+// RUN: %clang -### -fintegrated-as %s 2>&1 | FileCheck %s -check-prefix FIAS-LINK
+
----------------
This test is incorrect. You need a specific target triple to select bare-metal like GCC driver.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83648/new/

https://reviews.llvm.org/D83648





More information about the cfe-commits mailing list