Repository: rust
Issue: Support for the armv7l-unknown-linux-gnueabi platform
Labels: O-Arm,C-bug

Hello,

I am on the Raspberry Pi 4 board with the Slackware ARM 14.2 operating system.
This platform is: ```armv7l-unknown-linux-gnueabi```.
So, I downloaded:
- https://static.rust-lang.org/dist/rustc-1.43.1-src.tar.xz
- https://static.rust-lang.org/dist/rustc-1.43.1-arm-unknown-linux-gnueabi.tar.xz
- https://static.rust-lang.org/dist/cargo-0.43.0-arm-unknown-linux-gnueabi.tar.xz
- https://static.rust-lang.org/dist/rust-std-1.43.1-arm-unknown-linux-gnueabi.tar.xz

And here is what happens when I try to build rustc:
```
$ tar xf rustc-1.43.1-src.tar.xz                                                                                            
$ tar -C rustc-1.43.1-src --strip=1 -xf rustc-1.43.1-arm-unknown-linux-gnueabi.tar.xz rustc-1.43.1-arm-unknown-linux-gnueabi/rustc  
$ tar -C rustc-1.43.1-src/rustc --strip=2 -xf cargo-0.43.0-arm-unknown-linux-gnueabi.tar.xz cargo-0.43.0-arm-unknown-linux-gnueabi/cargo/bin/cargo            
$ tar -C rustc-1.43.1-src/rustc --strip=2 -xf rust-std-1.43.1-arm-unknown-linux-gnueabi.tar.xz rust-std-1.43.1-arm-unknown-linux-gnueabi/rust-std-arm-unknown-linux-gnueabi/lib                                             
$ export PATH="${PWD}/rustc-1.43.1-src/rustc/bin:${PATH}"
$ cd rustc-1.43.1-src
$ CFLAGS="-O2 -march=armv8-a -mtune=cortex-a53 -mfloat-abi=softfp -mfpu=neon-vfpv4" CXXFLAGS="-O2 -march=armv8-a -mtune=cortex-a53 -mfloat-abi=softfp -mfpu=neon-vfpv4" ./configure --prefix=/usr --libdir=/usr/lib --enable-local-rust                                  
configure: processing command line
configure: 
configure: install.prefix       := /usr
configure: install.libdir       := /usr/lib
configure: build.rustc          := /tmp/build/firefox/rustc-1.43.1-src/rustc/bin/ ...
configure: build.cargo          := /tmp/build/firefox/rustc-1.43.1-src/rustc/bin/ ...
configure: build.configure-args := ['--prefix=/usr', '--libdir=/usr/lib', '--enab ...
configure: 
configure: writing `config.toml` in current directory
configure: 
configure: run `python /tmp/build/firefox/rustc-1.43.1-src/x.py --help`
configure: 
$ make -j 4
   Compiling proc-macro2 v0.4.30
   Compiling unicode-xid v0.1.0
   Compiling lazy_static v1.4.0
   Compiling memchr v2.3.2
   Compiling syn v0.15.35
   Compiling cfg-if v0.1.10
   Compiling libc v0.2.66
   Compiling autocfg v0.1.7
   Compiling regex v1.1.6
   Compiling ucd-util v0.1.3
   Compiling log v0.4.8
   Compiling serde v1.0.99
   Compiling utf8-ranges v1.0.2
   Compiling ryu v1.0.0
   Compiling fnv v1.0.6
   Compiling same-file v1.0.4
   Compiling cc v1.0.50
   Compiling itoa v0.4.4
   Compiling unicode-width v0.1.6
   Compiling build_helper v0.1.0 (/tmp/build/firefox/rustc-1.43.1-src/src/build_helper)
   Compiling thread_local v0.3.6
   Compiling thread_local v1.0.1
   Compiling regex-syntax v0.6.6
   Compiling crossbeam-utils v0.7.0
   Compiling walkdir v2.2.7
   Compiling cmake v0.1.42
   Compiling getopts v0.2.21
   Compiling aho-corasick v0.7.3
   Compiling bstr v0.1.3
   Compiling quote v0.6.12
   Compiling time v0.1.42
   Compiling filetime v0.2.8
   Compiling num_cpus v1.10.1
   Compiling crossbeam-channel v0.4.0
   Compiling globset v0.4.3
   Compiling ignore v0.4.11
   Compiling serde_derive v1.0.81
   Compiling serde_json v1.0.40
   Compiling toml v0.5.3
   Compiling bootstrap v0.0.0 (/tmp/build/firefox/rustc-1.43.1-src/src/bootstrap)
    Finished dev [unoptimized] target(s) in 5m 47s
Building stage0 std artifacts (armv7-unknown-linux-gnueabihf -> armv7-unknown-linux-gnueabihf)
warning: config profiles require the `-Z config-profile` command-line option (found profile `release` in environment variable `CARGO_PROFILE_RELEASE`)
   Compiling cc v1.0.50
   Compiling core v0.0.0 (/tmp/build/firefox/rustc-1.43.1-src/src/libcore)
   Compiling libc v0.2.66
   Compiling autocfg v0.1.7
error: could not compile `libc`.

Caused by:
  process didn't exit successfully: `/tmp/build/firefox/rustc-1.43.1-src/build/bootstrap/debug/rustc --crate-name build_script_build /home/yugiohjcj/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.66/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="align"' --cfg 'feature="rustc-dep-of-std"' --cfg 'feature="rustc-std-workspace-core"' -C metadata=f36d1b32dec4e3d4 -C extra-filename=-f36d1b32dec4e3d4 --out-dir /tmp/build/firefox/rustc-1.43.1-src/build/armv7-unknown-linux-gnueabihf/stage0-std/release/build/libc-f36d1b32dec4e3d4 -L dependency=/tmp/build/firefox/rustc-1.43.1-src/build/armv7-unknown-linux-gnueabihf/stage0-std/release/deps --cap-lints allow -Zbinary-dep-depinfo` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
error: could not compile `autocfg`.

Caused by:
  process didn't exit successfully: `/tmp/build/firefox/rustc-1.43.1-src/build/bootstrap/debug/rustc --crate-name autocfg /home/yugiohjcj/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-0.1.7/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=81380527f284506a -C extra-filename=-81380527f284506a --out-dir /tmp/build/firefox/rustc-1.43.1-src/build/armv7-unknown-linux-gnueabihf/stage0-std/release/deps -L dependency=/tmp/build/firefox/rustc-1.43.1-src/build/armv7-unknown-linux-gnueabihf/stage0-std/release/deps --cap-lints allow -Zbinary-dep-depinfo` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
error: failed to prepare thin LTO module: file doesn't start with bitcode header

error: aborting due to previous error

error: could not compile `cc`.
warning: build failed, waiting for other jobs to finish...
error: could not compile `core`.

Caused by:
  process didn't exit successfully: `/tmp/build/firefox/rustc-1.43.1-src/build/bootstrap/debug/rustc --crate-name core --edition=2018 src/libcore/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=cb92643d31cc5d69 -C extra-filename=-cb92643d31cc5d69 --out-dir /tmp/build/firefox/rustc-1.43.1-src/build/armv7-unknown-linux-gnueabihf/stage0-std/armv7-unknown-linux-gnueabihf/release/deps --target armv7-unknown-linux-gnueabihf -L dependency=/tmp/build/firefox/rustc-1.43.1-src/build/armv7-unknown-linux-gnueabihf/stage0-std/armv7-unknown-linux-gnueabihf/release/deps -L dependency=/tmp/build/firefox/rustc-1.43.1-src/build/armv7-unknown-linux-gnueabihf/stage0-std/release/deps -Zmacro-backtrace '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Wrust_2018_idioms -Wunused_lifetimes -Dwarnings -Cprefer-dynamic -Zbinary-dep-depinfo` (signal: 11, SIGSEGV: invalid memory reference)
command did not execute successfully: "/tmp/build/firefox/rustc-1.43.1-src/rustc/bin/cargo" "build" "--target" "armv7-unknown-linux-gnueabihf" "-Zbinary-dep-depinfo" "-j" "4" "--release" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/tmp/build/firefox/rustc-1.43.1-src/src/libtest/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
failed to run: /tmp/build/firefox/rustc-1.43.1-src/build/bootstrap/debug/bootstrap build
Build completed unsuccessfully in 0:06:53
Makefile:18: recipe for target 'all' failed
make: *** [all] Error 1
```

During the build process, I think that the problem comes from this line:
```
Building stage0 std artifacts (armv7-unknown-linux-gnueabihf -> armv7-unknown-linux-gnueabihf)
```
I don't know why but the `armv7-unknown-linux-gnueabihf` platform is automatically selected at this point whereas it should be `armv7l-unknown-linux-gnueabi` (or eventually `arm-unknown-linux-gnueabi`).

Do you know how can I fix that please?

Thank you.
Best regards.

Edit: I also tested with ```--build=arm-unknown-linux-gnueabi --host=arm-unknown-linux-gnueabi --target=arm-unknown-linux-gnueabi``` and now the platform is selected manually and not guessed automatically, but the build is still a failure:
```
$ tar xf rustc-1.43.1-src.tar.xz                                                                                            
$ tar -C rustc-1.43.1-src --strip=1 -xf rustc-1.43.1-arm-unknown-linux-gnueabi.tar.xz rustc-1.43.1-arm-unknown-linux-gnueabi/rustc  
$ tar -C rustc-1.43.1-src/rustc --strip=2 -xf cargo-0.43.0-arm-unknown-linux-gnueabi.tar.xz cargo-0.43.0-arm-unknown-linux-gnueabi/cargo/bin/cargo            
$ tar -C rustc-1.43.1-src/rustc --strip=2 -xf rust-std-1.43.1-arm-unknown-linux-gnueabi.tar.xz rust-std-1.43.1-arm-unknown-linux-gnueabi/rust-std-arm-unknown-linux-gnueabi/lib                                             
$ export PATH="${PWD}/rustc-1.43.1-src/rustc/bin:${PATH}"
$ cd rustc-1.43.1-src
$ CFLAGS="-O2 -march=armv8-a -mtune=cortex-a53 -mfloat-abi=softfp -mfpu=neon-vfpv4" CXXFLAGS="-O2 -march=armv8-a -mtune=cortex-a53 -mfloat-abi=softfp -mfpu=neon-vfpv4" ./configure --prefix=/usr --libdir=/usr/lib --enable-local-rust --build=arm-unknown-linux-gnueabi --host=arm-unknown-linux-gnueabi --target=arm-unknown-linux-gnueabi
configure: processing command line
configure: 
configure: build.target         := ['arm-unknown-linux-gnueabi']
configure: install.libdir       := /usr/lib
configure: install.prefix       := /usr
configure: build.host           := ['arm-unknown-linux-gnueabi']
configure: build.build          := arm-unknown-linux-gnueabi
configure: build.rustc          := /tmp/build/firefox/rustc-1.43.1-src/rustc/bin/ ...
configure: build.cargo          := /tmp/build/firefox/rustc-1.43.1-src/rustc/bin/ ...
configure: build.configure-args := ['--prefix=/usr', '--libdir=/usr/lib', '--enab ...
configure: 
configure: writing `config.toml` in current directory
configure: 
configure: run `python /tmp/build/firefox/rustc-1.43.1-src/x.py --help`
$ make -j 4
   Compiling proc-macro2 v0.4.30
   Compiling unicode-xid v0.1.0
   Compiling memchr v2.3.2
   Compiling lazy_static v1.4.0
   Compiling syn v0.15.35
   Compiling cfg-if v0.1.10
   Compiling autocfg v0.1.7
   Compiling libc v0.2.66
   Compiling serde v1.0.99
   Compiling regex v1.1.6
   Compiling log v0.4.8
   Compiling ucd-util v0.1.3
   Compiling ryu v1.0.0
   Compiling utf8-ranges v1.0.2
   Compiling same-file v1.0.4
   Compiling fnv v1.0.6
   Compiling itoa v0.4.4
   Compiling unicode-width v0.1.6
   Compiling cc v1.0.50
   Compiling build_helper v0.1.0 (/tmp/build/firefox/rustc-1.43.1-src/src/build_helper)
   Compiling thread_local v0.3.6
   Compiling thread_local v1.0.1
   Compiling crossbeam-utils v0.7.0
   Compiling regex-syntax v0.6.6
   Compiling walkdir v2.2.7
   Compiling getopts v0.2.21
   Compiling cmake v0.1.42
   Compiling aho-corasick v0.7.3
   Compiling bstr v0.1.3
   Compiling quote v0.6.12
   Compiling filetime v0.2.8
   Compiling num_cpus v1.10.1
   Compiling time v0.1.42
   Compiling crossbeam-channel v0.4.0
   Compiling globset v0.4.3
   Compiling ignore v0.4.11
   Compiling serde_derive v1.0.81
   Compiling serde_json v1.0.40
   Compiling toml v0.5.3
   Compiling bootstrap v0.0.0 (/tmp/build/firefox/rustc-1.43.1-src/src/bootstrap)
    Finished dev [unoptimized] target(s) in 7m 58s
Building stage0 std artifacts (arm-unknown-linux-gnueabi -> arm-unknown-linux-gnueabi)
warning: config profiles require the `-Z config-profile` command-line option (found profile `release` in environment variable `CARGO_PROFILE_RELEASE`)
   Compiling cc v1.0.50
   Compiling core v0.0.0 (/tmp/build/firefox/rustc-1.43.1-src/src/libcore)
   Compiling libc v0.2.66
   Compiling autocfg v0.1.7
error: could not compile `libc`.

Caused by:
  process didn't exit successfully: `/tmp/build/firefox/rustc-1.43.1-src/build/bootstrap/debug/rustc --crate-name build_script_build /home/yugiohjcj/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.66/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="align"' --cfg 'feature="rustc-dep-of-std"' --cfg 'feature="rustc-std-workspace-core"' -C metadata=f36d1b32dec4e3d4 -C extra-filename=-f36d1b32dec4e3d4 --out-dir /tmp/build/firefox/rustc-1.43.1-src/build/arm-unknown-linux-gnueabi/stage0-std/release/build/libc-f36d1b32dec4e3d4 -L dependency=/tmp/build/firefox/rustc-1.43.1-src/build/arm-unknown-linux-gnueabi/stage0-std/release/deps --cap-lints allow -Zbinary-dep-depinfo` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
error: could not compile `autocfg`.

Caused by:
  process didn't exit successfully: `/tmp/build/firefox/rustc-1.43.1-src/build/bootstrap/debug/rustc --crate-name autocfg /home/yugiohjcj/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-0.1.7/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=81380527f284506a -C extra-filename=-81380527f284506a --out-dir /tmp/build/firefox/rustc-1.43.1-src/build/arm-unknown-linux-gnueabi/stage0-std/release/deps -L dependency=/tmp/build/firefox/rustc-1.43.1-src/build/arm-unknown-linux-gnueabi/stage0-std/release/deps --cap-lints allow -Zbinary-dep-depinfo` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
error: failed to prepare thin LTO module: file doesn't start with bitcode header

error: aborting due to previous error

error: could not compile `cc`.
warning: build failed, waiting for other jobs to finish...
error: could not compile `core`.

Caused by:
  process didn't exit successfully: `/tmp/build/firefox/rustc-1.43.1-src/build/bootstrap/debug/rustc --crate-name core --edition=2018 src/libcore/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=173bec4aef4c7110 -C extra-filename=-173bec4aef4c7110 --out-dir /tmp/build/firefox/rustc-1.43.1-src/build/arm-unknown-linux-gnueabi/stage0-std/arm-unknown-linux-gnueabi/release/deps --target arm-unknown-linux-gnueabi -L dependency=/tmp/build/firefox/rustc-1.43.1-src/build/arm-unknown-linux-gnueabi/stage0-std/arm-unknown-linux-gnueabi/release/deps -L dependency=/tmp/build/firefox/rustc-1.43.1-src/build/arm-unknown-linux-gnueabi/stage0-std/release/deps -Zmacro-backtrace '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Wrust_2018_idioms -Wunused_lifetimes -Dwarnings -Cprefer-dynamic -Zbinary-dep-depinfo` (signal: 11, SIGSEGV: invalid memory reference)
command did not execute successfully: "/tmp/build/firefox/rustc-1.43.1-src/rustc/bin/cargo" "build" "--target" "arm-unknown-linux-gnueabi" "-Zbinary-dep-depinfo" "-j" "4" "--release" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/tmp/build/firefox/rustc-1.43.1-src/src/libtest/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
failed to run: /tmp/build/firefox/rustc-1.43.1-src/build/bootstrap/debug/bootstrap build
Build completed unsuccessfully in 0:10:39
Makefile:18: recipe for target 'all' failed
make: *** [all] Error 1
```