mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 09:58:54 +00:00
macOS: Link with no-weak-imports (#4056)
This commit is contained in:
parent
bf0eb6f36f
commit
8272c028dd
@ -185,6 +185,7 @@ if(APPLE)
|
||||
ADD_OSQUERY_LINK_CORE("-Wl,-dead_strip")
|
||||
ADD_OSQUERY_LINK_CORE("-mmacosx-version-min=${OSX_VERSION_MIN}")
|
||||
ADD_OSQUERY_LINK_CORE("-Wl,-cache_path_lto,${CMAKE_BINARY_DIR}/ltocache")
|
||||
ADD_OSQUERY_LINK_CORE("-Wl,-no_weak_imports")
|
||||
elseif(LINUX OR FREEBSD)
|
||||
ADD_OSQUERY_LINK_CORE("-Wl,-zrelro -Wl,-znow")
|
||||
if(NOT DEFINED ENV{SANITIZE} AND NOT DEFINED ENV{DEBUG})
|
||||
|
@ -42,15 +42,10 @@ const std::map<std::string, uint32_t> kRootlessConfigFlags = {
|
||||
#define kIODeviceTreeChosenPath_ "IODeviceTree:/options"
|
||||
typedef uint32_t csr_config_t;
|
||||
|
||||
#if !defined(DARWIN_10_9)
|
||||
// mark these symbols as weakly linked, as they may not be available
|
||||
// at runtime on older OS X versions.
|
||||
// https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html
|
||||
extern "C" {
|
||||
int csr_check(csr_config_t mask) __attribute__((weak_import));
|
||||
int csr_get_active_config(csr_config_t* config) __attribute__((weak_import));
|
||||
int csr_check(csr_config_t mask);
|
||||
int csr_get_active_config(csr_config_t* config);
|
||||
};
|
||||
#endif
|
||||
|
||||
Status genCsrConfigFromNvram(uint32_t& config) {
|
||||
auto chosen =
|
||||
@ -107,13 +102,6 @@ QueryData genSIPConfig(QueryContext& context) {
|
||||
}
|
||||
|
||||
QueryData results;
|
||||
|
||||
#if !defined(DARWIN_10_9)
|
||||
// check if weakly linked symbols exist
|
||||
if (csr_get_active_config == nullptr || csr_check == nullptr) {
|
||||
return {};
|
||||
}
|
||||
|
||||
csr_config_t config = 0;
|
||||
csr_get_active_config(&config);
|
||||
|
||||
@ -147,7 +135,6 @@ QueryData genSIPConfig(QueryContext& context) {
|
||||
}
|
||||
results.push_back(r);
|
||||
}
|
||||
#endif
|
||||
|
||||
return results;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user