From b83ccf353e3e9557df67ef4a5d04bf8d592954bc Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Tue, 29 Mar 2016 11:04:01 +0000 Subject: [PATCH 1/2] move endian flags to kbuild_helper --- src/cc/frontends/clang/kbuild_helper.cc | 3 +++ src/python/bcc/__init__.py | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/cc/frontends/clang/kbuild_helper.cc b/src/cc/frontends/clang/kbuild_helper.cc index 3cb55dfd7ffb..82b5a43b92fa 100644 --- a/src/cc/frontends/clang/kbuild_helper.cc +++ b/src/cc/frontends/clang/kbuild_helper.cc @@ -82,6 +82,9 @@ int KBuildHelper::get_flags(const char *uname_machine, vector *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"); diff --git a/src/python/bcc/__init__.py b/src/python/bcc/__init__.py index b48dd612f506..28d61b778e22 100644 --- a/src/python/bcc/__init__.py +++ b/src/python/bcc/__init__.py @@ -40,11 +40,6 @@ 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 @@ def __init__(self, src_file="", hdr_file="", text=None, cb=None, debug=0, cflags 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: From 7d37bf4d3a5867fcd872c76a8646d7b390be99f0 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Tue, 29 Mar 2016 12:48:02 +0000 Subject: [PATCH 2/2] add debug constants --- src/cc/frontends/clang/b_frontend_action.cc | 2 +- src/cc/frontends/clang/b_frontend_action.h | 2 ++ src/cc/frontends/clang/loader.cc | 2 +- src/python/bcc/__init__.py | 11 ++++++++--- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/cc/frontends/clang/b_frontend_action.cc b/src/cc/frontends/clang/b_frontend_action.cc index bc5ede2b3e8b..682ead4dd3be 100644 --- a/src/cc/frontends/clang/b_frontend_action.cc +++ b/src/cc/frontends/clang/b_frontend_action.cc @@ -688,7 +688,7 @@ BFrontendAction::BFrontendAction(llvm::raw_ostream &os, unsigned flags) } void BFrontendAction::EndSourceFileAction() { - if (flags_ & 0x4) + if (flags_ & DEBUG_PREPROCESSOR) rewriter_->getEditBuffer(rewriter_->getSourceMgr().getMainFileID()).write(llvm::errs()); rewriter_->getEditBuffer(rewriter_->getSourceMgr().getMainFileID()).write(os_); os_.flush(); diff --git a/src/cc/frontends/clang/b_frontend_action.h b/src/cc/frontends/clang/b_frontend_action.h index e9fe7fce32ff..142e12addaad 100644 --- a/src/cc/frontends/clang/b_frontend_action.h +++ b/src/cc/frontends/clang/b_frontend_action.h @@ -26,6 +26,8 @@ #include "table_desc.h" +#define DEBUG_PREPROCESSOR 0x4 + namespace clang { class ASTConsumer; class ASTContext; diff --git a/src/cc/frontends/clang/loader.cc b/src/cc/frontends/clang/loader.cc index 6a0d025c3633..63ecdc48378b 100644 --- a/src/cc/frontends/clang/loader.cc +++ b/src/cc/frontends/clang/loader.cc @@ -155,7 +155,7 @@ int ClangLoader::parse(unique_ptr *mod, unique_ptr