Sorry to trouble you !
I run debian and installed binutils-dev beforehand.
Then I copied tools/build/feature/test-libbfd.c to t.c and run:
------------------------------------------------------------------------
root@lazyfintech:~# cat t.c
#include <bfd.h>
extern int printf(const char *format, ...);
int main(void)
{
char symbol[4096] = "FieldName__9ClassNameFd";
char *tmp;
tmp = bfd_demangle(0, symbol, 0);
printf("demangled symbol: {%s}\n", tmp);
return 0;
}
root@lazyfintech:~# gcc t.c -lbfd
root@lazyfintech:~# ./a.out
demangled symbol: {ClassName::FieldName}
I thought libbfd can be reached from above.
But when I built tools/bpf, libbfd cannot be detected:
-------------------------------------------------------------------------
/linux# make O=../buildkernel/ tools/bpf
make[1]: Entering directory '/root/buildkernel'
DESCEND bpf
Auto-detecting system features:
... libbfd: [ OFF ]
... disassembler-four-args: [ on ]
DESCEND bpftool
Auto-detecting system features:
... libbfd: [ OFF ]
... disassembler-four-args: [ on ]
make[1]: Leaving directory '/root/buildkernel'
I wonder how should I do to get libbfd auto detected when building bpf tool?
Regards,
shenghui