{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/51535","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/51535/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/51535/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/51535/events","html_url":"https://github.com/rust-lang/rust/issues/51535","id":331975984,"node_id":"MDU6SXNzdWUzMzE5NzU5ODQ=","number":51535,"title":"Compilation for mips64-unknown-linux-gnu","user":{"login":"operutka","id":1826328,"node_id":"MDQ6VXNlcjE4MjYzMjg=","avatar_url":"https://avatars1.githubusercontent.com/u/1826328?v=4","gravatar_id":"","url":"https://api.github.com/users/operutka","html_url":"https://github.com/operutka","followers_url":"https://api.github.com/users/operutka/followers","following_url":"https://api.github.com/users/operutka/following{/other_user}","gists_url":"https://api.github.com/users/operutka/gists{/gist_id}","starred_url":"https://api.github.com/users/operutka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/operutka/subscriptions","organizations_url":"https://api.github.com/users/operutka/orgs","repos_url":"https://api.github.com/users/operutka/repos","events_url":"https://api.github.com/users/operutka/events{/privacy}","received_events_url":"https://api.github.com/users/operutka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-13T12:38:16Z","updated_at":"2018-06-13T16:43:51Z","closed_at":null,"author_association":"NONE","body":"I'm trying to compile the `std` crate using a custom target specification for `mips64-unknown-linux-gnu`. I've got stuck a little and I'd appreciate a little help. My specification is a copy of the built-in specification for `mips64-unknown-linux-gnuabi64` with the following differences:\r\n\r\n1. The `data-layout` field has been changed to match the data layout used in clang for the same target.\r\n2. The `is-builtin` field has been set to `false`.\r\n3. The `llvm-target` field has been set to `mips64-unknown-linux-gnu`.\r\n4. The `max-atomic-width` field has been set to `32` (it was `64` before).\r\n5. The `target-pointer-width` field has been set to `32` to match the data layout.\r\n\r\nThis is the whole target specification:\r\n```\r\n{\r\n  \"arch\": \"mips64\",\r\n  \"cpu\": \"mips64r2\",\r\n  \"data-layout\": \"E-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128\",\r\n  \"dynamic-linking\": true,\r\n  \"env\": \"gnu\",\r\n  \"executables\": true,\r\n  \"features\": \"+mips64r2\",\r\n  \"has-elf-tls\": true,\r\n  \"has-rpath\": true,\r\n  \"is-builtin\": false,\r\n  \"linker-flavor\": \"gcc\",\r\n  \"linker-is-gnu\": true,\r\n  \"llvm-target\": \"mips64-unknown-linux-gnu\",\r\n  \"max-atomic-width\": 32,\r\n  \"os\": \"linux\",\r\n  \"position-independent-executables\": true,\r\n  \"pre-link-args\": {\r\n    \"gcc\": [\r\n      \"-Wl,--as-needed\",\r\n      \"-Wl,-z,noexecstack\"\r\n    ]\r\n  },\r\n  \"relro-level\": \"full\",\r\n  \"target-c-int-width\": \"32\",\r\n  \"target-endian\": \"big\",\r\n  \"target-family\": \"unix\",\r\n  \"target-pointer-width\": \"32\",\r\n  \"vendor\": \"unknown\"\r\n}\r\n```\r\n\r\nI end up with the following output:\r\n```\r\n   Compiling compiler_builtins v0.0.0 (file:///root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/rustc/compiler_builtins_shim)\r\n   Compiling std v0.0.0 (file:///root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd)\r\n     Running `rustc --crate-name build_script_build /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/rustc/compiler_builtins_shim/../../libcompiler_builtins/build.rs --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature=\"c\"' --cfg 'feature=\"compiler-builtins\"' --cfg 'feature=\"default\"' --cfg 'feature=\"rustbuild\"' -C metadata=90fbb7fd0c7442d5 -C extra-filename=-90fbb7fd0c7442d5 --out-dir /tmp/xargo.606pX8cxT6GH/target/release/build/compiler_builtins-90fbb7fd0c7442d5 -L dependency=/tmp/xargo.606pX8cxT6GH/target/release/deps --extern cc=/tmp/xargo.606pX8cxT6GH/target/release/deps/libcc-786ac8d380309a5a.rlib`\r\n     Running `rustc --crate-name build_script_build /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/build.rs --crate-type bin --emit=dep-info,link -C opt-level=3 -C metadata=0e769dbdf5eed459 -C extra-filename=-0e769dbdf5eed459 --out-dir /tmp/xargo.606pX8cxT6GH/target/release/build/std-0e769dbdf5eed459 -L dependency=/tmp/xargo.606pX8cxT6GH/target/release/deps --extern build_helper=/tmp/xargo.606pX8cxT6GH/target/release/deps/libbuild_helper-ca4cc909bb4adcb1.rlib --extern cc=/tmp/xargo.606pX8cxT6GH/target/release/deps/libcc-786ac8d380309a5a.rlib`\r\n     Running `/tmp/xargo.606pX8cxT6GH/target/release/build/std-0e769dbdf5eed459/build-script-build`\r\n     Running `/tmp/xargo.606pX8cxT6GH/target/release/build/compiler_builtins-90fbb7fd0c7442d5/build-script-build`\r\nwarning: ../../libcompiler_builtins/compiler-rt/lib/builtins/divdc3.c:21:1: warning: conflicting types for built-in function '__divdc3'\r\nwarning:  __divdc3(double __a, double __b, double __c, double __d)\r\nwarning:  ^\r\nwarning: ../../libcompiler_builtins/compiler-rt/lib/builtins/divsc3.c:21:1: warning: conflicting types for built-in function '__divsc3'\r\nwarning:  __divsc3(float __a, float __b, float __c, float __d)\r\nwarning:  ^\r\nwarning: ../../libcompiler_builtins/compiler-rt/lib/builtins/muldc3.c:21:1: warning: conflicting types for built-in function '__muldc3'\r\nwarning:  __muldc3(double __a, double __b, double __c, double __d)\r\nwarning:  ^\r\nwarning: ../../libcompiler_builtins/compiler-rt/lib/builtins/mulsc3.c:21:1: warning: conflicting types for built-in function '__mulsc3'\r\nwarning:  __mulsc3(float __a, float __b, float __c, float __d)\r\nwarning:  ^\r\nLLVM ERROR: Not supported instr: <MCInst 0 <MCOperand Reg:416> <MCOperand Reg:321>>\r\nerror: Could not compile `core`.\r\n\r\nCaused by:\r\n  process didn't exit successfully: `rustc --crate-name core /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C metadata=59ab99930ed6da97 -C extra-filename=-59ab99930ed6da97 --out-dir /tmp/xargo.606pX8cxT6GH/target/mips64-unknown-linux-gnu/release/deps --target mips64-unknown-linux-gnu -C ar=mips64-buildroot-linux-gnu-ar -C linker=mips64-buildroot-linux-gnu-gcc -L dependency=/tmp/xargo.606pX8cxT6GH/target/mips64-unknown-linux-gnu/release/deps -L dependency=/tmp/xargo.606pX8cxT6GH/target/release/deps --sysroot /root/.xargo -Z force-unstable-if-unmarked` (exit code: 1)\r\nerror: `\"cargo\" \"build\" \"--release\" \"--manifest-path\" \"/tmp/xargo.606pX8cxT6GH/Cargo.toml\" \"--target\" \"mips64-unknown-linux-gnu\" \"-v\" \"-p\" \"std\"` failed with exit code: Some(101)\r\nnote: run with `RUST_BACKTRACE=1` for a backtrace\r\n```\r\n\r\nThe reason why I'm trying this is that I have an existing Debian system with this target (it's Ubiquiti EdgeRouter) and I'd like to compile a Rust application for this system. It's a big endian MIPS64 system with n32 ABI. Unfortunately, Rust supports only n64."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/397006464","html_url":"https://github.com/rust-lang/rust/issues/51535#issuecomment-397006464","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/51535","id":397006464,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzAwNjQ2NA==","user":{"login":"draganmladjenovic","id":37329008,"node_id":"MDQ6VXNlcjM3MzI5MDA4","avatar_url":"https://avatars0.githubusercontent.com/u/37329008?v=4","gravatar_id":"","url":"https://api.github.com/users/draganmladjenovic","html_url":"https://github.com/draganmladjenovic","followers_url":"https://api.github.com/users/draganmladjenovic/followers","following_url":"https://api.github.com/users/draganmladjenovic/following{/other_user}","gists_url":"https://api.github.com/users/draganmladjenovic/gists{/gist_id}","starred_url":"https://api.github.com/users/draganmladjenovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/draganmladjenovic/subscriptions","organizations_url":"https://api.github.com/users/draganmladjenovic/orgs","repos_url":"https://api.github.com/users/draganmladjenovic/repos","events_url":"https://api.github.com/users/draganmladjenovic/events{/privacy}","received_events_url":"https://api.github.com/users/draganmladjenovic/received_events","type":"User","site_admin":false},"created_at":"2018-06-13T16:43:51Z","updated_at":"2018-06-13T16:43:51Z","author_association":"CONTRIBUTOR","body":"I haven't tried to reproduce this issue yet, but only json specification won't work. You need somehow to pass ABI information akin to clang/llc's \"-mabi=n32\" to the LLVM backend because MIPS target can't infer n32 ABI from the target triple and arch alone."}}
{"actor":{"display_login":"draganmladjenovic"}}