Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oconnor663/6c44a6a8a5a10705cdb00130246b37e9 to your computer and use it in GitHub Desktop.
Save oconnor663/6c44a6a8a5a10705cdb00130246b37e9 to your computer and use it in GitHub Desktop.
fsanitize linker error
Compiling cc v1.0.55
Compiling example v0.1.0 (/home/jacko/tmp/sanitizer_example)
warning: src/oops.c:5:12: warning: address of stack memory associated with local variable 'local_array' returned [-Wreturn-stack-address]
warning: return local_array;
warning: ^~~~~~~~~~~
warning: 1 warning generated.
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.29uisxezum6f4udt.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.2hvzw3qk092jmz19.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.2vwfxc7xli1op523.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.2ymvkyqxyu1kfubm.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.3cdg108og5md0ris.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.3gez0ew7mdp6mzvl.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.3k3zvsd83h76i8lv.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.3m3naqk3ran3ezat.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.40q2wd40znjt2qpe.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.4671agdbsu6z61uz.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.48e5e92cumnamxos.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.4fztglx3t4uyyam3.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.4r1v2xfiurh9h28x.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.4y8d3qwcjavz06mb.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.50licjamdn4lo0vq.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.572y8e037962r4qt.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.5br76rci27u0ezgk.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.gc2pz98m0zag3la.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.hvhnxr7nlus473o.rcgu.o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.yrf1d5ng1wwqg95.rcgu.o" "-o" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709" "/home/jacko/tmp/sanitizer_example/target/debug/deps/example-9c8dfc3293cab709.1qjzn8cgi89hjzsa.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/jacko/tmp/sanitizer_example/target/debug/deps" "-L" "/home/jacko/tmp/sanitizer_example/target/debug/build/example-1fe03e86e97bd0b7/out" "-L" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-loops" "-Wl,--no-whole-archive" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-3992d9f81752d81f.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libterm-a08681ead08c2348.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-349394a81c435098.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width-0f4575aeacc437eb.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_std-2fbbde9535beffb2.rlib" "-Wl,--start-group" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-6640d3868fa846e8.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-48481e446108229f.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-bfdf9e1c331f914a.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-991e68a3d0300af6.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace-74304cfed66bbabf.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-5db30a83f5489d12.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-a106c3f62654e72c.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-3d6b30695af38106.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-d8f11f6bb46ba3ee.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-60c81ab95e289dd1.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-fd1a416f10d6c43d.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-4a2bd2b60cccd1fb.rlib" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-7ea8ebc630055039.rlib" "-Wl,--end-group" "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-f7cd12d3ecd59a89.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-ldl" "-lutil"
= note: /usr/bin/ld: /home/jacko/tmp/sanitizer_example/target/debug/build/example-1fe03e86e97bd0b7/out/liboops.a(oops.o): in function `woops_local_array':
/home/jacko/tmp/sanitizer_example/src/oops.c:3: undefined reference to `__asan_option_detect_stack_use_after_return'
/usr/bin/ld: /home/jacko/tmp/sanitizer_example/src/oops.c:3: undefined reference to `__asan_stack_malloc_0'
/usr/bin/ld: /home/jacko/tmp/sanitizer_example/src/oops.c:4: undefined reference to `__asan_memcpy'
/usr/bin/ld: /home/jacko/tmp/sanitizer_example/target/debug/build/example-1fe03e86e97bd0b7/out/liboops.a(oops.o): in function `asan.module_ctor':
oops.c:(.text.asan.module_ctor+0x2): undefined reference to `__asan_init'
/usr/bin/ld: oops.c:(.text.asan.module_ctor+0x7): undefined reference to `__asan_version_mismatch_check_v8'
/usr/bin/ld: oops.c:(.text.asan.module_ctor+0x18): undefined reference to `__asan_register_globals'
/usr/bin/ld: /home/jacko/tmp/sanitizer_example/target/debug/build/example-1fe03e86e97bd0b7/out/liboops.a(oops.o): in function `asan.module_dtor':
oops.c:(.text.asan.module_dtor+0xe): undefined reference to `__asan_unregister_globals'
collect2: error: ld returned 1 exit status
error: aborting due to previous error
The following warnings were emitted during compilation:
warning: src/oops.c:5:12: warning: address of stack memory associated with local variable 'local_array' returned [-Wreturn-stack-address]
warning: return local_array;
warning: ^~~~~~~~~~~
warning: 1 warning generated.
error: could not compile `example`.
To learn more, run the command again with --verbose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment