Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions issues/two-checkouts-of-one-tree-build-different-guest-bytes.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,35 @@ into two target directories gave identical ones. The LLVM is held
fixed here: two builds of one LLVM key differing is
`issues/two-builds-of-one-llvm-key-differ-in-their-bytes.md`.

- The kernel carries no path and differs, on both architectures, in nothing
`strings` shows but local symbols' `.llvm.<n>` suffixes, which LLVM derives
from the module's identity: 2362 symbols on x86_64 and 2093 on AArch64.
- `snake` carries no path, and still differs the same way: 203 symbols.
- The kernel carries no path into a checkout and differs, on both
architectures, in nothing `strings` shows but local symbols' `.llvm.<n>`
suffixes, which LLVM derives from the module's identity: 2362 symbols on
x86_64 and 2093 on AArch64.
- `snake` carries no path into the checkout that built it, and still differs
the same way: 203 symbols.
- The bootloader is byte-identical at two paths, on both architectures. It
and the kernel carried each path dependency's absolute source path in their
panic locations while each was its own workspace root; in one workspace
cargo hands rustc every path package's source relative to the root.
- A workspace of its own still does that. 45 of the 100 `test_rs_*` binaries
and `libtls_cranelift.so` on the `testcases` ROOT carry the building
checkout's absolute path: `toyos`'s and `toyos-abi`'s panic locations, and
cranelift-codegen's generated sources under the cdylib's own target
directory.
- Every guest binary carries the path of the checkout that built the sysroot
store's std and C library, not the one building: chiefly the panic
locations of their path dependencies `toyos`, `toyos-abi` and
`toyos-osrelease`. A worktree whose sysroot came from the store carries
another checkout's path. On the `testcases` ROOT that is all 250 ELF
files (23 in each C case, 6 in `fileserver`), and on the `cargo run` ROOT
all 27 programs (6 in `snake`).
- Every guest binary, the kernel and the bootloader carry the cargo home's
absolute path: the panic locations of registry and git dependencies (36 in
`snake`, 7 in the kernel, 40 in the bootloader). Two checkouts on one host
share it; two hosts do not.

`LC_ALL=C grep -a -o "$HOME/" <binary> | wc -l` counts a binary's paths under
the home directory; `snake` gives 42, its 6 and 36.

Nothing remaps either: no `--remap-path-prefix`, no `trim-paths`. Until both
are path-independent a Linux build and a macOS build cannot be compared either,
Expand Down
6 changes: 6 additions & 0 deletions tests/common/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,17 @@ const LINK_FLAGS: &[(&str, &[&str])] = &[
/// Link `objects` into a ToyOS executable through the clang driver — which
/// names `ld.lld` and the sysroot's `libtoyos_c.a`, and makes a PIE — and
/// return its bytes.
///
/// **Without DWARF, and with `.symtab`**, as `[profile.toyos]` links every Rust
/// guest binary: the archive brings its Rust libraries' DWARF into every case
/// and nothing reads it, while `symbolize` and the loader's dlopen binding read
/// `.symtab`.
pub fn link_toyos(objects: &[PathBuf], name: &str) -> Vec<u8> {
let c = c_sysroot();
let out = scratch(name, ".elf");
let output = Command::new(&c.clang)
.args(c.args())
.arg("-Wl,--strip-debug")
.args(objects)
.args(LINK_FLAGS.iter().filter(|(case, _)| *case == name).flat_map(|(_, flags)| flags.iter()))
.arg("-o")
Expand Down
Loading