loader: include bpf_workaround.h header
authorDave Marchevsky <davemarchevsky@fb.com>
Wed, 5 May 2021 04:31:42 +0000 (21:31 -0700)
committeryonghong-song <ys114321@gmail.com>
Wed, 5 May 2021 05:20:20 +0000 (22:20 -0700)
The intent of #3391 was to have `bpf_workaround.h` included after
`bpf.h` when compiling bcc headers. However, that PR only added the file
to the `headers_` map of files that can be included. To actually
include, need to adjust compiler input flags as well.

Fixes: d089013e ("Move HAVE_BUILTIN_BSWAP includes to separate header")

src/cc/frontends/clang/loader.cc

index 9bd8a65..7809e45 100644 (file)
@@ -314,6 +314,8 @@ int ClangLoader::do_compile(unique_ptr<llvm::Module> *mod, TableStorage &ts,
     flags_cstr.push_back("-include");
     flags_cstr.push_back("/virtual/include/bcc/bpf.h");
   }
+  flags_cstr.push_back("-include");
+  flags_cstr.push_back("/virtual/include/bcc/bpf_workaround.h");
   flags_cstr.insert(flags_cstr.end(), flags_cstr_rem.begin(),
                     flags_cstr_rem.end());