Skip to content

Instantly share code, notes, and snippets.

@evanrichter
Created February 16, 2022 18:25
Show Gist options
  • Select an option

  • Save evanrichter/f1ae66b5fda75705b48e736055143407 to your computer and use it in GitHub Desktop.

Select an option

Save evanrichter/f1ae66b5fda75705b48e736055143407 to your computer and use it in GitHub Desktop.
mold segfault
[evan@arch mold-break]$ /home/evan/projects/mold/mold -v
mold 1.0.3 (da48efe63ba2b073bff237daa5aa7d379764bba1; compatible with GNU ld)
[evan@arch mold-break]$ cat absolute_call.rs
pub fn main() {
unsafe {
let x: usize = 0x12340000;
let f: extern "C" fn() = std::mem::transmute(x);
f();
}
}
[evan@arch mold-break]$ rustc --target=i686-unknown-linux-musl -C opt-level=3 -C link-arg=-fuse-ld=/home/evan/projects/mold/mold -C link-arg=-Wl,--image-base=0x40000 -C linker=clang absolute_call.rs
error: linking with `clang` failed: exit status: 254
|
= note: "clang" "-m32" "-Wl,-melf_i386" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/self-contained/crt1.o" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/self-contained/crti.o" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/self-contained/crtbegin.o" "absolute_call.absolute_call.d30d0828-cgu.0.rcgu.o" "absolute_call.absolute_call.d30d0828-cgu.1.rcgu.o" "absolute_call.absolute_call.d30d0828-cgu.2.rcgu.o" "absolute_call.5dtrflqp627g1lnh.rcgu.o" "-Wl,--as-needed" "-L" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libstd-45a94729cb097f67.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libpanic_unwind-cf2a00397e98dc94.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libminiz_oxide-7ab970e19eaea17b.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libadler-77078f0911ebe020.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libobject-c86651c068710b08.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libmemchr-adfda58a00c8b65b.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libaddr2line-4434c111a2b55e7c.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libgimli-2bff0f612b03f315.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libstd_detect-2d3c98a899247d86.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/librustc_demangle-41aeaff744e069d5.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libhashbrown-dfdc8ce939bbea81.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/librustc_std_workspace_alloc-5207a18bf4fbb332.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libunwind-4cf0ac385aa0ac41.rlib" "-lunwind" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libcfg_if-3ca816697c03cf86.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/liblibc-4cd98cd125ff877f.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/liballoc-1a363ed25688163b.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/librustc_std_workspace_core-ad9de857b5647df9.rlib" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libcore-ee87b1a70c57b8f6.rlib" "-Wl,--end-group" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/libcompiler_builtins-23f879239652a113.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-nostartfiles" "-L" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib" "-L" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/self-contained" "-o" "absolute_call" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs" "-fuse-ld=/home/evan/projects/mold/mold" "-Wl,--image-base=0x40000" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/self-contained/crtend.o" "/home/evan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-musl/lib/self-contained/crtn.o"
= note: clang-13: warning: argument unused during compilation: '-no-pie' [-Wunused-command-line-argument]
clang-13: error: unable to execute command: Segmentation fault (core dumped)
clang-13: error: linker command failed due to signal (use -v to see invocation)
error: aborting due to previous error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment