Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 930  / 3 Years ago, mon, september 13, 2021, 3:42:42

Context:
I am currently in a course that revolves around using the gem5 simulator. Many of the students in the course including myself installed 22.04 instead of 20.04 which is referenced directly in the documentation.


Error:
In 22.04 an example piece of c code from the gem5 library is being recompiled from source. The build command used was gcc -O0 --ggd3 -std=c99 -static -o a.out hello.c (Note this same build command works fine with 20.04). When a.out is ran in the gem5 simulation code this error is thrown build/X86/sim/syscall_desc.hh:206: fatal: Syscall 334 out of range.


The big question:
What about compiling under 20.04 creates compatible c code with the gem5 simulator where 22.04 does not. I have tried using the same gcc version for both (gcc-9) and cant seem to figure this out.


More From » 20.04

 Answers
6

Background


The issue is that 22.04 uses GLIBC 2.35, which adds support for restartable sequences. Feel free to read up more on what restartable sequences are here if you are interested - https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/


Restartable sequences are implemented in GLIBC 2.35 by registering a rseq struct with the kernel at the start of every program. This is done via a syscall (syscall 334). At the moment, gem5 doesn't support restartable sequences, and the syscall is unimplmented (and undefined).


The solution


The proper way to fix this problem is to revert to an earlier version of GLIBC (pre 2.35). However, a quicker solution if you don't intend on using restartable sequences (as will likely be the case most of the time) is to simply ignore the syscall. This can be done by simply adding the following line to the end of gem5/src/arch/x86/linux/syscall_tbl64.cc


{ 334, "rseq", ignoreFunc }

This will declare the syscall for gem5, and handle it by ignoring it. So, the initial registration of the rseq struct will never actually happen with the kernel, though for most situations this is likely fine.


[#253] Tuesday, September 14, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
oleard

Total Points: 344
Total Questions: 105
Total Answers: 113

Location: Bonaire
Member since Tue, Sep 20, 2022
2 Years ago
oleard questions
Mon, Sep 26, 22, 18:21, 2 Years ago
Mon, Nov 1, 21, 21:27, 3 Years ago
Sat, May 7, 22, 20:47, 2 Years ago
Sun, Oct 2, 22, 01:10, 2 Years ago
Sun, Jul 24, 22, 18:15, 2 Years ago
;