Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm-exegesis doesn't build when using gcc >= 10, glibc >= 2.35 but kernel headers < 4.18 #64456

Closed
Romain-Geissler-1A opened this issue Aug 5, 2023 · 6 comments

Comments

@Romain-Geissler-1A
Copy link
Member

Hi,

The usage of SYS_rseq in llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp might not be ok when compiling with gcc >= 10, glibc >= 2.35 but rather old kernel headers (< 4.18). It's not common, but it happened to me:

[2023-08-05T02:06:18.024Z] /workdir/src/llvm-17.0.0/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp: In member function 'void llvm::exegesis::{anonymous}::SubProcessFunctionExecutorImpl::prepareAndRunBenchmark(int, const llvm::exegesis::BenchmarkKey&) const':
[2023-08-05T02:06:18.025Z] /workdir/src/llvm-17.0.0/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp:361:17: error: 'SYS_rseq' was not declared in this scope
[2023-08-05T02:06:18.025Z]   361 |         syscall(SYS_rseq, (intptr_t)__builtin_thread_pointer() + __rseq_offset,
[2023-08-05T02:06:18.025Z]       |                 ^~~~~~~~

I guess the preprocessor directive guarding this shall be modified to read:

-#ifdef GLIBC_INITS_RSEQ
+#if defined(GLIBC_INITS_RSEQ) && defined(SYS_rseq)

Cheers,
Romain

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 5, 2023

@llvm/issue-subscribers-tools-llvm-exegesis

@Romain-Geissler-1A
Copy link
Member Author

I have submitted a patch here: https://reviews.llvm.org/D157189

llvmbot pushed a commit to llvm/llvm-project-release-prs that referenced this issue Aug 7, 2023
When compiling against recent glibc (>= 2.35) but old kernel headers (< 4.18), `SYS_rseq` is not defined and thus llvm-exegesis fails to build. So also check that `SYS_rseq` is defined before trying to use it.

Fixes llvm/llvm-project#64456

Reviewed By: MaskRay, gchatelet

Differential Revision: https://reviews.llvm.org/D157189

(cherry picked from commit f70e83a)
@Romain-Geissler-1A
Copy link
Member Author

/cherry-pick e82cc56

@Romain-Geissler-1A
Copy link
Member Author

I have created #64497 to track the backport to branch 17.

@EugeneZelenko EugeneZelenko removed this from the LLVM 17.0.X Release milestone Aug 7, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Aug 7, 2023

/cherry-pick e82cc56

Error: Command failed due to missing milestone.

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 7, 2023

/cherry-pick e82cc56

Error: Command failed due to missing milestone.

llvmbot pushed a commit to llvm/llvm-project-release-prs that referenced this issue Aug 8, 2023
When compiling against recent glibc (>= 2.35) but old kernel headers (< 4.18), `SYS_rseq` is not defined and thus llvm-exegesis fails to build. So also check that `SYS_rseq` is defined before trying to use it.

Fixes llvm/llvm-project#64456

Reviewed By: MaskRay, gchatelet

Differential Revision: https://reviews.llvm.org/D157189

(cherry picked from commit f70e83a)
tru pushed a commit to llvm/llvm-project-release-prs that referenced this issue Aug 10, 2023
When compiling against recent glibc (>= 2.35) but old kernel headers (< 4.18), `SYS_rseq` is not defined and thus llvm-exegesis fails to build. So also check that `SYS_rseq` is defined before trying to use it.

Fixes llvm/llvm-project#64456

Reviewed By: MaskRay, gchatelet

Differential Revision: https://reviews.llvm.org/D157189

(cherry picked from commit f70e83a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants