Commit Graph

9 Commits

Author SHA1 Message Date
4ast
319ff2f0f6
Merge pull request #4 from libbpf/pr/add-ring-buffer-header
bpf: add ring_buffer.h drop in replacement header
2018-10-19 14:29:41 -07:00
Daniel Borkmann
a0e4e323bb bpf: add ring_buffer.h drop in replacement header
Add fast variant for x86-64 for now, and we can later extend for
others upon demand.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2018-10-19 23:14:46 +02:00
Andrey Ignatov
62706e5557 Symbols visibility (#3)
* Sync from bpf-next

Sync the following commits from bpf-next:
commit ab9e08482122 ("libbpf: Per-symbol visibility for DSO")
commit c034a177d3c8 ("bpf: bpftool, add flag to allow non-compat map definitions")

Signed-off-by: Andrey Ignatov <rdna@fb.com>

* Use -fvisibility=hidden by default for DSO

This is Makefile part of:
commit ab9e08482122 ("libbpf: Per-symbol visibility for DSO")

See original commit for details.
2018-10-16 17:24:08 -07:00
yonghong-song
e5c75f8e94
mirror uapi/linux/bpf_common.h file (#2)
bcc still has this file in its src/cc/compat/linux directory.
Add this file to libbpf as well.

Signed-off-by: Yonghong Song <yhs@fb.com>
2018-10-12 12:57:55 -07:00
yonghong-song
a907cbaee9
Merge pull request #1 from rdna/extend-build-install
Extend build and install
2018-10-11 16:25:11 -07:00
Andrey Ignatov
a82a66eda3 Extend build and add install rules to Makefile
Introduce multiple improvements to Makefile to make the build more
flexible and support install:

* Support overriding CFLAGS by user but keep required flags in place.
  ALL_FLAGS is used in Makefile as recommended in [1].

* Add additional BUILD_SHARED flag to build dynamically linked flavor of
  the library. If the flag is set, -fPIC is also passed to make it
  possible to build .so.

* Support building in a separate directory provided by OBJDIR variable.

* Add multiple install targets. By default the library itself and libbpf
  headers are installed (install target). UAPI headers can be optionally
  installed by user.

* All installation paths, including PREFIX, library and include
  directories can be overridden. UAPI can be made different from include
  directory for libbpf headers. That makes it possible to keep latest
  <linux/bpf.h> in a place that doesn't conflict with the one installed
  e.g. by kernel-headers package and use it in user's build system.

* Support DESTDIR (see [2]).

* Support overriding LDFLAGS.

* Use utilities such as rm directly as recommended in [3].

* Use compiler and related programs (such as ar) via make variables as
  recommended in [3].

* In clean rule remove all possible build artifacts not to rely on passed
  options (e.g. if build was done w/ BUILD_SHARED, but clean w/o it).

* Document new build options in README.

[1] https://www.gnu.org/software/make/manual/html_node/Command-Variables.html#Command-Variables
[2] https://www.gnu.org/prep/standards/html_node/DESTDIR.html
[3] https://www.gnu.org/software/make/manual/html_node/Utilities-in-Makefiles.html#Utilities-in-Makefiles

Signed-off-by: Andrey Ignatov <rdna@fb.com>
2018-10-11 15:45:50 -07:00
Andrey Ignatov
c2015d0a65 Add if_link.h and netlink.h UAPI headers
Add more UAPI headers from kernel tree since libbpf relies on their
latest versions that may not be present on target system to use in
build.

if_link.h and netlink.h are synced to include/uapi/linux/ from [1]

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/include/uapi/linux

Signed-off-by: Andrey Ignatov <rdna@fb.com>
2018-10-11 15:26:06 -07:00
Yonghong Song
8acf2635c3 add a simple Makefile to build and clean up
add missing macros, static inline functions, etc.
add README to illustrate the purpose of this repo.

Signed-off-by: Yonghong Song <yhs@fb.com>
2018-10-10 09:40:15 -07:00
Yonghong Song
66684189f0 initial commit
This initial commit added the following files
from bpf-next repository:
  src:
    <files from linux:tools/lib/bpf>
    bpf.c bpf.h btf.c btf.h libbpf.c libbpf.h
    libbpf_errno.c netlink.c nlattr.c nlattr.h
    str_error.c str_error.h
  include:
    <files from linux:tools/include/uapi/linux>
    uapi/linux/{bpf.h, btf.h}

    <files from linux:tools/include/tools>
    tools/libc_compat.h

The following files are also added:
  include/linux/{err.h, kernel.h, list.h, overflow.h, types.h}
These files are customized headers to satisfy compilation.
Their original counterparts are at linux:tools/include/linux
directory.

Signed-off-by: Yonghong Song <yhs@fb.com>
2018-10-09 21:56:40 -07:00