Skip to content

Commit

Permalink
Use -fsanitize=address instead of -lasan for ASAN linker flags (sonic…
Browse files Browse the repository at this point in the history
…-net#3344)

What I did
For the ASAN linker flags, use -fsanitize=address instead of manually specifying -lasan.

Why I did it
This allows the compiler to use some other linkages instead of -lasan in case that's not the correct one for the platform. It (should) also make sure that the ASAN library is the first library that gets linked and loaded at runtime.
This should also fix a flaky issue with the p4orch tests failing to run because ASAN isn't loaded first (not sure why this is flaky though, it should be pretty consistent).
  • Loading branch information
saiarcot895 authored Nov 7, 2024
1 parent 70ade34 commit ea3e76f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ if test "x$asan_enabled" = "xtrue"; then
CFLAGS_ASAN+=" -Wno-maybe-uninitialized"
AC_SUBST(CFLAGS_ASAN)

LDFLAGS_ASAN+=" -lasan"
LDFLAGS_ASAN+=" -fsanitize=address"
AC_SUBST(LDFLAGS_ASAN)
fi

Expand Down

0 comments on commit ea3e76f

Please sign in to comment.