Hi all,

I'm sorry I'm not sure if it's proper to ask question here :)

I just want to try bcc tools on centos6.5, according to INSTALL.md I have to update a lot of packets and some fix for bcc, finally I can use most of the tools, that's really a good news to me.

The yum source for most required packets is too old to match bcc so I update/install most of packets via souce code including following:
kernel 4.9-rc4
python 2.7.9
gcc 6.1.0
glibc 2.24
llvm  5.0.0svn (that's from git tree)
and others...

The fix for bcc is that I encounter runtime error like this:
[root@local examples]# LD_LIBRARY_PATH=/usr/local/lib64 PYTHONPATH=/usr/lib/python2.7/site-packages python ./hello_world.py error: <unknown>:0:0: in function bpf_dext_pkt i64 (i8*, i64, i64, i64): A call to global function 'load_dword' is not supported. Please use __attribute__((always_inline) to make sure this function is inlined.


 src/cc/export/helpers.h |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/cc/export/helpers.h b/src/cc/export/helpers.h
index 1fa20a5..e1a0f09 100644
--- a/src/cc/export/helpers.h
+++ b/src/cc/export/helpers.h
@@ -261,40 +261,40 @@ static int (*bpf_l4_csum_replace)(void *ctx, unsigned long long off, unsigned lo unsigned long long to, unsigned long long flags) =
   (void *) BPF_FUNC_l4_csum_replace;

-static inline u16 bpf_ntohs(u16 val) {
+static inline __attribute__((always_inline)) u16 bpf_ntohs(u16 val) {
   /* will be recognized by gcc into rotate insn and eventually rolw 8 */
   return (val << 8) | (val >> 8);
 }

-static inline u32 bpf_ntohl(u32 val) {
+static inline __attribute__((always_inline)) u32 bpf_ntohl(u32 val) {
   /* gcc will use bswapsi2 insn */
   return __builtin_bswap32(val);
 }

-static inline u64 bpf_ntohll(u64 val) {
+static inline __attribute__((always_inline)) u64 bpf_ntohll(u64 val) {
   /* gcc will use bswapdi2 insn */
   return __builtin_bswap64(val);
 }

-static inline unsigned __int128 bpf_ntoh128(unsigned __int128 val) {
+static inline __attribute__((always_inline)) unsigned __int128 bpf_ntoh128(unsigned __int128 val) { return (((unsigned __int128)bpf_ntohll(val) << 64) | (u64)bpf_ntohll(val >> 64));
 }

-static inline u16 bpf_htons(u16 val) {
+static inline __attribute__((always_inline)) u16 bpf_htons(u16 val) {
   return bpf_ntohs(val);
 }

-static inline u32 bpf_htonl(u32 val) {
+static inline __attribute__((always_inline)) u32 bpf_htonl(u32 val) {
   return bpf_ntohl(val);
 }
-static inline u64 bpf_htonll(u64 val) {
+static inline __attribute__((always_inline)) u64 bpf_htonll(u64 val) {
   return bpf_ntohll(val);
 }
-static inline unsigned __int128 bpf_hton128(unsigned __int128 val) {
+static inline __attribute__((always_inline)) unsigned __int128 bpf_hton128(unsigned __int128 val) {
   return bpf_ntoh128(val);
 }

-static inline u64 load_dword(void *skb, u64 off) {
+static inline __attribute__((always_inline)) u64 load_dword(void *skb, u64 
off) {
   return ((u64)load_word(skb, off) << 32) | load_word(skb, off + 4);
 }

@@ -310,7 +310,7 @@ static inline void bpf_store_dword(void *skb, u64 off, u64 val) {
 #define MASK(_n) ((_n) < 64 ? (1ull << (_n)) - 1 : ((u64)-1LL))
#define MASK128(_n) ((_n) < 128 ? ((unsigned __int128)1 << (_n)) - 1 : ((unsigned __int128)-1))

-static inline unsigned int bpf_log2(unsigned int v)
+static inline __attribute__((always_inline)) unsigned int bpf_log2(unsigned 
int v)
 {
   unsigned int r;
   unsigned int shift;
@@ -323,7 +323,7 @@ static inline unsigned int bpf_log2(unsigned int v)
   return r;
 }

-static inline unsigned int bpf_log2l(unsigned long v)
+static inline __attribute__((always_inline)) unsigned int bpf_log2l(unsigned long v)
 {
   unsigned int hi = v >> 32;
   if (hi)
---

Then most non-network bcc tools work, while I try network bcc tool solisten and again I fall into the same hole... [root@local tools]# LD_LIBRARY_PATH=/usr/lib64/ PYTHONPATH=/usr/lib/python2.7/site-packages python ./solisten error: <unknown>:0:0: in function kprobe__inet_listen i32 (%struct.pt_regs*): A call to global function 'inet_sk' is not supported. Please use __attribute__((always_inline) to make sure this function is inlined.

So it seems that I use a broken gcc or llvm, which make a enhance checking, or something else, please point me out?
I compile gcc using very simple options:
../gcc-6.1.0/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib

thanks in advance,
linfeng


_______________________________________________
iovisor-dev mailing list
iovisor-dev@lists.iovisor.org
https://lists.iovisor.org/mailman/listinfo/iovisor-dev

Reply via email to