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

1.15.1 armhf run-make/relocation-model failed, "relocation [..] against `a local symbol' can not be used [..]; recompile with -fPIC" #40145

Open
infinity0 opened this issue Feb 28, 2017 · 4 comments
Labels
C-bug Category: This is a bug. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@infinity0
Copy link
Contributor

Running manually on abel.debian.org:

failures:

---- [run-make] run-make/relocation-model stdout ----



error: make failed
status: exit code: 2
command: "make"
stdout:
------------------------------------------
make[3]: Entering directory '/home/infinity0/rustc/src/test/run-make/relocation-model'
LD_LIBRARY_PATH="/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/test/run-make/relocation-model.stage2-armv7-unknown-linux-gnueabihf:/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib:/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib:/usr/lib/llvm-3.9/lib:" '/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/bin/rustc' --out-dir /home/infinity0/rustc/armv7-unknown-linux-gnueabihf/test/run-make/relocation-model.stage2-armv7-unknown-linux-gnueabihf -L /home/infinity0/rustc/armv7-unknown-linux-gnueabihf/test/run-make/relocation-model.stage2-armv7-unknown-linux-gnueabihf -C link-args=-Wl,-z,relro -C relocation-model=dynamic-no-pic foo.rs
Makefile:4: recipe for target 'all' failed
make[3]: Leaving directory '/home/infinity0/rustc/src/test/run-make/relocation-model'

------------------------------------------
stderr:
------------------------------------------
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/test/run-make/relocation-model.stage2-armv7-unknown-linux-gnueabihf/foo.0.o" "-o" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/test/run-make/relocation-model.stage2-armv7-unknown-linux-gnueabihf/foo" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/test/run-make/relocation-model.stage2-armv7-unknown-linux-gnueabihf" "-L" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libstd-570da8f8.rlib" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/librand-570da8f8.rlib" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libpanic_unwind-570da8f8.rlib" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libcollections-570da8f8.rlib" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/liballoc-570da8f8.rlib" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/liballoc_jemalloc-570da8f8.rlib" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libunwind-570da8f8.rlib" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/liblibc-570da8f8.rlib" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libstd_unicode-570da8f8.rlib" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libcore-570da8f8.rlib" "/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libcompiler_builtins-570da8f8.rlib" "-l" "dl" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "util" "-Wl,-z,relro"
  = note: /usr/bin/ld: /home/infinity0/rustc/armv7-unknown-linux-gnueabihf/test/run-make/relocation-model.stage2-armv7-unknown-linux-gnueabihf/foo.0.o: relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/home/infinity0/rustc/armv7-unknown-linux-gnueabihf/test/run-make/relocation-model.stage2-armv7-unknown-linux-gnueabihf/foo.0.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status


error: aborting due to previous error

make[3]: *** [all] Error 101
@infinity0
Copy link
Contributor Author

The error is triggered by all the executable rules, with relocation-model = {dynamic-no-pic, default, static}.

Building a library with

$(RUSTC) -C relocation-model=dynamic-no-pic --crate-type=dylib foo.rs --emit=link,obj

is the only one that works.

@infinity0
Copy link
Contributor Author

infinity0 commented Mar 2, 2017

$(RUSTC) -C relocation-model=pic foo.rs

also works. However this is weird because src/librustc_back/target/mod.rs says the default model is "pic" but this does not appear to be overridden in armv7_unknown_linux_gnueabihf.rs, yet relocation-model=default fails. Perhaps this is #35061 ?

Various other resources such as 1 and 2 suggest to me that non-PIC code is not expected to work on ARMv7, but I don't really know the details to judge this for sure. I will ignore the test for now on Debian.

@arielb1 arielb1 added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 16, 2017
@sanxiyn sanxiyn added the O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state label Jun 8, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 27, 2017
@siriux
Copy link

siriux commented Jan 18, 2018

I have similar problems working on android with armv7:

android-rs-glue/examples/basic/target/armv7-linux-androideabi/debug/deps/example-5e3c12e16b8a2e10.example2.rcgu.o: requires unsupported dynamic reloc R_ARM_THM_MOVW_ABS_NC; recompile with -fPIC

@steveklabnik
Copy link
Member

Triage: has anyone seen this error since 2018? Any way to reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants