forked from iovisor/bcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move api and create dependent option
Move the C++ api files under a new subdirectory. Use CMAKE_DEPENDENT_OPTION to enforce sdt->cpp_api relationship. Since linking .a into a .so can cause global symbols to be dropped, add a helper file to force exported symbols to be retained (link_all.cc). This problem doesn't exist for building the static cpp examples. Signed-off-by: Brenden Blanco <[email protected]>
- Loading branch information
Showing
10 changed files
with
38 additions
and
5 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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,3 @@ | ||
set(bcc_api_sources BPF.cc BPFTable.cc) | ||
add_library(api-static STATIC ${bcc_api_sources}) | ||
install(FILES BPF.h BPFTable.h COMPONENT libbcc DESTINATION include/bcc) |
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,21 @@ | ||
// Copyright (c) 2017 VMware, Inc. | ||
// Licensed under the Apache License, Version 2.0 (the "License") | ||
#include <cstdlib> | ||
|
||
#include "bcc_usdt.h" | ||
|
||
namespace { | ||
// Take this trick from llvm for forcing exported functions in helper | ||
// libraries to be included in the final .so | ||
struct LinkAll { | ||
LinkAll() { | ||
// getenv never returns -1, but compiler doesn't know! | ||
if (::getenv("bar") != (char *)-1) | ||
return; | ||
|
||
(void)bcc_usdt_new_frompid(-1); | ||
(void)bcc_usdt_new_frompath(nullptr); | ||
(void)bcc_usdt_close(nullptr); | ||
} | ||
} LinkAll; // declare one instance to invoke the constructor | ||
} |
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