Skip to content

Commit

Permalink
enable -g by default for llvm 9
Browse files Browse the repository at this point in the history
This patch introduced two changes so that BTF is available to bcc
starting from LLVM 9:
  . -g to enable BTF generation in LLVM
  . ProcessAllSections for RuntimeDyld so BTF is available to bcc

The bcc will then be able to post process and load BTF into the
kernel.

Signed-off-by: Yonghong Song <[email protected]>
  • Loading branch information
yonghong-song committed Feb 8, 2019
1 parent de641d4 commit 89bf6f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cc/bpf_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,12 @@ int BPFModule::finalize() {
return -1;
}

#if LLVM_MAJOR_VERSION >= 9
engine_->setProcessAllSections(true);
#else
if (flags_ & DEBUG_SOURCE)
engine_->setProcessAllSections(true);
#endif

if (int rc = run_pass_manager(*mod))
return rc;
Expand Down
4 changes: 4 additions & 0 deletions src/cc/frontends/clang/loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,12 @@ int ClangLoader::parse(unique_ptr<llvm::Module> *mod, TableStorage &ts,
vector<string> kflags;
if (kbuild_helper.get_flags(un.machine, &kflags))
return -1;
#if LLVM_MAJOR_VERSION >= 9
flags_cstr.push_back("-g");
#else
if (flags_ & DEBUG_SOURCE)
flags_cstr.push_back("-g");
#endif
for (auto it = kflags.begin(); it != kflags.end(); ++it)
flags_cstr.push_back(it->c_str());

Expand Down

0 comments on commit 89bf6f7

Please sign in to comment.