Page MenuHomeFreeBSD

lang/rust: unbreak on armv6
ClosedPublic

Authored by mikael on Aug 26 2019, 10:36 AM.

Details

Reviewers
tobik
Group Reviewers
rust
Commits
rP510684: lang/rust: Unbreak on armv6
Summary

I have this error on armv6:

error: couldn't load codegen backend "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage1/lib/rustlib/armv6-unknown-freebsd/codegen-backends/librustc_codegen_llvm-llvm.so": "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage1/lib/rustlib/armv6-unknown-freebsd/codegen-backends/librustc_codegen_llvm-llvm.so: Undefined symbol \"__clear_cache\""

__clear_cache is implemented in compiler-rt and was dropped upstream with this commit:
[[ https://github.com/rust-lang-nursery/compiler-builtins/commit/aa41e0d25fcb2b11b9b5c269846dd70547f2a787 | Remove compiler-rt submodule from this repository ]]

Is it possible to bring back compiler-rt? Should I try to just import clear_cache.c?

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Is it possible to bring back compiler-rt? Should I try to just import clear_cache.c?

I'm wondering if it wouldn't be possible to link with /usr/lib/libcompiler_rt.a instead similar to what OpenBSD does? See the top of vendor/compiler_builtins/build.rs.

Is it possible to bring back compiler-rt? Should I try to just import clear_cache.c?

I'm wondering if it wouldn't be possible to link with /usr/lib/libcompiler_rt.a instead similar to what OpenBSD does? See the top of vendor/compiler_builtins/build.rs.

I've already tried that, but I have an error (duplicate symbols)

In D21415#466851, @mikael.urankar_gmail.com wrote:

I've already tried that, but I have an error (duplicate symbols)

Which symbols? An error log would've been useful for posterity e.g., check if future versions are still affected or attempt to fix.

lang/rust/Makefile
13 ↗(On Diff #61284)
  • Non-abbreviated URLs need terminating /
  • Use :group here and in DISTFILES to limit search
113 ↗(On Diff #61284)

DISTFILES are extracted by default under WRKDIR. Did you try to make a symlink to instead?

In D21415#466851, @mikael.urankar_gmail.com wrote:

I've already tried that, but I have an error (duplicate symbols)

Which symbols? An error log would've been useful for posterity e.g., check if future versions are still affected or attempt to fix.

note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-sysroot/lib/rustlib/armv6-unknown-freebsd/lib" "/usr/ports/lang/rust/wor
k/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.0.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.1.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.10.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.11.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.12.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.13.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.14.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.15.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.2.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.3.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.4.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.5.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.6.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.7.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.8.rcgu.o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.serialize.5hojgqvv-cgu.9.rcgu.o" "-o" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/libserialize-9066e4b142207be2.so" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps/serialize-9066e4b142207be2.54n451q5dj5ilzg0.rcgu.o" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/armv6-unknown-freebsd/release/deps" "-L" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-rustc/release/deps" "-L" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-sysroot/lib/rustlib/armv6-unknown-freebsd/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "/tmp/rustc6MME7V/libindexmap-c291c0f705b65f6d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc6MME7V/libsmallvec-992312e9a0910ce0.rlib" "-Wl,--no-whole-archive" "-Wl,--start-group" "-L" "/usr/ports/lang/rust/work/rustc-1.37.0-src/build/armv6-unknown-freebsd/stage0-sysroot/lib/rustlib/armv6-unknown-freebsd/lib" "-Wl,-Bdynamic" "-lstd-4e5896275d2deabf" "-Wl,--end-group" "-Wl,-Bstatic" "/tmp/rustc6MME7V/libcompiler_builtins-8ed634fbe62c4d3f.rlib" "-Wl,-Bdynamic" "-lexecinfo" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-shared" "-Wl,-rpath,$ORIGIN/../lib"
  = note: /tmp/rustc6MME7V/libcompiler_builtins-8ed634fbe62c4d3f.rlib(compiler_builtins-8ed634fbe62c4d3f.compiler_builtins.7ngazxi9-cgu.3.rcgu.o): In function `__udivmoddi4':
          compiler_builtins.7ngazxi9-cgu.3:(.text.__udivmoddi4+0x0): multiple definition of `__udivmoddi4'
          /tmp/rustc6MME7V/libcompiler_builtins-8ed634fbe62c4d3f.rlib(udivmoddi4.o):udivmoddi4.c:(.text+0x0): first defined here
          /tmp/rustc6MME7V/libcompiler_builtins-8ed634fbe62c4d3f.rlib(compiler_builtins-8ed634fbe62c4d3f.compiler_builtins.7ngazxi9-cgu.3.rcgu.o): In function `__udivmodsi4':
          compiler_builtins.7ngazxi9-cgu.3:(.text.__udivmodsi4+0x0): multiple definition of `__udivmodsi4'
          /tmp/rustc6MME7V/libcompiler_builtins-8ed634fbe62c4d3f.rlib(udivmodsi4.o):(.text+0x0): first defined here
          cc: error: linker command failed with exit code 1 (use -v to see invocation)

with this patch:

--- vendor/compiler_builtins/build.rs.orig      2019-08-29 13:41:16.476024000 +0200
+++ vendor/compiler_builtins/build.rs   2019-08-29 13:41:27.739184000 +0200
@@ -20,6 +20,12 @@ fn main() {
         return;
     }
 
+    if target.contains("freebsd") {
+        println!("cargo:rustc-link-search=native=/usr/lib");
+        println!("cargo:rustc-link-lib=static=compiler_rt");
+        return;
+    }
+
     // Forcibly enable memory intrinsics on wasm32 & SGX as we don't have a libc to
     // provide them.
     if (target.contains("wasm32") && !target.contains("wasi"))

It's only a problem on armv6 (11.2 or 11.3 jail vs 12.0 jail on armv7)

mikael retitled this revision from lang/rust: unbreak on armv6/7 to lang/rust: unbreak on armv6.Aug 29 2019, 11:43 AM
lang/rust/Makefile
113 ↗(On Diff #61284)

They were not extracted until I put the :group keyword. It works with the symlink

In D21415#467709, @mikael.urankar_gmail.com wrote:

Those seem like the wrong links for what was updated in distinfo. What was wrong with the old bootstrap?

lang/rust/Makefile
19 ↗(On Diff #61508)

Please restrict to armv6 if it's only needed there. Something like:

DISTFILES?=	... \
		${DISTFILES_${ARCH}}
DISTFILES_armv6=	compiler_rt...
112 ↗(On Diff #61508)

Wrap in .if ${ARCH} == armv6

mikael edited the summary of this revision. (Show Details)

Those seem like the wrong links for what was updated in distinfo. What was wrong with the old bootstrap?

sigh, I'm doing too many things at once. The current bootstrap is fine (I got problem transferring the *new* bootstrap, they ended up corrupted)

This revision is now accepted and ready to land.Sep 1 2019, 7:23 AM
This revision was automatically updated to reflect the committed changes.