// build an ExecutionEngine.
int BPFModule::load_includes(const string &text) {
ClangLoader clang_loader(&*ctx_, flags_);
- if (clang_loader.parse(&mod_, *ts_, text, true, nullptr, 0, "", *func_src_,
+ const char *cflags[] = {"-DB_WORKAROUND"};
+ if (clang_loader.parse(&mod_, *ts_, text, true, cflags, 1, "", *func_src_,
mod_src_, "", fake_fd_map_, perf_events_))
return -1;
return 0;
*/
#define BCC_SEC(NAME) __attribute__((section(NAME), used))
+#ifdef B_WORKAROUND
+#define BCC_SEC_HELPERS BCC_SEC("helpers")
+#else
+#define BCC_SEC_HELPERS
+#endif
+
// Associate map with its key/value types
#define BPF_ANNOTATE_KV_PAIR(name, type_key, type_val) \
struct ____btf_map_##name { \
struct bpf_context;
static inline __attribute__((always_inline))
-BCC_SEC("helpers")
+BCC_SEC_HELPERS
u64 bpf_dext_pkt(void *pkt, u64 off, u64 bofs, u64 bsz) {
if (bofs == 0 && bsz == 8) {
return load_byte(pkt, off);
}
static inline __attribute__((always_inline))
-BCC_SEC("helpers")
+BCC_SEC_HELPERS
void bpf_dins_pkt(void *pkt, u64 off, u64 bofs, u64 bsz, u64 val) {
// The load_xxx function does a bswap before returning the short/word/dword,
// so the value in register will always be host endian. However, the bytes
}
static inline __attribute__((always_inline))
-BCC_SEC("helpers")
+BCC_SEC_HELPERS
void * bpf_map_lookup_elem_(uintptr_t map, void *key) {
return bpf_map_lookup_elem((void *)map, key);
}
static inline __attribute__((always_inline))
-BCC_SEC("helpers")
+BCC_SEC_HELPERS
int bpf_map_update_elem_(uintptr_t map, void *key, void *value, u64 flags) {
return bpf_map_update_elem((void *)map, key, value, flags);
}
static inline __attribute__((always_inline))
-BCC_SEC("helpers")
+BCC_SEC_HELPERS
int bpf_map_delete_elem_(uintptr_t map, void *key) {
return bpf_map_delete_elem((void *)map, key);
}
static inline __attribute__((always_inline))
-BCC_SEC("helpers")
+BCC_SEC_HELPERS
int bpf_l3_csum_replace_(void *ctx, u64 off, u64 from, u64 to, u64 flags) {
switch (flags & 0xf) {
case 2:
}
static inline __attribute__((always_inline))
-BCC_SEC("helpers")
+BCC_SEC_HELPERS
int bpf_l4_csum_replace_(void *ctx, u64 off, u64 from, u64 to, u64 flags) {
switch (flags & 0xf) {
case 2: