在内核从5.2更新到5.3.5之后,我的SystemTAP (stap)探测失败了,错误如下
/usr/share/systemtap/runtime/map-gen.c: In function ‘hash_si’:
/usr/share/systemtap/runtime/map-gen.c:114:28: error: this statement may fall through [-Werror=implicit-fallthrough=]
114 | case 3: k1 ^= tail[2] << 16; \
| ~~~^~~~~~~~~~~~~~~~
/usr/share/systemtap/runtime/map-gen.c:131:19: note: in expansion of macro ‘MURMUR_STRING’
131 | #define KEY1_HASH MURMUR_STRING(key1)
| ^~~~~~~~~~~~~
/usr/share/systemtap/runtime/map-gen.c:664:9: note: in expansion of macro ‘KEY1_HASH’
664 | KEY1_HASH;
| ^~~~~~~~~
/usr/share/systemtap/runtime/map-gen.c:115:17: note: here
115 | case 2: k1 ^= tail[1] << 8; \
| ^~~~为什么?
发布于 2019-10-30 16:06:03
这很可能是因为在内核构建中启用了-Werror=implicit-fallthru (这也影响到外部模块),因为5.3内核发行版:https://lwn.net/Articles/794944/ --换句话说,系统上游需要一些工作才能正确支持5.3。
据推测,您所链接的其他-Wimplicit-fallthru修复都是针对使用不同编译器设置编译的systemtap的用户空间部分(旧内核版本很可能在构建中禁用了-Wimplicit-fallthru )。
发布于 2019-10-18 03:51:15
现在还不清楚为什么会在内核更新之后发生这种情况,因为更多的原因似乎是gcc/工具链的改变。它似乎与先前的一个问题有关/类似:
在任何情况下,它都可以在本地工作,只需对系统运行时代码进行小黑客攻击,就可以禁用警告。在档案中:
/usr/share/systemtap/runtime/vsprintf.c/usr/share/systemtap/runtime/map-gen.c在每个文件的开头插入以下两行
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"在文件末尾的这一行:
#pragma GCC diagnostic pop编辑:为系统访问发布的bug https://sourceware.org/bugzilla/show_bug.cgi?id=25267
编辑:如果您不介意的话,更干净的修复方法是修改runtime.cxx,如下所示:
diff --git a/buildrun.cxx b/buildrun.cxx
index 505902bc5..b29eeb797 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -235,6 +235,7 @@ compile_dyninst (systemtap_session& s)
"gcc", "--std=gnu99", s.translated_source, "-o", module,
"-fvisibility=hidden", "-O2", "-I" + s.runtime_path, "-D__DYNINST__",
"-Wall", WERROR, "-Wno-unused", "-Wno-strict-aliasing",
+ "-Wno-error=implicit-fallthrough", "-Wno-error=strict-prototypes",
"-pthread", "-lrt", "-fPIC", "-shared",
};然后重新编译和重新安装。这对这两种系统缺陷都有效:
https://stackoverflow.com/questions/58443706
复制相似问题