Skip to content

Conversation

@aengelke
Copy link
Contributor

@aengelke aengelke commented Dec 31, 2025

Fix for #173869.

If there's no strong reason, we should get rid of per-target RTTI later.

@aengelke aengelke requested a review from nikic December 31, 2025 11:25
@llvmbot llvmbot added the cmake Build system in general and CMake in particular label Dec 31, 2025
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm somewhat confused by how this code works, including for the existing LLVM_CONFIG_HAS_RTTI flag. If LLVM_REQUIRES_RTTI is used somewhere, does this depend on whether the last target for which llvm_update_compile_flags is called happens to have that set or not?

Should llvm-config only be using the global LLVM_ENABLE_RTTI instead of this second LLVM_CONFIG_HAS_RTTI variable that also uses LLVM_REQUIRES_RTTI? And if so, can we extract determining the corresponding compiler flag into a separate function that gets explicitly called from the llvm-config cmake instead of relying on the side-effect here?

@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@aengelke
Copy link
Contributor Author

aengelke commented Jan 1, 2026

CI failure was a spurious link error, worked fine on second try.

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aengelke aengelke merged commit d1b88ca into llvm:main Jan 1, 2026
13 of 14 checks passed
@aengelke aengelke deleted the fix-cmake-llvm-config branch January 1, 2026 21:24
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 2, 2026

LLVM Buildbot has detected a new failure on builder ppc64le-flang-rhel-clang running on ppc64le-flang-rhel-test while building llvm at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/43393

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-flang) failure: 1200 seconds without output running [b'ninja', b'check-flang'], attempting to kill
...
PASS: Flang :: Semantics/modfile73.f90 (4061 of 4071)
PASS: Flang :: Semantics/numeric_storage_size.f90 (4062 of 4071)
PASS: Flang :: Driver/mrecip.f90 (4063 of 4071)
PASS: Flang :: Driver/use-module-error.f90 (4064 of 4071)
PASS: Flang :: Driver/mcmodel.f90 (4065 of 4071)
PASS: Flang :: Driver/fopenmp.f90 (4066 of 4071)
PASS: Flang :: Driver/use-module.f90 (4067 of 4071)
PASS: Flang :: Intrinsics/math-codegen.fir (4068 of 4071)
PASS: Flang :: Driver/linker-options.f90 (4069 of 4071)
PASS: Flang :: Driver/omp-driver-offload.f90 (4070 of 4071)
command timed out: 1200 seconds without output running [b'ninja', b'check-flang'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=2791.351677

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 2, 2026

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-test-suite running on ppc64le-clang-test-suite while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/95/builds/19609

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LeakSanitizer-Standalone-powerpc64le :: TestCases/create_thread_leak.cpp' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 3
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./bin/clang  --driver-mode=g++ -O0  -m64 -fno-function-sections  -gline-tables-only -fsanitize=leak -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/compiler-rt/test/lsan/../ -pthread /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp
# executed command: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./bin/clang --driver-mode=g++ -O0 -m64 -fno-function-sections -gline-tables-only -fsanitize=leak -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/compiler-rt/test/lsan/../ -pthread /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp
# RUN: at line 4
not  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 1 0 0 2>&1 | FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK123
# executed command: not /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 1 0 0
# executed command: FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK123
# RUN: at line 5
not  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 0 1 0 2>&1 | FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# executed command: not /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 0 1 0
# executed command: FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# RUN: at line 6
not  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 0 0 1 2>&1 | FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# executed command: not /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 0 0 1
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
# executed command: FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# `-----------------------------
# error: command failed with exit status: 2

--

********************


ronlieb added a commit to ROCm/llvm-project that referenced this pull request Jan 2, 2026
ronlieb added a commit to ROCm/llvm-project that referenced this pull request Jan 2, 2026
@aengelke
Copy link
Contributor Author

aengelke commented Jan 2, 2026

Buildbot failures seem unrelated: first is just a timeout, second is spurious (tests pass in next build). @ronlieb you noted that this breaks your build -- what's happening and is this a pure downstream thing?

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 2, 2026

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/13697

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LeakSanitizer-AddressSanitizer-powerpc64le :: TestCases/create_thread_leak.cpp' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 3
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/./bin/clang  --driver-mode=g++ -O0  -m64 -fno-function-sections  -gline-tables-only -fsanitize=address -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/../ -pthread /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LEAsanConfig/TestCases/Output/create_thread_leak.cpp.tmp
# executed command: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/./bin/clang --driver-mode=g++ -O0 -m64 -fno-function-sections -gline-tables-only -fsanitize=address -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/../ -pthread /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LEAsanConfig/TestCases/Output/create_thread_leak.cpp.tmp
# RUN: at line 4
not  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LEAsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 1 0 0 2>&1 | FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK123
# executed command: not /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LEAsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 1 0 0
# executed command: FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK123
# RUN: at line 5
not  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LEAsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 0 1 0 2>&1 | FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# executed command: not /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LEAsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 0 1 0
# executed command: FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# RUN: at line 6
not  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LEAsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 0 0 1 2>&1 | FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# executed command: not /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LEAsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 0 0 1
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
# executed command: FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# `-----------------------------
# error: command failed with exit status: 2

--

********************


@RKSimon
Copy link
Collaborator

RKSimon commented Jan 2, 2026

@aengelke This is spamming MSVC builds with exception override warnings https://lab.llvm.org/buildbot/#/builders/46/builds/28456

[3188/18/878/4083]Building CXX object lib\Analysi...eFiles\LLVMAnalysis.dir\MemoryProfileInfo.cpp.obj
cl : Command line warning D9025 : overriding '/EHs' with '/EHs-'
cl : Command line warning D9025 : overriding '/EHc' with '/EHc-'
[3187/18/879/4083]Building CXX object lib\Analysis\CMakeFiles\LLVMAnalysis.dir\MemoryBuiltins.cpp.obj
cl : Command line warning D9025 : overriding '/EHs' with '/EHs-'
cl : Command line warning D9025 : overriding '/EHc' with '/EHc-'
[3186/18/880/4083]Building CXX object lib\Analysis\CMakeFiles\LLVMAnalysis.dir\LoopInfo.cpp.obj
cl : Command line warning D9025 : overriding '/EHs' with '/EHs-'
cl : Command line warning D9025 : overriding '/EHc' with '/EHc-'
[3185/18/881/4083]Building CXX object lib\Analysis\CMakeFiles\LLVMAnalysis.dir\ObjCARCInstKind.cpp.ob
cl : Command line warning D9025 : overriding '/EHs' with '/EHs-'
cl : Command line warning D9025 : overriding '/EHc' with '/EHc-'
[3184/18/882/4083]Building CXX object lib\Analysi...LLVMAnalysis.dir\MemoryDependenceAnalysis.cpp.obj
cl : Command line warning D9025 : overriding '/EHs' with '/EHs-'
cl : Command line warning D9025 : overriding '/EHc' with '/EHc-'
[3183/18/883/4083]Building CXX object lib\Analysi...les\LLVMAnalysis.dir\ObjCARCAliasAnalysis.cpp.obj
cl : Command line warning D9025 : overriding '/EHs' with '/EHs-'
cl : Command line warning D9025 : overriding '/EHc' with '/EHc-'
[3182/18/884/4083]Building CXX object lib\Analysi...keFiles\LLVMAnalysis.dir\MemorySSAUpdater.cpp.obj
cl : Command line warning D9025 : overriding '/EHs' with '/EHs-'
cl : Command line warning D9025 : overriding '/EHc' with '/EHc-'
[3181/18/885/4083]Building CXX object lib\Analysi...Files\LLVMAnalysis.dir\LoopAccessAnalysis.cpp.obj
cl : Command line warning D9025 : overriding '/EHs' with '/EHs-'
cl : Command line warning D9025 : overriding '/EHc' with '/EHc-'

@aengelke
Copy link
Contributor Author

aengelke commented Jan 2, 2026

Thanks for noticing, hopefully fixed with 2b903df.

@RKSimon
Copy link
Collaborator

RKSimon commented Jan 2, 2026

Thanks for noticing, hopefully fixed with 2b903df.

Thanks - that fixed it

@ronlieb
Copy link
Contributor

ronlieb commented Jan 2, 2026

Buildbot failures seem unrelated: first is just a timeout, second is spurious (tests pass in next build). @ronlieb you noted that this breaks your build -- what's happening and is this a pure downstream thing?

seems to be purely downstream, i think i am seeing an additionaly flag "-fno-rtti" during our build of offload

@kuhar
Copy link
Member

kuhar commented Jan 2, 2026

Same, I can see failures downstream even with the commit above, which causes:

 Found erroneous configuration for source file PassPlugin.cpp

 LLVM's build system enforces that all source files are added to a build
 target, that exactly one build target exists in each directory, and that
 this target lists all files in that directory.  If you want multiple
 targets in the same directory, add PARTIAL_SOURCES_INTENDED to the target
 specification, though it is discouraged.

ronlieb pushed a commit to ROCm/llvm-project that referenced this pull request Jan 2, 2026
Fix for llvm#173869.

If there's no strong reason, we should get rid of per-target RTTI later.
@aengelke
Copy link
Contributor Author

aengelke commented Jan 2, 2026

@ronlieb that's unexpected, that should've been there all the time? offload/CMakeLists.txt makes its decision purely on LLVM_ENABLE_RTTI, which was unchanged?

@kuhar but... PassPlugin.cpp is referenced in llvm/lib/Plugins/CMakeLists.txt?

@kuhar
Copy link
Member

kuhar commented Jan 2, 2026

@kuhar but... PassPlugin.cpp is referenced in llvm/lib/Plugins/CMakeLists.txt?

to me this indicates something's off with cmake, let me try a clean build, maybe these rtti changes messed up the cache etc.

kuhar added a commit to iree-org/llvm-project that referenced this pull request Jan 2, 2026
kuhar added a commit to iree-org/iree that referenced this pull request Jan 2, 2026
New reverts:
* llvm/llvm-project#174084 -- causes linker
errors related to rtti in stablehlo code
*
llvm/llvm-project@2b903df
-- follow up fix to the above (doesn't fix it for us)
 
 Existing local reverts carried forward:
* Local revert of llvm/llvm-project#169614 due
to llvm/llvm-project#172932.
Abhishek-Varma pushed a commit to iree-org/llvm-project that referenced this pull request Jan 5, 2026
Abhishek-Varma added a commit to Abhishek-Varma/iree that referenced this pull request Jan 5, 2026
Existing local reverts carried forward:
* Local revert of llvm/llvm-project#169614 due to llvm/llvm-project#172932.
* llvm/llvm-project#174084 -- causes linker errors related to rtti in stablehlo code
* llvm/llvm-project@2b903df -- follow up fix to the above (doesn't fix it for us)

Signed-off-by: Abhishek Varma <[email protected]>
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jan 6, 2026
Fix for llvm#173869.

If there's no strong reason, we should get rid of per-target RTTI later.
@dcaballe
Copy link
Contributor

dcaballe commented Jan 6, 2026

I'm also hitting some issues with this commit. It looks like a tablegen component in my project that was built with RTTI disabled by default is now built with RTTI enabled so probably some cmake var is not cached or propagated as expected?

@aengelke
Copy link
Contributor Author

aengelke commented Jan 6, 2026

Is this reproducible with a clean cmake configuration? Is LLVM_OPTIMIZED_TABLEGEN set or is this a cross compilation? Can you share the cmake configuration and the compilation commands that lead to the error?

kuhar added a commit to iree-org/iree that referenced this pull request Jan 6, 2026
Existing local reverts carried forward:
* Local revert of llvm/llvm-project#169614 due
to llvm/llvm-project#172932.
* llvm/llvm-project#174084 -- causes linker
errors related to rtti in stablehlo code
*
llvm/llvm-project@2b903df
-- follow up fix to the above (doesn't fix it for us)

Signed-off-by: Abhishek Varma <[email protected]>

---------

Signed-off-by: Abhishek Varma <[email protected]>
Co-authored-by: Jakub Kuderski <[email protected]>
Abhishek-Varma added a commit to Abhishek-Varma/iree that referenced this pull request Jan 7, 2026
Existing local reverts carried forward:
* Local revert of llvm/llvm-project#169614 due to llvm/llvm-project#172932.
* llvm/llvm-project#174084 -- causes linker errors related to rtti in stablehlo code
* llvm/llvm-project@2b903df -- follow up fix to the above (doesn't fix it for us)

Signed-off-by: Abhishek Varma <[email protected]>
Abhishek-Varma pushed a commit to iree-org/llvm-project that referenced this pull request Jan 7, 2026
@Abhishek-Varma
Copy link
Contributor

Hi.

I'm getting the following error (which goes away on reverting this PR's commit) :-

[876/4230] Linking CXX executable llvm-project/bin/mlir_builder_tblgen
FAILED: llvm-project/bin/mlir_builder_tblgen
: && /usr/bin/c++ -Wno-deprecated-declarations -g -Wl,-rpath-link,/home/abhvarma/iree/build/llvm-project/lib  -Wl,--gc-sections llvm-external-projects/stablehlo/stablehlo/integrations/cpp/builder/CMakeFiles/mlir_builder_tblgen.dir/MlirBuilderTblgen.cpp.o -o llvm-project/bin/mlir_builder_tblgen  -Wl,-rpath,"\$ORIGIN/../lib"  llvm-project/lib/libLLVMSupport.a  llvm-project/lib/libLLVMTableGen.a  llvm-project/lib/libLLVMTableGen.a  llvm-project/lib/libMLIRTblgenLib.a  llvm-project/lib/libMLIRSupport.a  llvm-project/lib/libLLVMTableGen.a  llvm-project/lib/libMLIRTableGen.a  llvm-project/lib/libLLVMSupport.a  -lrt  -ldl  -lm  llvm-project/lib/libLLVMDemangle.a && :
/usr/bin/ld: llvm-external-projects/stablehlo/stablehlo/integrations/cpp/builder/CMakeFiles/mlir_builder_tblgen.dir/MlirBuilderTblgen.cpp.o:(.data.rel.ro+0x200): undefined reference to `typeinfo for llvm::cl::Option'
/usr/bin/ld: llvm-external-projects/stablehlo/stablehlo/integrations/cpp/builder/CMakeFiles/mlir_builder_tblgen.dir/MlirBuilderTblgen.cpp.o:(.data.rel.ro+0x230): undefined reference to `typeinfo for llvm::cl::generic_parser_base'
/usr/bin/ld: llvm-external-projects/stablehlo/stablehlo/integrations/cpp/builder/CMakeFiles/mlir_builder_tblgen.dir/MlirBuilderTblgen.cpp.o:(.data.rel.ro+0x278): undefined reference to `typeinfo for llvm::cl::GenericOptionValue'
/usr/bin/ld: llvm-external-projects/stablehlo/stablehlo/integrations/cpp/builder/CMakeFiles/mlir_builder_tblgen.dir/MlirBuilderTblgen.cpp.o:(.data.rel.ro._ZTIN4llvm7support6detail23provider_format_adapterIRmEE[_ZTIN4llvm7support6detail23provider_format_adapterIRmEE]+0x10): undefined reference to `typeinfo for llvm::support::detail::format_adapter'
/usr/bin/ld: llvm-external-projects/stablehlo/stablehlo/integrations/cpp/builder/CMakeFiles/mlir_builder_tblgen.dir/MlirBuilderTblgen.cpp.o:(.data.rel.ro._ZTIN4llvm7support6detail23provider_format_adapterIRNS_5TwineEEE[_ZTIN4llvm7support6detail23provider_format_adapterIRNS_5TwineEEE]+0x10): undefined reference to `typeinfo for llvm::support::detail::format_adapter'
/usr/bin/ld: llvm-external-projects/stablehlo/stablehlo/integrations/cpp/builder/CMakeFiles/mlir_builder_tblgen.dir/MlirBuilderTblgen.cpp.o:(.data.rel.ro._ZTIN4llvm7support6detail23provider_format_adapterIRKNS_9StringRefEEE[_ZTIN4llvm7support6detail23provider_format_adapterIRKNS_9StringRefEEE]+0x10): undefined reference to `typeinfo for llvm::support::detail::format_adapter'
/usr/bin/ld: llvm-external-projects/stablehlo/stablehlo/integrations/cpp/builder/CMakeFiles/mlir_builder_tblgen.dir/MlirBuilderTblgen.cpp.o:(.data.rel.ro._ZTIN4llvm7support6detail23provider_format_adapterINS_9StringRefEEE[_ZTIN4llvm7support6detail23provider_format_adapterINS_9StringRefEEE]+0x10): undefined reference to `typeinfo for llvm::support::detail::format_adapter'
/usr/bin/ld: llvm-external-projects/stablehlo/stablehlo/integrations/cpp/builder/CMakeFiles/mlir_builder_tblgen.dir/MlirBuilderTblgen.cpp.o:(.data.rel.ro._ZTIN4llvm7support6detail23provider_format_adapterIRNS_9StringRefEEE[_ZTIN4llvm7support6detail23provider_format_adapterIRNS_9StringRefEEE]+0x10): undefined reference to `typeinfo for llvm::support::detail::format_adapter'
/usr/bin/ld: llvm-external-projects/stablehlo/stablehlo/integrations/cpp/builder/CMakeFiles/mlir_builder_tblgen.dir/MlirBuilderTblgen.cpp.o:(.data.rel.ro._ZTIN4llvm7support6detail23provider_format_adapterIRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE[_ZTIN4llvm7support6detail23provider_format_adapterIRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE]+0x10): more undefined references to `typeinfo for llvm::support::detail::format_adapter' follow
/usr/bin/ld: llvm-external-projects/stablehlo/stablehlo/integrations/cpp/builder/CMakeFiles/mlir_builder_tblgen.dir/MlirBuilderTblgen.cpp.o:(.data.rel.ro._ZTIN4mlir20raw_indented_ostreamE[_ZTIN4mlir20raw_indented_ostreamE]+0x10): undefined reference to `typeinfo for llvm::raw_ostream'
collect2: error: ld returned 1 exit status

@aengelke
Copy link
Contributor Author

aengelke commented Jan 7, 2026

@Abhishek-Varma Looks like a downstream problem in iree_llvm. It's not possible to just set some CMake values and expect things to work; you also need to run the code in HandleLLVMOptions.cmake. I don't think we support direct access to functions in AddLLVM (and transitively though AddMLIR) without running the outer skeleton.

@dcaballe
Copy link
Contributor

dcaballe commented Jan 7, 2026

I don't think we can expect external projects to mandatorily include HandleLLVMOptions.cmake, at least not in the way it is today. That file adds many flags beyond just -fno-rtti, including warning-related flags that are not needed to integrate with LLVM.

I think this PR fixes the problem: #174873
The issue is that LLVM_CXXFLAGS_RTTI_DISABLE and LLVM_CXXFLAGS_RTTI_ENABLE are now undefined for external projects after this commit, since they are defined at LLVM config time in HandleLLVMOptions.cmake but not exported via LLVMConfig.cmake.in. So, any external project calling llvm_update_compile_flags() will result in an empty string instead of the expected -fno-rtti flag (See:

list(APPEND LLVM_COMPILE_CXXFLAGS ${LLVM_CXXFLAGS_RTTI_DISABLE})
)

I also found a typo in another CMake variable.

neildhar added a commit to neildhar/triton that referenced this pull request Jan 8, 2026
I noticed that this function in upstream LLVM now depends on also
including HandleLLVMOptions (llvm/llvm-project#174084). We could pull
that in but it enables a lot of warnings globally, and seems likely to
create additional churn when updating LLVM.

Instead, we can just disable exceptions and rtti ourselves, and remove
calls to the function.
neildhar added a commit to neildhar/triton that referenced this pull request Jan 8, 2026
I noticed that this function in upstream LLVM now depends on also
including HandleLLVMOptions (llvm/llvm-project#174084). We could pull
that in but it enables a lot of warnings globally, and seems likely to
create additional churn when updating LLVM.

Instead, we can just disable exceptions and rtti ourselves, and remove
calls to the function.
kuhar pushed a commit to iree-org/iree that referenced this pull request Jan 8, 2026
Existing local reverts carried forward:
* Local revert of llvm/llvm-project#169614 due
to llvm/llvm-project#172932.
* llvm/llvm-project#174084 -- causes linker
errors related to rtti in stablehlo code
*
llvm/llvm-project@2b903df
-- follow up fix to the above (doesn't fix it for us)

Signed-off-by: Abhishek Varma <[email protected]>

---------

Signed-off-by: Abhishek Varma <[email protected]>
Abhishek-Varma pushed a commit to iree-org/llvm-project that referenced this pull request Jan 9, 2026
Abhishek-Varma added a commit to Abhishek-Varma/iree that referenced this pull request Jan 9, 2026
Existing local reverts carried forward:
* Local revert of llvm/llvm-project#169614 due to llvm/llvm-project#172932.
* llvm/llvm-project#174084 -- causes linker errors related to rtti in stablehlo code
* llvm/llvm-project@2b903df -- follow up fix to the above (doesn't fix it for us)

-- Along with the above, IREE header fixes were done to
   accomodate changes introduced via llvm/llvm-project#82190
   for `Affine/Transforms/Passes.h`.

NOTE: [Twine fix commit](iree-org/llvm-project@2eaa29c) was dropped from our fork since llvm/llvm-project#175077 got merged upstream.

Signed-off-by: Abhishek Varma <[email protected]>
kuhar pushed a commit to iree-org/iree that referenced this pull request Jan 9, 2026
Existing local reverts carried forward:
* Local revert of llvm/llvm-project#169614 due
to llvm/llvm-project#172932.
* llvm/llvm-project#174084 -- causes linker
errors related to rtti in stablehlo code
*
llvm/llvm-project@2b903df
-- follow up fix to the above (doesn't fix it for us)

-- Along with the above, IREE header fixes were done to
accomodate changes introduced via
llvm/llvm-project#82190
   for `Affine/Transforms/Passes.h`.

NOTE: [Twine fix
commit](iree-org/llvm-project@2eaa29c)
was dropped from our fork since
llvm/llvm-project#175077 got merged upstream.

Signed-off-by: Abhishek Varma <[email protected]>

Signed-off-by: Abhishek Varma <[email protected]>
peterbell10 pushed a commit to triton-lang/triton that referenced this pull request Jan 9, 2026
I noticed that `llvm_update_compile_flags ` in upstream LLVM now depends
on also including HandleLLVMOptions (llvm/llvm-project#174084). We could
pull that in but it enables a lot of warnings globally, and seems likely
to create additional churn when updating LLVM.

Instead, we can just disable exceptions and rtti ourselves, and remove
calls to the LLVM provided helpers. This makes the library builds easier
to follow, and reduces the chance of further upstream LLVM changes
breaking the build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmake Build system in general and CMake in particular

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants