move endian flags to kbuild_helper
authorJean-Tiare Le Bigot <jt@yadutaf.fr>
Tue, 29 Mar 2016 11:04:01 +0000 (11:04 +0000)
committerJean-Tiare Le Bigot <jt@yadutaf.fr>
Tue, 29 Mar 2016 16:33:30 +0000 (16:33 +0000)
src/cc/frontends/clang/kbuild_helper.cc
src/python/bcc/__init__.py

index 3cb55df..82b5a43 100644 (file)
@@ -82,6 +82,9 @@ int KBuildHelper::get_flags(const char *uname_machine, vector<string> *cflags) {
   cflags->push_back("-include");
   cflags->push_back("./include/linux/kconfig.h");
   cflags->push_back("-D__KERNEL__");
+  cflags->push_back("-D__HAVE_BUILTIN_BSWAP16__");
+  cflags->push_back("-D__HAVE_BUILTIN_BSWAP32__");
+  cflags->push_back("-D__HAVE_BUILTIN_BSWAP64__");
   cflags->push_back("-Wno-unused-value");
   cflags->push_back("-Wno-pointer-sign");
 
index b48dd61..28d61b7 100644 (file)
@@ -40,11 +40,6 @@ ksyms = []
 ksym_names = {}
 ksym_loaded = 0
 _kprobe_limit = 1000
-BASE_CFLAGS = [
-    '-D__HAVE_BUILTIN_BSWAP16__',
-    '-D__HAVE_BUILTIN_BSWAP32__',
-    '-D__HAVE_BUILTIN_BSWAP64__',
-]
 
 @atexit.register
 def cleanup_kprobes():
@@ -146,7 +141,6 @@ class BPF(object):
         self.debug = debug
         self.funcs = {}
         self.tables = {}
-        cflags = BASE_CFLAGS + cflags
         cflags_array = (ct.c_char_p * len(cflags))()
         for i, s in enumerate(cflags): cflags_array[i] = s.encode("ascii")
         if text: