Hello Alex,

I found a few below listed deviations in Yocto's (with rust recipe) build 
environment w.r.t 'rust' (rust cloned from github) build environment. Do you 
know why these deviations in Yocto's rust linker?


Thanks,
Sundeep K.
________________________________
From: Kokkonda, Sundeep
Sent: 03 January 2023 21:29
To: [email protected] <[email protected]>
Cc: MacLeod, Randy <[email protected]>; Moodalappa, Shivaprasad 
<[email protected]>
Subject: Bug 14875 - reproducibility issue queries

Hello Richard,

On the rust reproducibility issue, as we discussed I tried to compile the libs 
outside of Yocto to generate the lib.

  *   I took the compiler command of a crate from the 'bitbake -vv rust' log 
(refer attached file), but the compilation shows several errors...
     *   (Eg. missing ofenv variables RUSTC_STAGE, RUSTC_SYSROOT, 
RUSTC_SNAPSHOT, RUSTC_SNAPSHOT_LIBDIR, RUSTC_REAL, RUSTC_LIBDIR... I read all 
env vars during Yocto rust execution but the env list doesn't show any of these 
vars. Somehow, I exported these vars but the build shows other errors from *.rs 
source files).
     *   Is it the way you want me to do?

Since the --remap-path-prefix cmd is passed during compilation, I suspect the 
issue is not with compiler and tried below alternate methods to find the issue 
and have some queries... It'll be helpful if you've any inputs on below 
points...

  *   Since the librustc_driver*.so binary differed in '.rustc' linker section, 
I disassembled all generated objects (including the objects in .rlib libraries) 
to identify from which object the assembly difference is coming. But, in any of 
these disassembled files the '.rustc' section is not present. Could not find 
any linker script which groups some input sections to .rustc output section. I 
suspect there is 'link.rs' file which is making this linker section, going 
through the code...

  *
  *   I found a difference in linking of libs in Yocto project when compared to 
normal rust environment. In rust, there is no linker flag '-C linker' is 
passed,  but Yocto uses below extra linker parameters. Maybe we are linking 
objects differently than rust used linker?
-C 
linker=/home/skokkonda/yocto/poky/buildA/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/wrapper/build-rust-ccld
-L 
native=/home/skokkonda/yocto/poky/buildA/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/recipe-sysroot-native/usr/lib/llvm-rust/lib
-L 
native=/home/skokkonda/yocto/poky/buildA/tmp/work/x86_64-linux/rust-llvm-native/1.66.0-r0/recipe-sysroot-native/usr/lib
-L 
native=/home/skokkonda/yocto/poky/buildA/tmp/work/x86_64-linux/rust-llvm-native/1.66.0-r0/recipe-sysroot-native/lib

  *   In rust, the librustc_driver*.so is generated during stage-0 and the same 
lib copied to stage-2 output. But, as per Yocto build log shows 
librustc_driver*.so is re-generated at every build stage.


Thanks,
Sundeep K.
/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/bootstrap/debug/rustc
 --crate-name rustc_driver --edition=2021 compiler/rustc_driver/src/lib.rs 
--error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat 
--crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=3 -C 
embed-bitcode=no -C debuginfo=0 --cfg 'feature="llvm"' --cfg 
'feature="max_level_info"' -Zunstable-options --check-cfg 'values(feature, 
"llvm", "max_level_info", "rustc_use_parallel_compiler")' --check-cfg 'names()' 
--check-cfg 'values()' -C metadata=57e0e8edc43843ff -C 
extra-filename=-57e0e8edc43843ff --out-dir 
/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps
 --target x86_64-unknown-linux-gnu -C 
linker=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/wrapper/build-rust-ccld
 -L 
dependency=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps
 -L 
dependency=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps
 --extern 
libc=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblibc-6d755c2f87544663.rlib
 --extern 
rustc_ast=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_ast-28599f0594f6a031.rlib
 --extern 
rustc_ast_pretty=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_ast_pretty-3f0b3703dc24a1a2.rlib
 --extern 
rustc_codegen_ssa=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_codegen_ssa-3c6ebd1be6f4d6df.rlib
 --extern 
rustc_data_structures=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-f7d6c433088cd025.rlib
 --extern 
rustc_error_codes=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_error_codes-1bfdaa8f1a4d1987.rlib
 --extern 
rustc_errors=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-8c06a11779e8c75a.rlib
 --extern 
rustc_feature=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_feature-2b2e5da5b80587d5.rlib
 --extern 
rustc_hir=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_hir-2405ba281f873dc8.rlib
 --extern 
rustc_hir_analysis=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_hir_analysis-ad10e66499b616df.rlib
 --extern 
rustc_hir_pretty=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_hir_pretty-bcc6ea47782dd931.rlib
 --extern 
rustc_interface=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_interface-8de16a7eb9848da1.rlib
 --extern 
rustc_lint=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_lint-bc10e8ce936a1bde.rlib
 --extern 
rustc_log=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_log-70150cbfd1683d97.rlib
 --extern 
rustc_macros=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps/librustc_macros-a4847fc9c3d895c5.so
 --extern 
rustc_metadata=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_metadata-16080f37d1fff8bf.rlib
 --extern 
rustc_middle=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_middle-80657e886757b325.rlib
 --extern 
rustc_parse=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_parse-792c5007df1de001.rlib
 --extern 
rustc_plugin_impl=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_plugin_impl-842a47b1bc4d3ef5.rlib
 --extern 
rustc_save_analysis=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_save_analysis-823e21b4e5992f77.rlib
 --extern 
rustc_session=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_session-4346cf9ff6002250.rlib
 --extern 
rustc_span=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_span-3655b9365db9bd50.rlib
 --extern 
rustc_target=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-7a5295d33774d964.rlib
 --extern 
serde_json=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserde_json-99cd803bd2485b49.rlib
 --extern 
tracing=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libtracing-4acc35a76daadec7.rlib
 
--remap-path-prefix=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0=/usr/src/debug/rust/1.66.0-r0
 --cfg=bootstrap -Csymbol-mangling-version=v0 -Zunstable-options 
'--check-cfg=values(bootstrap)' '--check-cfg=values(parallel_compiler)' 
'--check-cfg=values(no_btreemap_remove_entry)' 
'--check-cfg=values(crossbeam_loom)' '--check-cfg=values(span_locations)' 
'--check-cfg=values(rustix_use_libc)' -Zmacro-backtrace 
-Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' 
-Csplit-debuginfo=off -Zunstable-options '-Wrustc::internal' -Cprefer-dynamic 
-Z binary-dep-depinfo -L 
native=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/psm-e90b4138a9c9874e/out
 -L 
native=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/rustc_llvm-51c7e7bf747c4e76/out
 -L 
native=/poky/build/tmp/work/core2-64-poky-linux/rust/1.66.0-r0/recipe-sysroot-native/usr/lib/llvm-rust/lib
 -L 
native=/poky/build/tmp/work/x86_64-linux/rust-llvm-native/1.66.0-r0/recipe-sysroot-native/usr/lib
 -L 
native=/poky/build/tmp/work/x86_64-linux/rust-llvm-native/1.66.0-r0/recipe-sysroot-native/lib
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#175668): 
https://lists.openembedded.org/g/openembedded-core/message/175668
Mute This Topic: https://lists.openembedded.org/mt/96147825/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to