Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubleshooting: linking with cc failed #141

Open
AljoschaMeyer opened this issue Oct 4, 2018 · 5 comments
Open

Troubleshooting: linking with cc failed #141

AljoschaMeyer opened this issue Oct 4, 2018 · 5 comments

Comments

@AljoschaMeyer
Copy link

AljoschaMeyer commented Oct 4, 2018

Hey,

I wanted to try some basic rust fuzzing, following the tutorial, but cargo afl build fails. I have no idea how to start troubleshooting this, so I'd be thankful for any pointers. I'm just pasting foo --version --verbose output for a bunch of stuff that might be relevant.

I'm on x86-64 Linux (arch linux), and there's a system-wide afl installation.

Gist of the error message (full output at the end of this issue)

error: linking with `cc` failed: exit code: 1
[...]
/usr/bin/ld: final link failed: bad value                                                                         
          collect2: error: ld returned 1 exit status

/home/aljoscha/projects/rsssb/fuzz-legacy-msg/src/main.rs

#[macro_use]
extern crate afl;
extern crate ssb_legacy_msg;

use ssb_legacy_msg::json::{from_slice, Value};

fn main() {
    fuzz!(|data: &[u8]| {
              // This comment keeps rustfmt from breaking the fuzz macro...
              match from_slice::<Value>(data) {
                  Ok(_) => std::process::abort(),
                  Err(_) => {}
              }
          });
}

cargo.toml

[package]
name = "fuzz-legacy-msg"
version = "0.1.0"
authors = ["AljoschaMeyer <[email protected]>"]
edition = "2018"

[dependencies]
afl = "0.4"
ssb-legacy-msg = { path = "../ssb-legacy-msg" }

cargo afl --version

cargo-afl 0.4.0

cargo --version --verbose

release: 1.31.0
commit-hash: de314a8b2d45bce4958fc23939c5e4286e31621c
commit-date: 2018-09-21

rustc --version --verbose

rustc 1.31.0-nightly (de3d640f5 2018-10-01)
binary: rustc
commit-hash: de3d640f59c4fa4a09faf2a8d6b0a812aaa6d6cb
commit-date: 2018-10-01
host: x86_64-unknown-linux-gnu
release: 1.31.0-nightly
LLVM version: 8.0

cc --version --verbose

Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/lto-wrapper
cc (GCC) 8.2.1 20180831
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-cet=auto
Thread model: posix
gcc version 8.2.1 20180831 (GCC) 
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/cc1 -quiet -v help-dummy -quiet -dumpbase help-dummy -mtune=generic -march=x86-64 -auxbase help-dummy -version --version -o /tmp/ccllaowH.s
GNU C17 (GCC) version 8.2.1 20180831 (x86_64-pc-linux-gnu)
	compiled by GNU C version 8.2.1 20180831, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=x86-64'
 as -v --64 --version -o /tmp/ccfbTZOe.o /tmp/ccllaowH.s
GNU assembler version 2.31.1 (x86_64-pc-linux-gnu) using BFD version (GNU Binutils) 2.31.1
GNU assembler (GNU Binutils) 2.31.1
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-pc-linux-gnu'.
COMPILER_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/collect2 -plugin /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/lto-wrapper -plugin-opt=-fresolution=/tmp/cciH7a8L.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie --version /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1 -L/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../.. /tmp/ccfbTZOe.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib/crtn.o
collect2 version 8.2.1 20180831
/usr/bin/ld -plugin /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/lto-wrapper -plugin-opt=-fresolution=/tmp/cciH7a8L.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie --version /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1 -L/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../.. /tmp/ccfbTZOe.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib/crtn.o
GNU ld (GNU Binutils) 2.31.1
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=x86-64'

ld --version --verbose

GNU ld (GNU Binutils) 2.31.1
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

Error log of cargo afl build --verbose

   Compiling semver-parser v0.7.0                                                                                           
       Fresh unicode-width v0.1.5                                                                                           
       Fresh libc v0.2.43                                                                                                   
   Compiling xdg v2.1.0                                                                                                     
     Running `rustc --crate-name semver_parser /home/aljoscha/.cargo/registry/src/github.com-1ecc6299db9ec823/semver-parser-0.7.0/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=d192ee5d967b9ab0 -C extra-filename=-d192ee5d967b9ab0 --out-dir /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps -L dependency=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/aljoscha/.local/share/afl.rs/rustc-1.31.0-nightly-de3d640/afl.rs-0.4.0/afl-llvm-rt`
   Compiling ryu-ecmascript v0.1.0                                                                                          
     Running `rustc --crate-name xdg /home/aljoscha/.cargo/registry/src/github.com-1ecc6299db9ec823/xdg-2.1.0/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=d78babd39ee3bda1 -C extra-filename=-d78babd39ee3bda1 --out-dir /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps -L dependency=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/aljoscha/.local/share/afl.rs/rustc-1.31.0-nightly-de3d640/afl.rs-0.4.0/afl-llvm-rt`
       Fresh strsim v0.7.0                                                                                                  
     Running `rustc --crate-name build_script_build /home/aljoscha/.cargo/registry/src/github.com-1ecc6299db9ec823/ryu-ecmascript-0.1.0/build.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=6826ee5f6622fe88 -C extra-filename=-6826ee5f6622fe88 --out-dir /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/build/ryu-ecmascript-6826ee5f6622fe88 -L dependency=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/aljoscha/.local/share/afl.rs/rustc-1.31.0-nightly-de3d640/afl.rs-0.4.0/afl-llvm-rt`
       Fresh bitflags v1.0.4                                                                                                
       Fresh vec_map v0.8.1                                                                                                 
       Fresh ansi_term v0.11.0                                                                                              
       Fresh cc v1.0.25                                                                                                     
       Fresh encode_unicode v0.3.2                                                                                          
       Fresh indexmap v1.0.1                                                                                                
       Fresh textwrap v0.10.0                                                                                               
       Fresh atty v0.2.11                                                                                                   
       Fresh clap v2.32.0                                                                                                   
     Running `/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/build/ryu-ecmascript-6826ee5f6622fe88/build-script-build`
     Running `rustc --crate-name ryu_ecmascript /home/aljoscha/.cargo/registry/src/github.com-1ecc6299db9ec823/ryu-ecmascript-0.1.0/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=a9ec477208b69f21 -C extra-filename=-a9ec477208b69f21 --out-dir /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps -L dependency=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/aljoscha/.local/share/afl.rs/rustc-1.31.0-nightly-de3d640/afl.rs-0.4.0/afl-llvm-rt --cfg integer128 --cfg must_use_return`
   Compiling semver v0.9.0                                                                                                  
     Running `rustc --crate-name semver /home/aljoscha/.cargo/registry/src/github.com-1ecc6299db9ec823/semver-0.9.0/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' -C metadata=843f695fa8ece667 -C extra-filename=-843f695fa8ece667 --out-dir /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps -L dependency=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps --extern semver_parser=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libsemver_parser-d192ee5d967b9ab0.rlib --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/aljoscha/.local/share/afl.rs/rustc-1.31.0-nightly-de3d640/afl.rs-0.4.0/afl-llvm-rt`
   Compiling ssb-legacy-msg v0.1.0 (/home/aljoscha/projects/rsssb/ssb-legacy-msg)                                           
     Running `rustc --crate-name ssb_legacy_msg /home/aljoscha/projects/rsssb/ssb-legacy-msg/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=ce25ee93d7e58296 -C extra-filename=-ce25ee93d7e58296 --out-dir /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps -C incremental=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/incremental -L dependency=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps --extern encode_unicode=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libencode_unicode-283dc2d0950a1c26.rlib --extern indexmap=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libindexmap-b4697209a357a291.rlib --extern ryu_ecmascript=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libryu_ecmascript-a9ec477208b69f21.rlib --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/aljoscha/.local/share/afl.rs/rustc-1.31.0-nightly-de3d640/afl.rs-0.4.0/afl-llvm-rt`
   Compiling rustc_version v0.2.3                                                                                           
     Running `rustc --crate-name rustc_version /home/aljoscha/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc_version-0.2.3/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=3d4189cf1addeb47 -C extra-filename=-3d4189cf1addeb47 --out-dir /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps -L dependency=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps --extern semver=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libsemver-843f695fa8ece667.rlib --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/aljoscha/.local/share/afl.rs/rustc-1.31.0-nightly-de3d640/afl.rs-0.4.0/afl-llvm-rt`
   Compiling afl v0.4.0                                                                                                     
     Running `rustc --crate-name build_script_build /home/aljoscha/.cargo/registry/src/github.com-1ecc6299db9ec823/afl-0.4.0/build.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=e6a7936995a5c78c -C extra-filename=-e6a7936995a5c78c --out-dir /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/build/afl-e6a7936995a5c78c -L dependency=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps --extern rustc_version=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/librustc_version-3d4189cf1addeb47.rlib --extern xdg=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libxdg-d78babd39ee3bda1.rlib --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/aljoscha/.local/share/afl.rs/rustc-1.31.0-nightly-de3d640/afl.rs-0.4.0/afl-llvm-rt`
     Running `/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/build/afl-e6a7936995a5c78c/build-script-build`     
     Running `rustc --crate-name afl /home/aljoscha/.cargo/registry/src/github.com-1ecc6299db9ec823/afl-0.4.0/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=c22660126f129d94 -C extra-filename=-c22660126f129d94 --out-dir /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps -L dependency=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps --extern cc=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libcc-0c988083f9cb93d1.rlib --extern clap=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libclap-c8fca7a762cd4937.rlib --extern rustc_version=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/librustc_version-3d4189cf1addeb47.rlib --extern xdg=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libxdg-d78babd39ee3bda1.rlib --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/aljoscha/.local/share/afl.rs/rustc-1.31.0-nightly-de3d640/afl.rs-0.4.0/afl-llvm-rt`
   Compiling fuzz-legacy-msg v0.1.0 (/home/aljoscha/projects/rsssb/fuzz-legacy-msg)                                         
     Running `rustc --edition=2018 --crate-name fuzz_legacy_msg src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=76eedfad431fc184 -C extra-filename=-76eedfad431fc184 --out-dir /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps -C incremental=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/incremental -L dependency=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps --extern afl=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libafl-c22660126f129d94.rlib --extern ssb_legacy_msg=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libssb_legacy_msg-ce25ee93d7e58296.rlib --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/aljoscha/.local/share/afl.rs/rustc-1.31.0-nightly-de3d640/afl.rs-0.4.0/afl-llvm-rt`
error: linking with `cc` failed: exit code: 1                                                                               
  |                                                                                                                         
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/aljoscha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.14yyy110mel5ktff.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.1g4zpl9i8lx3h2mm.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.1rmagjxo9ve2xs6n.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.1zx2r20vh5c59myy.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.2764v71i8kejldxm.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.2l90sczt5xy16nmj.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.2t4fj8sstrc5poze.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.2yq8iph4b2vodf24.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.38m6v8xj6wag3dsf.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.3zg9pk7pf6k34nx.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.41vt0g0scilbdusu.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.438ed5s5r9sqoaqp.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.47c021knwugod2td.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.4akre96j5cn5irvc.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.4jk6hqar9oroum5l.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.512acwa8rok5d2jz.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.5e55a046mt1u4mte.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.5fplb9h1ooldbk0q.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.5vmknhn95f32jr.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.75334emkraqgjki.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.b862g4g8m3uhs68.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.e9o00xc18b703lx.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.hqp7ome1koww9mn.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.kyaxmxe7o0w1ayv.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.nr19oqhws91drwu.rcgu.o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.tjhtqufrcw7dv9c.rcgu.o" "-o" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.2a0yp9afth6rn8b5.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps" "-L" "/home/aljoscha/.local/share/afl.rs/rustc-1.31.0-nightly-de3d640/afl.rs-0.4.0/afl-llvm-rt" "-L" "/home/aljoscha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lafl-llvm-rt" "-Wl,-Bstatic" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libssb_legacy_msg-ce25ee93d7e58296.rlib" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libencode_unicode-283dc2d0950a1c26.rlib" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libryu_ecmascript-a9ec477208b69f21.rlib" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libindexmap-b4697209a357a291.rlib" "/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libafl-c22660126f129d94.rlib" "-Wl,--start-group" "/home/aljoscha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-027a89be167b265b.rlib" "/home/aljoscha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-efa06fb124dba20d.rlib" "/home/aljoscha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-42fae5dd1c152cb8.rlib" "/home/aljoscha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-95f74442e79def6e.rlib" "/home/aljoscha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-98b41d45b3686f4d.rlib" "/home/aljoscha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-7899d3c8c19ca5e1.rlib" "/home/aljoscha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c5d3fd47d77e21ad.rlib" "/home/aljoscha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-0a980ea71709207b.rlib" "-Wl,--end-group" "/home/aljoscha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-edd9753c2ed7ad48.rlib" "-Wl,-Bdynamic" "-lafl-llvm-rt" "-lafl-llvm-rt" "-lafl-llvm-rt" "-lafl-llvm-rt" "-lafl-llvm-rt" "-ldl" "-lrt" "-lpthread" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /usr/bin/ld: __sancov_guards has both ordered [`__sancov_guards' in /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.2yq8iph4b2vodf24.rcgu.o] and unordered [`__sancov_guards' in /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/fuzz_legacy_msg-76eedfad431fc184.2yq8iph4b2vodf24.rcgu.o] sections
          /usr/bin/ld: final link failed: bad value                                                                         
          collect2: error: ld returned 1 exit status                                                                        
                                                                                                                            
                                                                                                                            
error: aborting due to previous error                                                                                       
                                                                                                                            
error: Could not compile `fuzz-legacy-msg`.                                                                                 

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name fuzz_legacy_msg src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=76eedfad431fc184 -C extra-filename=-76eedfad431fc184 --out-dir /home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps -C incremental=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/incremental -L dependency=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps --extern afl=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libafl-c22660126f129d94.rlib --extern ssb_legacy_msg=/home/aljoscha/projects/rsssb/fuzz-legacy-msg/target/debug/deps/libssb_legacy_msg-ce25ee93d7e58296.rlib --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/aljoscha/.local/share/afl.rs/rustc-1.31.0-nightly-de3d640/afl.rs-0.4.0/afl-llvm-rt` (exit code: 1)
@AljoschaMeyer AljoschaMeyer changed the title Troublesshooting: linking with cc failed Troubleshooting: linking with cc failed Oct 4, 2018
@frewsxcv
Copy link
Member

frewsxcv commented Oct 6, 2018

This looks like rust-lang/rust#53945

We may want to add this Rust flag temporarily as a workaround rust-fuzz/honggfuzz-rs@44167fe

SingingTree added a commit to SingingTree/afl.rs that referenced this issue Oct 22, 2018
rust-fuzz#141 + rust-lang/rust#53945 track issues with linkage
which regressed when rust updated to llvm 8. This commit adds a work
around for such issues for cargo-afl. This helps with the ergonomics of
cargo-afl, particularly for those less familiar with the project and the
above issues.

These changes can be safely removed once patches are landed in llvm and
rust updates to use the patched version.
frewsxcv pushed a commit that referenced this issue Oct 23, 2018
#141 + rust-lang/rust#53945 track issues with linkage
which regressed when rust updated to llvm 8. This commit adds a work
around for such issues for cargo-afl. This helps with the ergonomics of
cargo-afl, particularly for those less familiar with the project and the
above issues.

These changes can be safely removed once patches are landed in llvm and
rust updates to use the patched version.
@frewsxcv
Copy link
Member

a temporary fix was merged in #144 and just published in 0.4.2

@yorickpeterse
Copy link

I'm running into this exact same error when using AFL.rs 0.4.3, also on Arch Linux:

       Fresh version_check v0.1.5
       Fresh cfg-if v0.1.6
       Fresh lazy_static v1.2.0
       Fresh ucd-util v0.1.3
       Fresh glob v0.2.11
       Fresh utf8-ranges v1.0.2
       Fresh unicode-width v0.1.5
       Fresh vec_map v0.8.1
       Fresh bitflags v1.0.4
       Fresh strsim v0.7.0
       Fresh ansi_term v0.11.0
       Fresh lazy_static v0.2.11
       Fresh nodrop v0.1.13
       Fresh quote v0.3.15
       Fresh peeking_take_while v0.1.2
       Fresh semver-parser v0.7.0
       Fresh pkg-config v0.3.14
       Fresh memoffset v0.2.1
       Fresh void v1.0.2
       Fresh make-cmd v0.1.0
       Fresh scopeguard v0.3.3
       Fresh cc v1.0.26
       Fresh xdg v2.2.0
       Fresh stable_deref_trait v1.1.1
       Fresh either v1.5.0
       Fresh abort_on_panic v1.0.0
       Fresh fnv v1.0.6
   Compiling memchr v2.1.2
       Fresh log v0.4.6
       Fresh crossbeam-utils v0.2.2
       Fresh thread_local v0.3.6
       Fresh regex-syntax v0.5.6
     Running `rustc --crate-name build_script_build /home/yorickpeterse/.cargo/registry/src/github.com-1ecc6299db9ec823/memchr-2.1.2/build.rs --color never --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="libc"' --cfg 'feature="use_std"' -C metadata=71fd26a30f9af501 -C extra-filename=-71fd26a30f9af501 --out-dir /home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/memchr-71fd26a30f9af501 -L dependency=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps --extern version_check=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/libversion_check-605eabd9670d7fae.rlib --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/yorickpeterse/.local/share/afl.rs/rustc-1.31.0-abe02ce/afl.rs-0.4.3/afl-llvm-rt`
       Fresh textwrap v0.10.0
       Fresh getopts v0.2.18
       Fresh semver v0.9.0
   Compiling unreachable v1.0.0
   Compiling libloading v0.5.0
     Running `rustc --crate-name unreachable /home/yorickpeterse/.cargo/registry/src/github.com-1ecc6299db9ec823/unreachable-1.0.0/src/lib.rs --color never --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=ea3d8389ce0e7842 -C extra-filename=-ea3d8389ce0e7842 --out-dir /home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps -L dependency=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps --extern void=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/libvoid-f6bd5365a7c87038.rlib --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/yorickpeterse/.local/share/afl.rs/rustc-1.31.0-abe02ce/afl.rs-0.4.3/afl-llvm-rt`
     Running `rustc --crate-name build_script_build /home/yorickpeterse/.cargo/registry/src/github.com-1ecc6299db9ec823/libloading-0.5.0/build.rs --color never --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=db0490d01b893126 -C extra-filename=-db0490d01b893126 --out-dir /home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126 -L dependency=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps --extern cc=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/libcc-58e69f9c4fe45bd6.rlib --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/yorickpeterse/.local/share/afl.rs/rustc-1.31.0-abe02ce/afl.rs-0.4.3/afl-llvm-rt`
   Compiling owning_ref v0.3.3
     Running `rustc --crate-name owning_ref /home/yorickpeterse/.cargo/registry/src/github.com-1ecc6299db9ec823/owning_ref-0.3.3/src/lib.rs --color never --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=3a45bd06483761fc -C extra-filename=-3a45bd06483761fc --out-dir /home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps -L dependency=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps --extern stable_deref_trait=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/libstable_deref_trait-5f089598037b9a34.rlib --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/yorickpeterse/.local/share/afl.rs/rustc-1.31.0-abe02ce/afl.rs-0.4.3/afl-llvm-rt`
   Compiling libc v0.2.45
     Running `rustc --crate-name libc /home/yorickpeterse/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.45/src/lib.rs --color never --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="use_std"' -C metadata=4d78cad6884ff312 -C extra-filename=-4d78cad6884ff312 --out-dir /home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps -L dependency=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/yorickpeterse/.local/share/afl.rs/rustc-1.31.0-abe02ce/afl.rs-0.4.3/afl-llvm-rt --cfg core_cvoid`
   Compiling log v0.3.9
     Running `rustc --crate-name log /home/yorickpeterse/.cargo/registry/src/github.com-1ecc6299db9ec823/log-0.3.9/src/lib.rs --color never --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="log"' --cfg 'feature="use_std"' -C metadata=3fb2e6e89f4c5a33 -C extra-filename=-3fb2e6e89f4c5a33 --out-dir /home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps -L dependency=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps --extern log=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/liblog-e7d11455959bf2da.rlib --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/yorickpeterse/.local/share/afl.rs/rustc-1.31.0-abe02ce/afl.rs-0.4.3/afl-llvm-rt`
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/memchr-71fd26a30f9af501/build_script_build-71fd26a30f9af501.build_script_build.bk5tw3ux-cgu.0.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/memchr-71fd26a30f9af501/build_script_build-71fd26a30f9af501.build_script_build.bk5tw3ux-cgu.1.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/memchr-71fd26a30f9af501/build_script_build-71fd26a30f9af501.build_script_build.bk5tw3ux-cgu.2.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/memchr-71fd26a30f9af501/build_script_build-71fd26a30f9af501.build_script_build.bk5tw3ux-cgu.3.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/memchr-71fd26a30f9af501/build_script_build-71fd26a30f9af501.build_script_build.bk5tw3ux-cgu.4.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/memchr-71fd26a30f9af501/build_script_build-71fd26a30f9af501.build_script_build.bk5tw3ux-cgu.5.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/memchr-71fd26a30f9af501/build_script_build-71fd26a30f9af501.build_script_build.bk5tw3ux-cgu.6.rcgu.o" "-o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/memchr-71fd26a30f9af501/build_script_build-71fd26a30f9af501" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/memchr-71fd26a30f9af501/build_script_build-71fd26a30f9af501.9xotgh50119ferc.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps" "-L" "/home/yorickpeterse/.local/share/afl.rs/rustc-1.31.0-abe02ce/afl.rs-0.4.3/afl-llvm-rt" "-L" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lafl-llvm-rt" "-Wl,-Bstatic" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/libversion_check-605eabd9670d7fae.rlib" "-Wl,--start-group" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-52f862a21e09568c.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-b89f1a9b548bfef9.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-a7f738f7aa980965.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-4c9cbe622de116ab.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-48c8a8552cff934e.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-517830e9d56bab97.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-2d44723f32308cf8.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-f2133e8b70369157.rlib" "-Wl,--end-group" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-71671e8958739d51.rlib" "-Wl,-Bdynamic" "-lafl-llvm-rt" "-ldl" "-lrt" "-lpthread" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /usr/bin/ld: __sancov_guards has both ordered [`__sancov_guards' in /home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/libversion_check-605eabd9670d7fae.rlib(version_check-605eabd9670d7fae.version_check.1kqjzbmc-cgu.3.rcgu.o)] and unordered [`__sancov_guards' in /home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/libversion_check-605eabd9670d7fae.rlib(version_check-605eabd9670d7fae.version_check.1kqjzbmc-cgu.3.rcgu.o)] sections
          /usr/bin/ld: final link failed: bad value
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: Could not compile `memchr`.

Caused by:
  process didn't exit successfully: `rustc --crate-name build_script_build /home/yorickpeterse/.cargo/registry/src/github.com-1ecc6299db9ec823/memchr-2.1.2/build.rs --color never --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="libc"' --cfg 'feature="use_std"' -C metadata=71fd26a30f9af501 -C extra-filename=-71fd26a30f9af501 --out-dir /home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/memchr-71fd26a30f9af501 -L dependency=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps --extern version_check=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/libversion_check-605eabd9670d7fae.rlib --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/yorickpeterse/.local/share/afl.rs/rustc-1.31.0-abe02ce/afl.rs-0.4.3/afl-llvm-rt` (exit code: 1)
warning: build failed, waiting for other jobs to finish...
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.0.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.1.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.10.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.11.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.12.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.13.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.14.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.15.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.2.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.3.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.4.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.5.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.6.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.7.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.8.rcgu.o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.build_script_build.deonwpyc-cgu.9.rcgu.o" "-o" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126/build_script_build-db0490d01b893126.207phxhwnzfjnsqz.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps" "-L" "/home/yorickpeterse/.local/share/afl.rs/rustc-1.31.0-abe02ce/afl.rs-0.4.3/afl-llvm-rt" "-L" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lafl-llvm-rt" "-Wl,-Bstatic" "/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/libcc-58e69f9c4fe45bd6.rlib" "-Wl,--start-group" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-52f862a21e09568c.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-b89f1a9b548bfef9.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-a7f738f7aa980965.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-4c9cbe622de116ab.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-48c8a8552cff934e.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-517830e9d56bab97.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-2d44723f32308cf8.rlib" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-f2133e8b70369157.rlib" "-Wl,--end-group" "/home/yorickpeterse/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-71671e8958739d51.rlib" "-Wl,-Bdynamic" "-lafl-llvm-rt" "-ldl" "-lrt" "-lpthread" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /usr/bin/ld: __sancov_guards has both ordered [`__sancov_guards' in /home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/libcc-58e69f9c4fe45bd6.rlib(cc-58e69f9c4fe45bd6.cc.c8gg4gin-cgu.11.rcgu.o)] and unordered [`__sancov_guards' in /home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/libcc-58e69f9c4fe45bd6.rlib(cc-58e69f9c4fe45bd6.cc.c8gg4gin-cgu.11.rcgu.o)] sections
          /usr/bin/ld: final link failed: bad value
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: Could not compile `libloading`.

Caused by:
  process didn't exit successfully: `rustc --crate-name build_script_build /home/yorickpeterse/.cargo/registry/src/github.com-1ecc6299db9ec823/libloading-0.5.0/build.rs --color never --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=db0490d01b893126 -C extra-filename=-db0490d01b893126 --out-dir /home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/build/libloading-db0490d01b893126 -L dependency=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps --extern cc=/home/yorickpeterse/Projects/inko/inko/vm/fuzzing/target/debug/deps/libcc-58e69f9c4fe45bd6.rlib --cap-lints allow --cfg fuzzing -C debug-assertions -C overflow_checks -C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -C llvm-args=-sanitizer-coverage-trace-pc-guard -C llvm-args=-sanitizer-coverage-prune-blocks=0 -C opt-level=3 -C target-cpu=native -C debuginfo=0 -l afl-llvm-rt -L /home/yorickpeterse/.local/share/afl.rs/rustc-1.31.0-abe02ce/afl.rs-0.4.3/afl-llvm-rt` (exit code: 1)
warning: build failed, waiting for other jobs to finish...
error: build failed

@hahseba
Copy link

hahseba commented Jan 6, 2019

Indeed, it seems like crates relying on cc to build don't work. Perhaps some Options have to be provided to cc?

@lukehsiao
Copy link

lukehsiao commented Jan 30, 2019

I also have a similar compile issue with cc, using afl.rs v0.4.3, with rustc 1.32.0.

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" [...] "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /usr/bin/ld: __sancov_guards has both ordered [`__sancov_guards[_ZN55_$LT$$RF$T$u20$as$u20$core..convert..AsRef$LT$U$GT$$GT$6as_ref17h9e6557eb3a62b5e9E]' in [...]/target/debug/build/failure_derive-838ca9ab30299771/build_script_build-838ca9ab30299771.build_script_build.ewjo15gi-cgu.0.rcgu.o] and unordered [`__sancov_guards' in [...]/target/debug/build/failure_derive-838ca9ab30299771/build_script_build-838ca9ab30299771.build_script_build.ewjo15gi-cgu.0.rcgu.o] sections
          /usr/bin/ld: final link failed: Bad value
          collect2: error: ld returned 1 exit status


error: aborting due to previous error

error: Could not compile `failure_derive`.
warning: build failed, waiting for other jobs to finish...
error: build failed

I also notice that I do not see the flags added in #144 listed during the linking.

I can confirm that adding user-provided flags via

$ export RUSTFLAGS="-Clink-arg=-fuse-ld=gold"

does result in a successful build. I'm on Ubuntu 18.04, so it seems strange that this was not added automatically given this condition:

afl.rs/src/bin/cargo-afl.rs

Lines 193 to 199 in 0fbe9c5

if cfg!(linux) {
// work around https://github.com/rust-fuzz/afl.rs/issues/141 /
// https://github.com/rust-lang/rust/issues/53945, can be removed once
// those are fixed.
rustflags.push_str("-Clink-arg=-fuse-ld=gold");
rustdocflags.push_str("-Clink-arg=-fuse-ld=gold");
}

pedrocr added a commit to pedrocr/afl.rs that referenced this issue Feb 22, 2019
The rust-fuzz#141 workaround was actually fully disabled because the OS condition
was wrong. This fixes the workaround.
pedrocr added a commit to pedrocr/afl.rs that referenced this issue Feb 22, 2019
When the fix for rust-fuzz#141 is in effect if you pass extra RUSTFLAGS there is
no space separating them and the command line breaks. Fix that by adding
a space at the end of those flags, just like it's done in the common
string.
pedrocr added a commit to pedrocr/afl.rs that referenced this issue Oct 6, 2019
The rust-fuzz#141 workaround was actually fully disabled because the OS condition
was wrong. This fixes the workaround.
pedrocr added a commit to pedrocr/afl.rs that referenced this issue Oct 6, 2019
When the fix for rust-fuzz#141 is in effect if you pass extra RUSTFLAGS there is
no space separating them and the command line breaks. Fix that by adding
a space at the end of those flags, just like it's done in the common
string.
pedrocr added a commit to pedrocr/afl.rs that referenced this issue Oct 6, 2019
The rust-fuzz#141 workaround was actually fully disabled because the OS condition
was wrong. This fixes the workaround.
pedrocr added a commit to pedrocr/afl.rs that referenced this issue Oct 6, 2019
When the fix for rust-fuzz#141 is in effect if you pass extra RUSTFLAGS there is
no space separating them and the command line breaks. Fix that by adding
a space at the end of those flags, just like it's done in the common
string.
pedrocr added a commit to pedrocr/afl.rs that referenced this issue Oct 6, 2019
The rust-fuzz#141 workaround was actually fully disabled because the OS condition
was wrong. This fixes the workaround.
pedrocr added a commit to pedrocr/afl.rs that referenced this issue Oct 6, 2019
When the fix for rust-fuzz#141 is in effect if you pass extra RUSTFLAGS there is
no space separating them and the command line breaks. Fix that by adding
a space at the end of those flags, just like it's done in the common
string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants