[PATCH] D99353: [driver] Make `clang` warn rather then error on `flang` options

Joachim Protze via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 4 01:03:39 PDT 2021


protze.joachim added a comment.

The use case, where I see the current behavior as an issue is linking multiple object files compiled from different languages.
Many build systems will pass CFLAGS as well as FFLAGS to the linker command in such case. To automatically link the necessary language-specific runtime libraries, I see using the compiler for linking as common practice:

  $(FC) -c fortran-code.F90 $(FFLAGS)
  $(CXX) -c cpp-code.cpp $(CFLAGS)
  $(CC) -c c-code.c $(CFLAGS)
  $(CXX) fortran-code.o cpp-code.o c-code.o $(FFLAGS) $(CFLAGS) -l$(FORTRAN_RUNTIME)

To support such workflow, the compiler should not error out, at least when only used for linking.

This works with `CC=gcc`, `CXX=g++`, `FC=gfortran`, and `FORTRAN_RUNTIME=gfortran`.
This used to work with `CC=clang`, `CXX=clang++`, `FC=gfortran`, and `FORTRAN_RUNTIME=gfortran`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99353



More information about the cfe-commits mailing list