Skip to content

Commit

Permalink
vagrant: use LDFLAGS="-Wl,--no-as-needed" in sanitizer runs
Browse files Browse the repository at this point in the history
Since version 10, both gcc and clang started to ignore certain linker errors
when compiling with -fsanitize=address. This eventually leads up to a cc
command line which has -Wl,--as-needed that causes linking against libcrypt
(-lcrypt) to have no effect and causing systemd-homed (and its utilities) to
crash when they try to resolve an external symbol from the libcrypt library.
Negating the -Wl,--as-needed by -Wl,--no-as-needed seems to help in this case.

See:
  https://bugzilla.redhat.com/show_bug.cgi?id=1827338#c3
  #247
  • Loading branch information
mrc0mmand committed May 15, 2020
1 parent 4097895 commit f198ab4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions vagrant/bootstrap_scripts/arch-sanitizers-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ export CC=clang
export CXX=clang++
export CFLAGS="-shared-libasan"
export CXXFLAGS="-shared-libasan"
# FIXME
# Since version 10, both gcc and clang started to ignore certain linker errors
# when compiling with -fsanitize=address. This eventually leads up to a cc
# command line which has -Wl,--as-needed that causes linking against libcrypt
# (-lcrypt) to have no effect and causing systemd-homed (and its utilities) to
# crash when they try to resolve an external symbol from the libcrypt library.
# Negating the -Wl,--as-needed by -Wl,--no-as-needed seems to help in this case.
#
# See:
# https://bugzilla.redhat.com/show_bug.cgi?id=1827338#c3
# https://github.com/systemd/systemd-centos-ci/issues/247
export LDFLAGS="-Wl,--no-as-needed"

meson "$BUILD_DIR" \
--werror \
Expand Down
14 changes: 14 additions & 0 deletions vagrant/bootstrap_scripts/arch-sanitizers-gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ rm -fr "$BUILD_DIR"
# Build phase
# Compile systemd with the Address Sanitizer (ASan) and Undefined Behavior
# Sanitizer (UBSan)

# FIXME
# Since version 10, both gcc and clang started to ignore certain linker errors
# when compiling with -fsanitize=address. This eventually leads up to a cc
# command line which has -Wl,--as-needed that causes linking against libcrypt
# (-lcrypt) to have no effect and causing systemd-homed (and its utilities) to
# crash when they try to resolve an external symbol from the libcrypt library.
# Negating the -Wl,--as-needed by -Wl,--no-as-needed seems to help in this case.
#
# See:
# https://bugzilla.redhat.com/show_bug.cgi?id=1827338#c3
# https://github.com/systemd/systemd-centos-ci/issues/247
export LDFLAGS="-Wl,--no-as-needed"

meson "$BUILD_DIR" \
--werror \
-Dc_args='-fno-omit-frame-pointer -ftrapv' \
Expand Down

0 comments on commit f198ab4

Please sign in to comment.