Skip to content

Commit

Permalink
Remove B language support
Browse files Browse the repository at this point in the history
Remove support for compiling B programs (see iovisor#3682 for explanation).

There may be some vestigial logic in other files that needs to be
cleanded up for simplicity - bpf_module.cc most likely - but that can be
addressed in followup commits.

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
  • Loading branch information
davemarchevsky committed Dec 17, 2021
1 parent f3a2e9e commit 79c9d00
Show file tree
Hide file tree
Showing 37 changed files with 25 additions and 5,374 deletions.
4 changes: 2 additions & 2 deletions src/cc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${llvm_lib_exclude_f

# bcc_common_libs_for_a for archive libraries
# bcc_common_libs_for_s for shared libraries
set(bcc_common_libs b_frontend clang_frontend
set(bcc_common_libs clang_frontend
-Wl,--whole-archive ${clang_libs} ${llvm_libs} -Wl,--no-whole-archive
${LIBELF_LIBRARIES})
if (LIBDEBUGINFOD_FOUND)
list(APPEND bcc_common_libs ${LIBDEBUGINFOD_LIBRARIES})
endif (LIBDEBUGINFOD_FOUND)
set(bcc_common_libs_for_a ${bcc_common_libs})
set(bcc_common_libs_for_s ${bcc_common_libs})
set(bcc_common_libs_for_lua b_frontend clang_frontend
set(bcc_common_libs_for_lua clang_frontend
${clang_libs} ${llvm_libs} ${LIBELF_LIBRARIES})
if(LIBBPF_FOUND)
list(APPEND bcc_common_libs_for_a ${LIBBPF_LIBRARIES})
Expand Down
10 changes: 0 additions & 10 deletions src/cc/bcc_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@
#include "bpf_module.h"

extern "C" {
void * bpf_module_create_b(const char *filename, const char *proto_filename, unsigned flags,
const char *dev_name) {
auto mod = new ebpf::BPFModule(flags, nullptr, true, "", true, dev_name);
if (mod->load_b(filename, proto_filename) != 0) {
delete mod;
return nullptr;
}
return mod;
}

void * bpf_module_create_c(const char *filename, unsigned flags, const char *cflags[],
int ncflags, bool allow_rlimit, const char *dev_name) {
auto mod = new ebpf::BPFModule(flags, nullptr, true, "", allow_rlimit, dev_name);
Expand Down
2 changes: 0 additions & 2 deletions src/cc/bcc_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
extern "C" {
#endif

void * bpf_module_create_b(const char *filename, const char *proto_filename, unsigned flags,
const char *dev_name);
void * bpf_module_create_c(const char *filename, unsigned flags, const char *cflags[], int ncflags,
bool allow_rlimit, const char *dev_name);
void * bpf_module_create_c_from_string(const char *text, unsigned flags, const char *cflags[],
Expand Down
38 changes: 0 additions & 38 deletions src/cc/bpf_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "common.h"
#include "bcc_debug.h"
#include "bcc_elf.h"
#include "frontends/b/loader.h"
#include "frontends/clang/loader.h"
#include "frontends/clang/b_frontend_action.h"
#include "bpf_module.h"
Expand Down Expand Up @@ -834,43 +833,6 @@ int BPFModule::table_leaf_scanf(size_t id, const char *leaf_str, void *leaf) {
return 0;
}

// load a B file, which comes in two parts
int BPFModule::load_b(const string &filename, const string &proto_filename) {
if (!sections_.empty()) {
fprintf(stderr, "Program already initialized\n");
return -1;
}
if (filename.empty() || proto_filename.empty()) {
fprintf(stderr, "Invalid filenames\n");
return -1;
}

// Helpers are inlined in the following file (C). Load the definitions and
// pass the partially compiled module to the B frontend to continue with.
auto helpers_h = ExportedFiles::headers().find("/virtual/include/bcc/helpers.h");
if (helpers_h == ExportedFiles::headers().end()) {
fprintf(stderr, "Internal error: missing bcc/helpers.h");
return -1;
}
if (int rc = load_includes(helpers_h->second))
return rc;

BLoader b_loader(flags_);
used_b_loader_ = true;
if (int rc = b_loader.parse(&*mod_, filename, proto_filename, *ts_, id_,
maps_ns_))
return rc;
if (rw_engine_enabled_) {
if (int rc = annotate())
return rc;
} else {
annotate_light();
}
if (int rc = finalize())
return rc;
return 0;
}

// load a C file
int BPFModule::load_c(const string &filename, const char *cflags[], int ncflags) {
if (!sections_.empty()) {
Expand Down
1 change: 0 additions & 1 deletion src/cc/bpf_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class BPFModule {
const char *dev_name = nullptr);
~BPFModule();
int free_bcc_memory();
int load_b(const std::string &filename, const std::string &proto_filename);
int load_c(const std::string &filename, const char *cflags[], int ncflags);
int load_string(const std::string &text, const char *cflags[], int ncflags);
std::string id() const { return id_; }
Expand Down
1 change: 0 additions & 1 deletion src/cc/frontends/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")

add_subdirectory(b)
add_subdirectory(clang)
15 changes: 0 additions & 15 deletions src/cc/frontends/b/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 79c9d00

Please sign in to comment.