0

I'm trying to add a number of system calls to the kernel, so I followed this tutorial: https://medium.com/anubhav-shrimal/adding-a-hello-world-system-call-to-linux-kernel-dad32875872

I used a different kernel version though (kernel 5.9.0). This is how my syscall_64.tbl looks:

548       64        mysyscall_a          mysyscall_a
549       64        mysyscall_b          mysyscall_b
550       64        mysyscall_c          mysyscall_c
551       64        mysyscall_d          mysyscall_d
552       64        mysyscall_e          mysyscall_e

when I try to make, I keep getting this error:

ld: arch/x86/entry/syscall_64.0:(.rodata+0x1128): undefined reference to '__x64_mysyscall_a'

I checked that the names match in the .c, in the syscall_64.tbl and in syscalls.h. I also tried changing it to '__x64_sys_mysyscall_a' in syscall_64.tbl as someone suggested in another question, but it still gives the same error. Anyone knows how to solve this?

P.S. All of my system calls are defined in the same .c, not sure if this makes a difference.

maryam
  • 3
  • 1
  • 3
  • Please, update the question post with information what you have actually modified when get this error message. If we don't know what code you are write, we cannot help you to fix your code. – Tsyvarev May 15 '21 at 19:56
  • I added more details, hope it is clearer now. – maryam May 16 '21 at 09:57
  • Aside from `syscall_64.tbl` you have changed (or created) other files too, haven't you? We need to see these modifications too. – Tsyvarev May 16 '21 at 10:20
  • Like what? I also changed a line in the makefile of the kernel to : `core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ hello/` and added a makefile for my added system calls with one line `obj-y := hello.c`. – maryam May 16 '21 at 10:46
  • https://stackoverflow.com/q/8024440/1216776 – stark May 16 '21 at 11:32
  • Are you using the `SYSCALL_DEFINE`n macros in your syscall implementation code? The blog entry is out-of-date. – Ian Abbott May 17 '21 at 13:15

0 Answers0