Skip to content

Commit

Permalink
Bug 1879183 - Move some asan-specific flags to python configure r=gla…
Browse files Browse the repository at this point in the history
…ndium

Differential Revision: https://phabricator.services.mozilla.com/D201011
  • Loading branch information
serge-sans-paille committed Feb 10, 2024
1 parent 5088a14 commit c08a0b3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
13 changes: 0 additions & 13 deletions build/autoconf/compiler-opts.m4
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,5 @@ fi
AC_SUBST(MOZ_PROGRAM_LDFLAGS)
dnl ASan assumes no symbols are being interposed, and when that happens,
dnl it's not happy with it. Unconveniently, since Firefox is exporting
dnl libffi symbols and Gtk+3 pulls system libffi via libwayland-client,
dnl system libffi interposes libffi symbols that ASan assumes are in
dnl libxul, so it barfs about buffer overflows.
dnl Using -Wl,-Bsymbolic ensures no exported symbol can be interposed.
if test -n "$GCC_USE_GNU_LD"; then
case "$LDFLAGS" in
*-fsanitize=address*)
LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
;;
esac
fi
])
19 changes: 19 additions & 0 deletions build/moz.configure/flags.configure
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,25 @@ def file_prefix_map_flags(path_remapping, path_remappings, compiler):

set_config("MOZ_FILE_PREFIX_MAP_FLAGS", file_prefix_map_flags)


@depends(c_compiler)
def is_gnu_cc(c_compiler):
return c_compiler.type != "clang-cl"


@depends("--enable-address-sanitizer", is_gnu_cc)
def check_Bsymbolic(enable_asan, is_gnu_cc):
return enable_asan and is_gnu_cc


# ASan assumes no symbols are being interposed, and when that happens,
# it's not happy with it. Inconveniently, since Firefox is exporting
# libffi symbols and Gtk+3 pulls system libffi via libwayland-client,
# system libffi interposes libffi symbols that ASan assumes are in
# libxul, so it barfs about buffer overflows.
# Using -Wl,-Bsymbolic ensures no exported symbol can be interposed.
check_and_add_linker_flag("-Wl,-Bsymbolic", when=check_Bsymbolic)

# Please keep these last in this file.
add_old_configure_assignment("_COMPILATION_LDFLAGS", linker_flags.ldflags)
add_old_configure_assignment("_COMPILATION_HOST_LDFLAGS", linker_flags.host_ldflags)

0 comments on commit c08a0b3

Please sign in to comment.