Skip to content

ASan fails to link on Travis due to rustc and linker arguments

In helping to debug https://trac.torproject.org/projects/tor/ticket/25386 I've found that a number of the link errors are attributable to the linker invocation on Travis. The recent link_rust.sh script is definitely necessary I think, except that I believe it needs a few tweaks:

  • The -lasan argument should be replaced with -fsanitizer=address I believe to ensure that the C compiler links all of its relevant libraries (as they may have different names and different numbers of libs on some platforms I think).
  • Second, the Rust compiler by default passes -nodefaultlibs to the linker which means that the linker script also passes this along. It looks, however, like this is incompatible with -fsanitizer=address, causing link errors. This argument should be safe to strip out though.

The first bullet was easy enough to fix locally and the second bullet was fixable by changing link_rust.sh to a bash script and then using something like:

linker_args="$@"                                           
$CCLD @RUST_LINKER_OPTIONS@ ${linker_args//-nodefaultlibs/}

Trac:
Username: alexcrichton

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information