Commit 0006ad17 authored by Naveen N. Rao's avatar Naveen N. Rao

cc: add powerpc support

Basic support for building on powerpc. Tested on ppc64le.
Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
parent 8216464e
...@@ -44,7 +44,7 @@ set_target_properties(bcc-static PROPERTIES OUTPUT_NAME bcc) ...@@ -44,7 +44,7 @@ set_target_properties(bcc-static PROPERTIES OUTPUT_NAME bcc)
# BPF is still experimental otherwise it should be available # BPF is still experimental otherwise it should be available
#llvm_map_components_to_libnames(llvm_libs bpf mcjit irreader passes) #llvm_map_components_to_libnames(llvm_libs bpf mcjit irreader passes)
llvm_map_components_to_libnames(llvm_libs bitwriter bpfcodegen irreader linker llvm_map_components_to_libnames(llvm_libs bitwriter bpfcodegen irreader linker
mcjit objcarcopts option passes x86codegen) mcjit objcarcopts option passes nativecodegen)
llvm_expand_dependencies(expanded_libs ${llvm_libs}) llvm_expand_dependencies(expanded_libs ${llvm_libs})
# order is important # order is important
......
...@@ -35,8 +35,14 @@ namespace ebpf { ...@@ -35,8 +35,14 @@ namespace ebpf {
const char *calling_conv_regs_x86[] = { const char *calling_conv_regs_x86[] = {
"di", "si", "dx", "cx", "r8", "r9" "di", "si", "dx", "cx", "r8", "r9"
}; };
const char *calling_conv_regs_ppc[] = {"gpr[3]", "gpr[4]", "gpr[5]",
"gpr[6]", "gpr[7]", "gpr[8]"};
// todo: support more archs // todo: support more archs
#if defined(__powerpc__)
const char **calling_conv_regs = calling_conv_regs_ppc;
#else
const char **calling_conv_regs = calling_conv_regs_x86; const char **calling_conv_regs = calling_conv_regs_x86;
#endif
using std::map; using std::map;
using std::set; using std::set;
......
...@@ -128,7 +128,11 @@ int ClangLoader::parse(unique_ptr<llvm::Module> *mod, unique_ptr<vector<TableDes ...@@ -128,7 +128,11 @@ int ClangLoader::parse(unique_ptr<llvm::Module> *mod, unique_ptr<vector<TableDes
DiagnosticsEngine diags(DiagID, &*diag_opts, diag_client); DiagnosticsEngine diags(DiagID, &*diag_opts, diag_client);
// set up the command line argument wrapper // set up the command line argument wrapper
#if defined(__powerpc64__)
driver::Driver drv("", "ppc64le-unknown-linux-gnu", diags);
#else
driver::Driver drv("", "x86_64-unknown-linux-gnu", diags); driver::Driver drv("", "x86_64-unknown-linux-gnu", diags);
#endif
drv.setTitle("bcc-clang-driver"); drv.setTitle("bcc-clang-driver");
drv.setCheckInputsExist(false); drv.setCheckInputsExist(false);
......
...@@ -39,8 +39,12 @@ ...@@ -39,8 +39,12 @@
// TODO: remove these defines when linux-libc-dev exports them properly // TODO: remove these defines when linux-libc-dev exports them properly
#ifndef __NR_bpf #ifndef __NR_bpf
#if defined(__powerpc64__)
#define __NR_bpf 361
#else
#define __NR_bpf 321 #define __NR_bpf 321
#endif #endif
#endif
#ifndef SO_ATTACH_BPF #ifndef SO_ATTACH_BPF
#define SO_ATTACH_BPF 50 #define SO_ATTACH_BPF 50
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment