Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-RAN
Commits
03fe3b50
Commit
03fe3b50
authored
Jun 07, 2023
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide build_oai/cmake option to build with memory sanitizer
parent
10d2af11
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
0 deletions
+68
-0
CMakeLists.txt
CMakeLists.txt
+6
-0
cmake_targets/build_oai
cmake_targets/build_oai
+9
-0
cmake_targets/tools/memsan.patch
cmake_targets/tools/memsan.patch
+53
-0
No files found.
CMakeLists.txt
View file @
03fe3b50
...
...
@@ -253,6 +253,12 @@ if (SANITIZE_UNDEFINED)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fsanitize=undefined -fno-sanitize-recover=all"
)
endif
()
add_boolean_option
(
SANITIZE_MEMORY False
"enable the memory sanitizer (MSan, requires clang, incompatible with ASan/UBSan)"
ON
)
if
(
SANITIZE_MEMORY
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -fsanitize-recover=memory"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -fsanitize-recover=memory"
)
endif
()
add_definitions
(
"-DASN_DISABLE_OER_SUPPORT -DHAVE_CONFIG_H -DHAVE_CONFIG_H_"
)
#########################
...
...
cmake_targets/build_oai
View file @
03fe3b50
...
...
@@ -167,6 +167,10 @@ Options:
Enable the address sanitizer on all targets
--sanitize-undefined | -fsanitize=undefined
Enable the undefined behavior sanitizer on all targets
--sanitize-memory | -fsanitize=memory
Enable the memory sanitizer on all targets. Requires clang, and is
incompatible with ASan/UBSan. To build, issue:
CC=/usr/bin/clang CXX=/usr/bin/clang++ ./build_oai ... --sanitize-memory
-h | --help
Print this help"
}
...
...
@@ -413,6 +417,11 @@ function main() {
--sanitize-undefined
|
-fundefined
=
address
)
CMAKE_CMD
=
"
$CMAKE_CMD
-DSANITIZE_UNDEFINED=True"
shift
;;
--sanitize-memory
|
-fsanitize
=
memory
)
echo_warning
"Note: memory sanitizer
\n
* requires clang (tested: v17)
\n
* is incompatible with address/undefined behavior sanitizer
\n
* requires cmake_targets/tools/memsan.patch"
sleep
5
CMAKE_CMD
=
"
$CMAKE_CMD
-DSANITIZE_MEMORY=ON -DSANITIZE_ADDRESS=OFF -DSANITIZE_UNDEFINED=OFF"
shift
;;
-h
|
--help
)
print_help
exit
1
;;
...
...
cmake_targets/tools/memsan.patch
0 → 100644
View file @
03fe3b50
commit bf7f0c4f0f1bfce586667b50050640b67a7a747a
Author: Robert Schmidt <robert.schmidt@openairinterface.org>
Date: Wed Jun 7 18:24:50 2023 +0200
Fix dlopen() linker errors in dfts, ldpc, ldpc_parityCheck, and params_libconfig
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c29105d503..3b9e7d1246 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -508,7 +508,7 @@
add_library(CONFIG_LIB
)
target_link_libraries(CONFIG_LIB PRIVATE dl UTIL)
add_library(params_libconfig MODULE ${CONFIG_ROOTDIR}/libconfig/config_libconfig.c)
-target_link_libraries(params_libconfig config)
+target_link_libraries(params_libconfig config CONFIG_LIB minimal_lib)
# shared library loader
set (SHLIB_LOADER_SOURCES
${OPENAIR_DIR}/common/utils/load_module_shlib.c
@@ -1018,16 +1018,19 @@
if (ENABLE_LDPC_CUDA)
endif()
endif()
-add_library(ldpc MODULE ${PHY_LDPC_OPTIM8SEGMULTI_SRC} )
+add_library(ldpc MODULE ${PHY_LDPC_OPTIM8SEGMULTI_SRC} ${OPENAIR1_DIR}/PHY/CODING/crc_byte.c)
target_link_libraries(ldpc PRIVATE ldpc_gen_HEADERS)
+target_link_libraries(ldpc PRIVATE UTIL)
add_library(ldpc_parityCheck MODULE ${PHY_LDPC_OPTIM8SEGMULTI_SRC} )
target_compile_definitions(ldpc_parityCheck PUBLIC NR_LDPC_ENABLE_PARITY_CHECK)
target_link_libraries(ldpc_parityCheck PRIVATE ldpc_gen_HEADERS)
+target_link_libraries(ldpc_parityCheck PRIVATE UTIL minimal_lib)
add_library(coding MODULE ${PHY_TURBOSRC} )
add_library(dfts MODULE ${OPENAIR1_DIR}/PHY/TOOLS/oai_dfts.c )
+target_link_libraries(dfts PRIVATE minimal_lib)
set(PHY_SRC_COMMON
diff --git a/common/utils/minimal_stub.c b/common/utils/minimal_stub.c
index be9c1b399d..7ad0df4d56 100644
--- a/common/utils/minimal_stub.c
+++ b/common/utils/minimal_stub.c
@@ -1,6 +1,8 @@
+#include <stdlib.h>
#ifndef T_TRACER
int T_stdout;
#endif
+int oai_exit = 0;
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
{
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment