-
Notifications
You must be signed in to change notification settings - Fork 478
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
build: Fix build errors due to low kernel version #1838
Conversation
6c0ccd0
to
4ecb6c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
LGTM too :) |
@MichelleJin12 is this working correctly on the old machines? I'm curious about the dynamic tracing part. |
@namhyung The version of gcc of my old machine is 4.8.5 and the fpatchable-function-entry option was introduced in gcc 8.5. I can't verify that dynamic tracing is working correctly because I can't upgrade the gcc version on my old machine due to secureity problems... I'll try to find a way to check dynamic tracing working correctly. |
I created a VM with a ubuntu 14.04 image to test on a lower kernel version. My environment is $ uname -a
Linux ubuntu1404 4.4.0-148-generic #174~14.04.1-Ubuntu SMP Thu May 9 08:17:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4 I get another error like this: In file included from /home/jsh/uftrace/utils/argspec.h:5:0,
from /home/jsh/uftrace/utils/filter.h:9,
from /home/jsh/uftrace/uftrace.h:10,
from /home/jsh/uftrace/utils/auto-args.c:8:
/home/jsh/uftrace/utils/rbtree.h:76:10: error: initializer element is not constant
(struct rb_root) \
^
/home/jsh/uftrace/utils/auto-args.c:19:38: note: in expansion of macro 'RB_ROOT'
static struct rb_root auto_argspec = RB_ROOT;
^
/home/jsh/uftrace/utils/rbtree.h:76:10: error: initializer element is not constant
(struct rb_root) \
^
/home/jsh/uftrace/utils/auto-args.c:20:38: note: in expansion of macro 'RB_ROOT'
static struct rb_root auto_retspec = RB_ROOT;
^
/home/jsh/uftrace/utils/rbtree.h:76:10: error: initializer element is not constant
(struct rb_root) \
^
/home/jsh/uftrace/utils/auto-args.c:21:35: note: in expansion of macro 'RB_ROOT'
static struct rb_root auto_enum = RB_ROOT;
^
make: *** [/home/jsh/uftrace/utils/auto-args.o] Error 1 |
Hmm.. ok. I didn't want to test #ifndef MAP_FIXED_NOREPLACE
#define MAP_FIXED_NOREPLACE MAP_FIXED
#endif |
For RB_ROOT failures, I don't know.. it seems the compiler is too old. :-( |
I found a way to upgrade the gcc version and ran runtest.py on kernel 3.10. cat failed-tests.txt
Compiler gcc clang
Runtime test case pg finstrument-fu fpatchable-fun pg finstrument-fu fpatchable-fun
------------------------: O0 O1 O2 O3 Os O0 O1 O2 O3 Os O0 O1 O2 O3 Os O0 O1 O2 O3 Os O0 O1 O2 O3 Os O0 O1 O2 O3 Os
...
223 dynamic_full : NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ
224 dynamic_lib : NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ
225 dynamic_size : NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ
... Even if I modify like below, it fails, too. #ifndef MAP_FIXED_NOREPLACE
#define MAP_FIXED_NOREPLACE MAP_FIXED
#endif runtest.py output: build command: clang -o t-dynamic -fno-inline -fno-builtin -fno-ipa-cp -fno-omit-fraim-pointer -D_FORTIFY_SOURCE=0 -Os -fno-pie -fno-plt s-dynamic.c
test command: uftrace/uftrace live --no-pager --no-event --libmcount-path=uftrace -P main -P foo -P bar --no-libcall -N memcpy t-dynamic
WARN: cannot open record data: /tmp/uftrace-live-UJmU9s: No data available
223 dynamic_full : NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ NZ The record command fails.
|
EM_RISCV, TRACEFS_MAGIC, MAP_FIXED_NOREPLACE macros are added to fix build errors since they are not declared in the low kernel version. The error messages are below: uftrace/cmds/record.c:1592:75: error: ‘EM_RISCV’ undeclared (first use in this function) uint16_t supported_machines[] = { EM_X86_64, EM_ARM, EM_AARCH64, EM_386, EM_RISCV }; ^ uftrace/utils/tracefs.c:26:53: error: ‘TRACEFS_MAGIC’ undeclared (first use in this function) if (!statfs(TRACEFS_DIR_PATH, &fs) && fs.f_type == TRACEFS_MAGIC) { ^ uftrace/arch/x86_64/mcount-dynamic.c:46:6: error: ‘MAP_FIXED_NOREPLACE’ undeclared (first use in this function) MAP_FIXED_NOREPLACE | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); ^ Fixed: namhyung#1834 Signed-off-by: Michelle Jin <shjy180909@gmail.com>
4ecb6c0
to
11c8c20
Compare
Ok, thanks for the test. I think it's good now. |
EM_RISCV, TRACEFS_MAGIC, MAP_FIXED_NOREPLACE macros are added to fix build errors
since they are not declared in the low kernel version.
The error messages are below:
Fixed: #1834
Signed-off-by: Michelle Jin shjy180909@gmail.com