Skip to content

Commit 71f9b6f

Browse files
committed
ws_main.py: Make --sanitized work with clang
While compiling with: """ CC=clang CXX=clang++ ./b configure --sanitized CC=clang CXX=clang++ ./b build """ I got: """ clang: error: unknown argument '-static-libasan'; did you mean '-static-libsan'? """ This commit passes expected param name to clang while still passing the other one to gcc. With commit applied, one can successfully build and run sanitized clang-compiled trex binaries.
1 parent 10e1d19 commit 71f9b6f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

linux/ws_main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,11 @@ def get_link_flags(self, is_sanitized):
735735
base_flags += [
736736
'-fsanitize=address',
737737
'-fsanitize=leak',
738-
'-static-libasan',
739738
]
739+
if self.is_clang():
740+
base_flags += ['-static-libsan']
741+
else:
742+
base_flags += ['-static-libasan']
740743

741744
return base_flags;
742745

linux_dpdk/ws_main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2537,8 +2537,11 @@ def get_link_flags(self, is_sanitized):
25372537
base_flags += [
25382538
'-fsanitize=address',
25392539
'-fsanitize=leak',
2540-
'-static-libasan',
25412540
]
2541+
if self.is_clang():
2542+
base_flags += ['-static-libsan']
2543+
else:
2544+
base_flags += ['-static-libasan']
25422545
return base_flags
25432546

25442547

0 commit comments

Comments
 (0)