Skip to content

[BOLT][Test] Fix PointerAuthCFIFixup.cpp build error when AArch64 not enabled - #198444

Closed
wenju-he wants to merge 2 commits into
llvm:mainfrom
wenju-he:fix-bolt-unittests-PointerAuthCFIFixup.cpp-build
Closed

[BOLT][Test] Fix PointerAuthCFIFixup.cpp build error when AArch64 not enabled#198444
wenju-he wants to merge 2 commits into
llvm:mainfrom
wenju-he:fix-bolt-unittests-PointerAuthCFIFixup.cpp-build

Conversation

@wenju-he

Copy link
Copy Markdown
Contributor

When AArch64 target isn't in LLVM_TARGETS_TO_BUILD, AARCH64_AVAILABLE is not defined and there is build error:
PointerAuthCFIFixup.cpp:133:39: error: use of undeclared identifier 'AArch64'

… enabled

When AArch64 target isn't in LLVM_TARGETS_TO_BUILD, AARCH64_AVAILABLE
is not defined and there is build error:
PointerAuthCFIFixup.cpp:133:39: error: use of undeclared identifier 'AArch64'
@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-bolt

Author: Wenju He (wenju-he)

Changes

When AArch64 target isn't in LLVM_TARGETS_TO_BUILD, AARCH64_AVAILABLE is not defined and there is build error:
PointerAuthCFIFixup.cpp:133:39: error: use of undeclared identifier 'AArch64'


Full diff: https://github.com/llvm/llvm-project/pull/198444.diff

1 Files Affected:

  • (modified) bolt/unittests/Passes/PointerAuthCFIFixup.cpp (+4)
diff --git a/bolt/unittests/Passes/PointerAuthCFIFixup.cpp b/bolt/unittests/Passes/PointerAuthCFIFixup.cpp
index 0d54b31724274..258455daf7da5 100644
--- a/bolt/unittests/Passes/PointerAuthCFIFixup.cpp
+++ b/bolt/unittests/Passes/PointerAuthCFIFixup.cpp
@@ -122,6 +122,7 @@ struct PassTester : public testing::TestWithParam<Triple::ArchType> {
 };
 } // namespace
 
+#ifdef AARCH64_AVAILABLE
 TEST_P(PassTester, ExampleTest) {
   if (GetParam() != Triple::aarch64)
     GTEST_SKIP();
@@ -163,7 +164,9 @@ TEST_P(PassTester, ExampleTest) {
   EXPECT_EQ(CFILoc.size(), 1u);
   EXPECT_EQ(CFILoc[0], 4);
 }
+#endif // AARCH64_AVAILABLE
 
+#ifdef AARCH64_AVAILABLE
 TEST_P(PassTester, fillUnknownStateInBBTest) {
   /* Check that a if BB starts with unknown RAState, we can fill the unknown
    states based on following instructions with known RAStates.
@@ -234,6 +237,7 @@ TEST_P(PassTester, fillUnknownStateInBBTest) {
   EXPECT_TRUE(RAState1.has_value());
   EXPECT_TRUE(*RAState1);
 }
+#endif // AARCH64_AVAILABLE
 
 TEST_P(PassTester, fillUnknownStubs) {
   /*

@yavtuk

yavtuk commented May 19, 2026

Copy link
Copy Markdown
Contributor

@wenju-he hello, thanks for the fix, but I would prefer to exclude the entire file in CMakeLists.txt since PointerAuthCFIFixup.cpp only applies to the aarch64 platform.
something like that

bolt/unittests/Passes/CMakeLists.txt

set(PassTests_SOURCES
  LivenessAnalysis.cpp
)

if(LLVM_TARGETS_TO_BUILD MATCHES "AArch64")
  list(APPEND PassTests_SOURCES PointerAuthCFIFixup.cpp)
endif()

add_bolt_unittest(PassTests
  ${PassTests_SOURCES}
  DISABLE_LLVM_LINK_LLVM_DYLIB
)

@paschalis-mpeis
paschalis-mpeis requested a review from bgergely0 May 19, 2026 07:39
Co-authored-by: Alexey Moksyakov <moksyakov.alexey@huawei.com>
@wenju-he

Copy link
Copy Markdown
Contributor Author

I would prefer to exclude the entire file in CMakeLists.txt since PointerAuthCFIFixup.cpp only applies to the aarch64 platform.

done, thanks @yavtuk

@bgergely0

Copy link
Copy Markdown
Contributor

Hi! isnt ths trying to solve the same issue as #197464?

That one is already approved, and we are waiting for a merge.

I only had a quick look at this and see that this is a bit more complicated change. Isn't the linked one sufficient?

@wenju-he

Copy link
Copy Markdown
Contributor Author

thanks @bgergely0, close this PR.

@wenju-he wenju-he closed this May 19, 2026
@wenju-he
wenju-he deleted the fix-bolt-unittests-PointerAuthCFIFixup.cpp-build branch May 19, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants