-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert bpftrace from a submodule into a bazel_repo
Summary: TSIA Test Plan: Build and test all Reviewers: zasgar, #third_party_approvers, oazizi Reviewed By: zasgar, #third_party_approvers Differential Revision: https://phab.corp.pixielabs.ai/D8292 GitOrigin-RevId: a262807
- Loading branch information
1 parent
5901fc8
commit da29506
Showing
10 changed files
with
170 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
[submodule "third_party/bcc"] | ||
path = third_party/bcc | ||
url = [email protected]:pixie-labs/bcc.git | ||
[submodule "third_party/bpftrace"] | ||
path = third_party/bpftrace | ||
url = [email protected]:pixie-labs/bpftrace.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
# Copyright 2018- The Pixie Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
load("@px//bazel:flex_bison.bzl", "genbison", "genflex") | ||
load("@rules_cc//cc:defs.bzl", "cc_library") | ||
|
||
licenses(["notice"]) | ||
|
||
# When building bpftrace, it automatically generates the following file: | ||
# <build_dir>/resources/headers.cpp | ||
# Due to build issues, this file was copied directly into src, and checked in to our fork of bpftrace. | ||
# If at any time, bpftrace is updated from the origin, AND there are changes to the resources directory, | ||
# then the updated headers.cpp should be copied and checked in to src. | ||
# If there are no changes to files in the resources directory (which is the likely case), then no special steps are required. | ||
cc_library( | ||
name = "bpftrace", | ||
srcs = glob( | ||
["src/*.cpp"], | ||
exclude = [ | ||
"src/main.cpp", | ||
"src/bfd-disasm.cpp", | ||
], | ||
) + glob( | ||
[ | ||
"src/*.h", | ||
"src/arch/*.h", | ||
"src/ast/*.h", | ||
], | ||
), | ||
hdrs = glob([ | ||
"src/*.h", | ||
"src/arch/*.h", | ||
"src/ast/*.h", | ||
]), | ||
copts = [ | ||
"-w", | ||
], | ||
defines = [ | ||
"HAVE_NAME_TO_HANDLE_AT=1", | ||
"HAVE_BCC_PROG_LOAD=1", | ||
"HAVE_BCC_CREATE_MAP=1", | ||
"HAVE_BCC_ELF_FOREACH_SYM=1", | ||
"HAVE_BCC_KFUNC=1", | ||
"HAVE_BCC_USDT_ADDSEM=1", | ||
"LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE=1", | ||
], | ||
include_prefix = "bpftrace", | ||
tags = ["linux_only"], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
":bpftrace-arch", | ||
":bpftrace-ast", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "bpftrace-arch", | ||
srcs = [ | ||
"src/arch/x86_64.cpp", | ||
], | ||
hdrs = glob([ | ||
"src/arch/*.h", | ||
]), | ||
copts = [ | ||
"-w", | ||
], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
cc_library( | ||
name = "bpftrace-ast", | ||
srcs = glob([ | ||
"src/ast/*.cpp", | ||
]), | ||
hdrs = glob([ | ||
"src/ast/*.h", | ||
"src/arch/*.h", | ||
]), | ||
copts = [ | ||
"-w", | ||
], | ||
tags = ["linux_only"], | ||
visibility = ["//visibility:private"], | ||
deps = [ | ||
":bpftrace-parser", | ||
"@com_llvm_lib//:llvm", | ||
"@px//third_party/foreign_cc:bcc", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "bpftrace-parser", | ||
srcs = [ | ||
":bpftrace-bison", | ||
":bpftrace-flex", | ||
], | ||
hdrs = glob([ | ||
"src/*.h", | ||
"src/libbpf/*.h", | ||
"src/ast/*.h", | ||
]) + [ | ||
":bpftrace-bison", | ||
], | ||
copts = [ | ||
"-w", | ||
], | ||
includes = [ | ||
"src", | ||
"src/ast", | ||
], | ||
tags = ["linux_only"], | ||
deps = [ | ||
"@px//third_party/foreign_cc:bcc", | ||
], | ||
) | ||
|
||
genbison( | ||
name = "bpftrace-bison", | ||
src = "src/parser.yy", | ||
extra_outs = [ | ||
"stack.hh", | ||
"location.hh", | ||
"position.hh", | ||
], | ||
header_out = "parser.tab.hh", | ||
source_out = "parser.tab.cc", | ||
tags = ["linux_only"], | ||
) | ||
|
||
genflex( | ||
name = "bpftrace-flex", | ||
src = "src/lexer.l", | ||
out = "lex.yy.cc", | ||
includes = [":bpftrace-bison"], | ||
tags = ["linux_only"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.