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

undefined reference to `gettid' error #51

Open
akb2020 opened this issue Feb 19, 2020 · 4 comments
Open

undefined reference to `gettid' error #51

akb2020 opened this issue Feb 19, 2020 · 4 comments

Comments

@akb2020
Copy link

akb2020 commented Feb 19, 2020

I am getting 4 such errors when I run make after teh cmake command.

../qemu/riscv64-linux-user/linux-user/syscall.o: In function `clone_func':
/esesc/emul/qemu_riscv/linux-user/syscall.c:6359: undefined reference to `gettid'

Same error in function do_syscall line 11759, do_fork in lines 6508 and 6510.

Please tell me how to solve these errors.

@renau
Copy link
Member

renau commented Feb 19, 2020 via email

@akb2020
Copy link
Author

akb2020 commented Feb 19, 2020

I could not understand your answer. Please tell me what I need to do to solve these errors.

@renau
Copy link
Member

renau commented Feb 20, 2020

There is an internal patch that address this, but still not pushed to esesc. You can apply this:

+++ b/emul/qemu_riscv/linux-user/syscall.c
@@ -256,17 +256,10 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
 #define TARGET_NR__llseek TARGET_NR_llseek
 #endif
 
-#ifdef __NR_gettid
-#ifndef SYS_gettid
-_syscall0(int, gettid)
-#endif
-#else
-/* This is a replacement for the host gettid() and must return a host
-   errno. */
-static int gettid(void) {
-    return -ENOSYS;
-}
-#endif
+
+#define __NR_sys_gettid __NR_gettid
+_syscall0(int, sys_gettid)
+
 

@ShiXiongC
Copy link

在cmh命令后运行make时,出现4个此类错误。

../qemu/riscv64-linux-user/linux-user/syscall.o: In function `clone_func':
/esesc/emul/qemu_riscv/linux-user/syscall.c:6359: undefined reference to `gettid'

函数do_syscall行11759,do_fork行6508和6510中的错误相同。

请告诉我如何解决这些错误。

you can use syscall(__NR_gettid) to replaec gettid()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants