[PATCH] D142403: [build] Force building LLVMTargetParser before other non-LLVM components.

Francesco Petrogalli via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 23 13:47:06 PST 2023


fpetrogalli created this revision.
fpetrogalli added reviewers: mgorny, tstellar.
Herald added subscribers: luismarques, s.egerton, kadircet, PkmX, simoncook, arichardson.
Herald added a project: All.
fpetrogalli requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay, ilya-biryukov.
Herald added a project: clang.

By the time we start building clangDriver and clangBasic, we need to
make sure that the header file include `#include
"llvm/TargetParser/RISCVTargetParserDef.inc"` used by
`llvm/include/llvm/Targetparser/RISCVTargetParser.h` is created before
the .h file itself is used in the aforementioned clang components.

We opted for this solution because:

1. Adding TargetParser to the LLVM_LINK_COMPONENTS list of clangDriver

and clangBasic can incur in parallel builds, where the clang libraries
are built before LLVMTargetParser is ready. This generates errors like
`fatal error: llvm/TargetParser/RISCVTargetParserDef.inc: No such file
or directory`.

2. Using the original RISCVTargetParserTablegen as DEPENDS of

clangDriver and clangBasic breaks stand-alone builds [1] of clang
(because cmake configuration does not know about the cmake-tree of
llvm, in which RISCVTargetParserTablegen is created).

[1] https://llvm.org/docs/GettingStarted.html#stand-alone-builds

This commit is a rework of https://reviews.llvm.org/D141581, which was
reverted in https://reviews.llvm.org/rG20ffb9aaf982.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142403

Files:
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Driver/CMakeLists.txt


Index: clang/lib/Driver/CMakeLists.txt
===================================================================
--- clang/lib/Driver/CMakeLists.txt
+++ clang/lib/Driver/CMakeLists.txt
@@ -93,7 +93,7 @@
 
   DEPENDS
   ClangDriverOptions
-  RISCVTargetParserTableGen
+  LLVMTargetParser
 
   LINK_LIBS
   clangBasic
Index: clang/lib/Basic/CMakeLists.txt
===================================================================
--- clang/lib/Basic/CMakeLists.txt
+++ clang/lib/Basic/CMakeLists.txt
@@ -110,7 +110,7 @@
 
   DEPENDS
   omp_gen
-  RISCVTargetParserTableGen
+  LLVMTargetParser
   )
 
 target_link_libraries(clangBasic


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142403.491502.patch
Type: text/x-patch
Size: 620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230123/836d4817/attachment.bin>


More information about the cfe-commits mailing list