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

Linking failures #88

Closed
bnaecker opened this issue Mar 26, 2022 · 10 comments
Closed

Linking failures #88

bnaecker opened this issue Mar 26, 2022 · 10 comments
Assignees

Comments

@bnaecker
Copy link
Contributor

When using opteadm as a Git dependency in a project's Cargo.toml, we get linking errors. Things seem to work fine if the dependency is specified as a local, path-dependency. To reproduce, create a new binary:

$ cargo new --bin tst

With a Cargo.toml that looks like this:

[package]
name = "tst"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
opteadm = { git = "https://github.com/oxidecomputer/opte" }

I have the following minimal binary, in `src/main.rs:

fn main() {
    let _ = opteadm::OpteAdm::open(opteadm::OpteAdm::DLD_CTL).unwrap();
}

Running the package's binary fails at link:

bnaecker@feldspar : ~/tst $ cargo +nightly run
   Compiling tst v0.1.0 (/home/bnaecker/tst)
error: linking with `gcc` failed: exit status: 1
  |
  = note: "gcc" "-m64" "-std=c99" "/home/bnaecker/tst/target/debug/deps/tst-9d56c2ce4c177f1f.1gpqo5y6xwwh5ghs.rcgu.o" "/home/bnaecker/tst/target/debug/deps/tst-9d56c2ce4c177f1f.2j9b0easpuy3lmkm.rcgu.o" "/home/bnaecker/tst/target/debug/deps/tst-9d56c2ce4c177f1f.3gn43d55b54eesvf.rcgu.o" "/home/bnaecker/tst/target/debug/deps/tst-9d56c2ce4c177f1f.4au4nef3u6uykb3q.rcgu.o" "/home/bnaecker/tst/target/debug/deps/tst-9d56c2ce4c177f1f.4mo6zhonh6hibyme.rcgu.o" "/home/bnaecker/tst/target/debug/deps/tst-9d56c2ce4c177f1f.50oco8jau4nggglf.rcgu.o" "/home/bnaecker/tst/target/debug/deps/tst-9d56c2ce4c177f1f.a259uc1t2xr6vh4.rcgu.o" "/home/bnaecker/tst/target/debug/deps/tst-9d56c2ce4c177f1f.2xbcavjzg20r3tv7.rcgu.o" "-Wl,-z,ignore" "-L" "/home/bnaecker/tst/target/debug/deps" "-L" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib" "-Wl,-Bstatic" "/home/bnaecker/tst/target/debug/deps/libopteadm-ed4ebec202f4ac04.rlib" "/home/bnaecker/tst/target/debug/deps/liblibnet-20746b65a0c1aa47.rlib" "/home/bnaecker/tst/target/debug/deps/libnvpair-86698e07c8e6b879.rlib" "/home/bnaecker/tst/target/debug/deps/libnvpair_sys-3e491215f55562c3.rlib" "/home/bnaecker/tst/target/debug/deps/libforeign_types-f6b5afca31338a66.rlib" "/home/bnaecker/tst/target/debug/deps/libforeign_types_shared-984e5c51ce0f0c58.rlib" "/home/bnaecker/tst/target/debug/deps/libcstr_argument-785ee624af9de0c7.rlib" "/home/bnaecker/tst/target/debug/deps/libdlpi-f4fb8d05033217fb.rlib" "/home/bnaecker/tst/target/debug/deps/libnum_enum-a64b76e4a2b44370.rlib" "/home/bnaecker/tst/target/debug/deps/libsocket2-3b283ba9cd497e9e.rlib" "/home/bnaecker/tst/target/debug/deps/librusty_doors-524916c6b781492a.rlib" "/home/bnaecker/tst/target/debug/deps/libtracing-1c68e7f070b67704.rlib" "/home/bnaecker/tst/target/debug/deps/libcfg_if-385d26aca7d14e58.rlib" "/home/bnaecker/tst/target/debug/deps/libpin_project_lite-e8973c22a90577a2.rlib" "/home/bnaecker/tst/target/debug/deps/libtracing_core-50fa0fee84c6871d.rlib" "/home/bnaecker/tst/target/debug/deps/libcolored-9ea2386075d15489.rlib" "/home/bnaecker/tst/target/debug/deps/liblazy_static-caa99a9868af65b8.rlib" "/home/bnaecker/tst/target/debug/deps/libatty-217d37554bdf695c.rlib" "/home/bnaecker/tst/target/debug/deps/libopte_core-a9eafd55fd492016.rlib" "/home/bnaecker/tst/target/debug/deps/libanymap-94932fbd822a3e35.rlib" "/home/bnaecker/tst/target/debug/deps/libhashbrown-3ee81738fb11b578.rlib" "/home/bnaecker/tst/target/debug/deps/libahash-ea0262c66585ff9d.rlib" "/home/bnaecker/tst/target/debug/deps/libconst_random-14582242ea0e6c2a.rlib" "/home/bnaecker/tst/target/debug/deps/libpostcard-326332b7e9cab1aa.rlib" "/home/bnaecker/tst/target/debug/deps/libpostcard_cobs-4ead32620f584b18.rlib" "/home/bnaecker/tst/target/debug/deps/libheapless-5be6cd8261e12d53.rlib" "/home/bnaecker/tst/target/debug/deps/libstable_deref_trait-4cb687aceacb3a68.rlib" "/home/bnaecker/tst/target/debug/deps/libspin-b099bce116728165.rlib" "/home/bnaecker/tst/target/debug/deps/liblock_api-e698df25da0759aa.rlib" "/home/bnaecker/tst/target/debug/deps/libscopeguard-565e32347529b480.rlib" "/home/bnaecker/tst/target/debug/deps/libhash32-d0c190669e230bb4.rlib" "/home/bnaecker/tst/target/debug/deps/libillumos_ddi_dki-fe86c4415ee25292.rlib" "/home/bnaecker/tst/target/debug/deps/libsmoltcp-04f056c6b52ce7e2.rlib" "/home/bnaecker/tst/target/debug/deps/libbitflags-4d03e45c250cd080.rlib" "/home/bnaecker/tst/target/debug/deps/libmanaged-e2cfc91f6b787f02.rlib" "/home/bnaecker/tst/target/debug/deps/libzerocopy-2c8bd96196aba031.rlib" "/home/bnaecker/tst/target/debug/deps/libbyteorder-29a584d9778948bf.rlib" "/home/bnaecker/tst/target/debug/deps/libcstr_core-aed24baeafd4485e.rlib" "/home/bnaecker/tst/target/debug/deps/libmemchr-cb2aa58c9d871d55.rlib" "/home/bnaecker/tst/target/debug/deps/libcty-7cb5ecde0a0226c6.rlib" "/home/bnaecker/tst/target/debug/deps/libcfg_if-2f8775f3389269f7.rlib" "/home/bnaecker/tst/target/debug/deps/libthiserror-25ae4b3190cc3750.rlib" "/home/bnaecker/tst/target/debug/deps/libserde-c681115829c41256.rlib" "/home/bnaecker/tst/target/debug/deps/liblibc-13410709f55ff750.rlib" "-Wl,--start-group" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libstd-44ba11e7caeaa97b.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libpanic_unwind-f60c11ce2f3f2894.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libobject-2a6d17abf086d4e8.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libmemchr-28283bcf356a6b99.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libaddr2line-d4af3a6747ce39f4.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libgimli-abfba83daab33417.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/librustc_demangle-6d4e3a5e28938bae.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libstd_detect-188bd3d8afd99339.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libhashbrown-6205af1a1ba2b4fd.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libminiz_oxide-eb705613be612b49.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libadler-ccf005443048da69.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/librustc_std_workspace_alloc-5612a94d775dd7c1.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libunwind-45f9a318a4ba05a2.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libcfg_if-809e9a5223a42ae2.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/liblibc-8c850a53a00b4798.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/liballoc-9421d8315ee29563.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/librustc_std_workspace_core-5a6b7292ae0792e1.rlib" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libcore-bb36fb4d6ea14041.rlib" "-Wl,--end-group" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libcompiler_builtins-e250b29d90c73633.rlib" "-Wl,-Bdynamic" "-lkstat" "-lnvpair" "-lzfs" "-ldlpi" "-ldoor" "-lsendfile" "-llgrp" "-lsocket" "-lposix4" "-lpthread" "-lresolv" "-lnsl" "-lumem" "-lgcc_s" "-lm" "-lrt" "-lpthread" "-lc" "-lssp" "-L" "/home/bnaecker/.rustup/toolchains/nightly-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib" "-o" "/home/bnaecker/tst/target/debug/deps/tst-9d56c2ce4c177f1f" "-nodefaultlibs"
  = note: Undefined                 first referenced
           symbol                        in file
          nodev                               /home/bnaecker/tst/target/debug/deps/libillumos_ddi_dki-fe86c4415ee25292.rlib(illumos_ddi_dki-fe86c4415ee25292.illumos_ddi_dki.30bde569-cgu.0.rcgu.o)
          nulldev                             /home/bnaecker/tst/target/debug/deps/libillumos_ddi_dki-fe86c4415ee25292.rlib(illumos_ddi_dki-fe86c4415ee25292.illumos_ddi_dki.30bde569-cgu.0.rcgu.o)
          ld: fatal: symbol referencing errors. No output written to /home/bnaecker/tst/target/debug/deps/tst-9d56c2ce4c177f1f
          collect2: error: ld returned 1 exit status


error: could not compile `tst` due to previous error

Cloning this repo and specifying it as a path dependency builds just fine. Changing the one dependency in Cargo.toml to:

opteadm = { path = "../opte/opteadm" }

we can build and run the binary successfully:

bnaecker@feldspar : ~/tst $ cargo +nightly run
   Compiling tst v0.1.0 (/home/bnaecker/tst)
    Finished dev [unoptimized + debuginfo] target(s) in 0.80s
     Running `target/debug/tst`
@rzezeski
Copy link
Contributor

rzezeski commented Apr 5, 2022

So I initially thought this was because opte is not a workspace, and when pulling it in via git it was treating it as one (and that was causing issues), but even after converting opte to a partial workspace (where ddi, opte-core, and opteadm are packages in the workspace), I still hit this linker error (versus when pulling opteadm in directly via a path).

I used truss -f -a -t exec to compare the exact invocations of ld for both the git case and path case. They are identical. But for some reason in the git case it wants nodev in the final object final, and I have no idea why. If I look at the binary for the path case it has nothing for the symbol nodev.

rpz@midgar:~/test-opte-workspace-path$ nm target/debug/deps/test_opte_workspace_path-7170a9230c9145c8 | grep nodev
rpz@midgar:~/test-opte-workspace-path$ 

Versus the git case:

rpz@midgar:~/test-opte-workspace$ nm target/debug/deps/test_opte_workspace-add43b47b53ce5cf | grep nodev
[28241] |                   0|                   0|NOTY |GLOB |0    |UNDEF  |nodev
[16473] |            10033104|                  40|FUNC |GLOB |0    |14     |nodev_getinfo
[17301] |            10033280|                  47|FUNC |GLOB |0    |14     |nodev_ioctl
[21982] |            10033184|                  35|FUNC |GLOB |0    |14     |nodev_power
[21108] |            10033232|                  37|FUNC |GLOB |0    |14     |nodev_read
[14179] |            10033152|                  32|FUNC |GLOB |0    |14     |nodev_reset
[15068] |            10033328|                  37|FUNC |GLOB |0    |14     |nodev_write

The only difference I can see between the two is that in the good (path) case it has incremental objects for ddi:

rpz@midgar:~/test-opte-workspace-path$ for f in $(find target -name '*.o'); do if nm $f | grep -w nodev; then echo "match: $f"; fi; done;
[71]    |                   0|                   0|NOTY |GLOB |0    |UNDEF  |nodev
match: target/debug/incremental/illumos_ddi_dki-gdb63ufcihta/s-g8kyytoc6h-1o0xg0m-2b4j88ufq9kop/zewzfia6tff8ao2.o

But there is no such thing for the bad (git) case.

This all feels like some inside baseball between cargo/rustc and how it builds up these objects and invokes the linker that is beyond my understanding on how to debug.

The real solution to this problem, once again, is that an API layer needs to be defined that insulates a client from all this crap. There is absolutely no reason for nodev() to be on the scene as that is a purely kernel driver concern. However, there is a hack that can be done in order to make forward progress until that separation happens.

rpz@midgar:~/test-opte-workspace$ cat .cargo/config 
[build]
rustflags = ["-C", "link-args=-Wl,-znodefs"]

This tells ld(1) to ignore the case where a symbol is undefined.

@rzezeski
Copy link
Contributor

This appears to be fixed on my end with #109 in place. @bnaecker when you have opte successfully imported as a git dep in sled-agent go ahead and close this out.

@bnaecker
Copy link
Contributor Author

Yep, I can confirm that this allows me to build the sled agent locally, using opte and opte-ioctl as a git dependency. Closing.

@rzezeski
Copy link
Contributor

So this issue is rearing its ugly head again though in a slightly different context (seems to have nothing to do with how opte is being imported into another project). Like, I know what ld is telling me, but I just don't understand why this has only sort of become a thing until now, and seems to be dependent on mysterious things (which means it's probably a subtle environment thing or a race).

https://buildomat.eng.oxide.computer/wg/0/details/01G1NHXQ7NBK0PQQECAPPP44GN/1GzRnEpM9I2HabKeiO4o57z4941O0SpeQRlFgQBS3TlM06Xr/01G1NHY02RTJFFC1G7CCG4YPEW

= note: Undefinedfirst referenced
--
409 | 2022-04-27T13:08:28.192Z | symbol      in file
410 | 2022-04-27T13:08:28.197Z | nodev                               /work/oxidecomputer/opte/opte/target/debug/deps/libillumos_ddi_dki-4b0e51a96dd739fa.rlib(illumos_ddi_dki-4b0e51a96dd739fa.37bmn262e7e27yzx.rcgu.o)
411 | 2022-04-27T13:08:28.203Z | nulldev                             /work/oxidecomputer/opte/opte/target/debug/deps/libillumos_ddi_dki-4b0e51a96dd739fa.rlib(illumos_ddi_dki-4b0e51a96dd739fa.37bmn262e7e27yzx.rcgu.o)
412 | 2022-04-27T13:08:28.209Z | ld: fatal: symbol referencing errors. No output written to /work/oxidecomputer/opte/opte/target/debug/deps/opte-a5657ee8911f9630
413 | 2022-04-27T13:08:28.214Z | collect2: error: ld returned 1 exit status
414 | 2022-04-27T13:08:28.219Z |  
415 | 2022-04-27T13:08:28.227Z |  
416 | 2022-04-27T13:08:28.432Z | warning: `opte` (lib test) generated 2 warnings
417 | 2022-04-27T13:08:28.438Z | error: could not compile `opte` due to previous error; 2 warnings emitted

@rzezeski
Copy link
Contributor

This issue should probably be retitled or a new issue created in its place as the underlying problem seems to be a bit more general than originally described. I'm wrapped up with jury duty right now so don't quite have the time to organize my thoughts like I normally would, but there's two things thoughts I've had thus far.

  1. I know at some point rustc/cargo reintroduced incremental builds, which implicitly bumped codegen-units from 16 to 256. This directly effects the number of args passed to ld; I thought perhaps this would be part of the issue. However, my test in XXX test theory around #88 #137 seems to show otherwise (though we may want to set codegen-units to 1 in the release profile anyways).

  2. The toolchain installed by buildomat changed between the successful builds and the first failed build I encountered while working on the opte-128-go-public branch.

comit abc6bba95edaaf5a65822892944dc45852a46663 on master:

https://buildomat.eng.oxide.computer/wg/0/details/01G1CDTF8ERR6XGKV5T37XFMDS/gsPm1g8s1czbn44mumxNAZE26kaQTjCQktKZYK4kG0OnqXdX/01G1CDTQF0FQWBV3NTP513MK2J

nightly-x86_64-unknown-illumos installed - rustc 1.62.0-nightly (f4ec0e7cf 2022-04-22)

commit b26a50712d50c0147a723bf9a1fcb5ec98ddfb5e in opte-128-go-public branch where I first saw this issue return.

https://buildomat.eng.oxide.computer/wg/0/details/01G1NHXQ7NBK0PQQECAPPP44GN/1GzRnEpM9I2HabKeiO4o57z4941O0SpeQRlFgQBS3TlM06Xr/01G1NK0N1Y36FSCGH4MGBR0BZE

nightly-x86_64-unknown-illumos installed - rustc 1.62.0-nightly (082e4ca49 2022-04-26)

@rzezeski
Copy link
Contributor

Okay, I have replicated this issue locally by bumping my toolchain on midgar (a Helios host).

Toolchain I've been building on for last N weeks:

rpz@midgar:~/src/oxidecomputer/opte$ rustup run nightly rustc --version
rustc 1.61.0-nightly (458262b13 2022-03-09)

Toolchain I updated to:

rpz@midgar:~/src/oxidecomputer/opte/opte$ rustup run nightly rustc --version
rustc 1.62.0-nightly (69a5d2481 2022-04-27)

Output of running opte tests.

rpz@midgar:~/src/oxidecomputer/opte/opte$ cargo +nightly test                                                            Compiling proc-macro2 v1.0.28                                                                                      
   Compiling cfg-if v1.0.0                                                                                            
   Compiling unicode-xid v0.2.2                                                                                       
   Compiling libc v0.2.99                                                                                                Compiling syn v1.0.74                                                                                              
   Compiling crunchy v0.2.2                                                                                              Compiling bitflags v1.2.1                                                                                          
   Compiling tiny-keccak v2.0.2                                                                                          Compiling proc-macro-hack v0.5.19                                                                                  
   Compiling memchr v2.4.0                                                                                            
   Compiling ryu v1.0.5                                                                                               
   Compiling radium v0.5.3                                                                                            
   Compiling lazy_static v1.4.0                                                                                       
   Compiling lexical-core v0.7.6                                                                                      
   Compiling autocfg v0.1.7                                                                                           
   Compiling version_check v0.9.3                                                                                     
   Compiling serde_derive v1.0.127
   Compiling byteorder v1.4.3
   Compiling scopeguard v1.1.0
   Compiling wyz v0.2.0
   Compiling funty v1.1.0
   Compiling serde v1.0.127
   Compiling arrayvec v0.5.2
   Compiling static_assertions v1.1.0
   Compiling tap v1.0.1
   Compiling heapless v0.7.9
   Compiling cty v0.2.1
   Compiling postcard-cobs v0.1.5-pre
   Compiling stable_deref_trait v1.2.0
   Compiling illumos-sys-hdrs v0.1.0 (/home/rpz/src/oxidecomputer/opte/illumos-sys-hdrs)
   Compiling managed v0.8.0
   Compiling cfg-if v0.1.10
   Compiling cookie-factory v0.3.2
   Compiling circular v0.3.0
   Compiling lock_api v0.4.5
   Compiling hash32 v0.2.1
   Compiling nom v6.1.2
   Compiling illumos-ddi-dki v0.1.0 (/home/rpz/src/oxidecomputer/opte/illumos-ddi-dki)
   Compiling hashbrown v0.6.3
   Compiling spin v0.9.2
   Compiling smoltcp v0.8.0
   Compiling bitvec v0.19.5
   Compiling cstr_core v0.2.4
   Compiling getrandom v0.2.3
   Compiling quote v1.0.9
   Compiling const-random-macro v0.1.13
   Compiling const-random v0.1.13
   Compiling ahash v0.2.19
   Compiling anymap v0.12.1 (https://github.com/michaelmelanson/anymap?branch=no_std#2957b71e)
   Compiling synstructure v0.12.5
   Compiling rusticata-macros v3.1.0
   Compiling pcap-parser v0.11.1
   Compiling zerocopy-derive v0.3.1
   Compiling zerocopy v0.6.1
   Compiling postcard v0.7.2
   Compiling opte v0.1.0 (/home/rpz/src/oxidecomputer/opte/opte)
warning: function is never used: `dbg`
   --> src/engine/mod.rs:165:12
    |
165 |         fn dbg<S: AsRef<str> + Display>(msg: S) {
    |            ^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: function is never used: `from_pairs`
   --> src/engine/ip6.rs:372:8
    |
372 |     fn from_pairs() {
    |        ^^^^^^^^^^

error: linking with `gcc` failed: exit status: 1

< ... redacted metric shitton of text for gcc invocation ...>

  = note: Undefined                 first referenced
           symbol                        in file
          nodev                               /home/rpz/src/oxidecomputer/opte/opte/target/debug/deps/libillumos_ddi_d
ki-9fb90843aac6cde0.rlib(illumos_ddi_dki-9fb90843aac6cde0.3l5sqc3imk8gwg4k.rcgu.o)
          nulldev                             /home/rpz/src/oxidecomputer/opte/opte/target/debug/deps/libillumos_ddi_d
ki-9fb90843aac6cde0.rlib(illumos_ddi_dki-9fb90843aac6cde0.3l5sqc3imk8gwg4k.rcgu.o)
          ld: fatal: symbol referencing errors. No output written to /home/rpz/src/oxidecomputer/opte/opte/target/debu
g/deps/opte-69b9effc4a09e0b5
          collect2: error: ld returned 1 exit status
           

warning: `opte` (lib test) generated 2 warnings
error: could not compile `opte` due to previous error; 2 warnings emitted

So at least I have a reliable way to reproduce now and examine locally. My focus (when I get some free time) will be looking at the gcc/ld invocation differences between the two and if there's any difference between the codegen units. It would probably also make sense to set the codegen-units to 1 since that doesn't seem to make a difference but should make debugging easier by greatly reducing the amount of args passed to gcc/ld.

@bnaecker
Copy link
Contributor Author

We've not hit this in a while. We'll obviously bring it back if anyone sees it again.

@rzezeski
Copy link
Contributor

Upon bumping the rust toolchain I have hit this issue once again.

https://buildomat.eng.oxide.computer/wg/0/details/01GBC8R0R6MA6MD6JK2EJGYPM8/LW0v1PwjJVo1MTeCpLdFq2kmIoY5fWCbJJ110FW1DqzZrlzZ/01GBC8R9PKT501RGTNWMYH6HDF#S276

232 | 2022-08-26T05:10:40.157Z | # ==== test ==== #
-- | -- | --
233 | 2022-08-26T05:10:40.163Z | + ptime -m cargo test
234 | 2022-08-26T05:10:40.204Z | Downloading crates ...
235 | 2022-08-26T05:10:40.388Z | Downloaded either v1.8.0
236 | 2022-08-26T05:10:40.409Z | Downloaded itertools v0.10.3
237 | 2022-08-26T05:10:40.433Z | Compiling byteorder v1.4.3
238 | 2022-08-26T05:10:40.439Z | Compiling scopeguard v1.1.0
239 | 2022-08-26T05:10:40.444Z | Compiling managed v0.8.0
240 | 2022-08-26T05:10:40.450Z | Compiling postcard-cobs v0.1.5-pre
241 | 2022-08-26T05:10:40.457Z | Compiling illumos-sys-hdrs v0.1.0 (/work/oxidecomputer/opte/illumos-sys-hdrs)
242 | 2022-08-26T05:10:40.463Z | Compiling stable_deref_trait v1.2.0
243 | 2022-08-26T05:10:40.469Z | Compiling cty v0.2.1
244 | 2022-08-26T05:10:40.474Z | Compiling cfg-if v0.1.10
245 | 2022-08-26T05:10:40.678Z | Compiling either v1.8.0
246 | 2022-08-26T05:10:40.684Z | Compiling bitflags v1.2.1
247 | 2022-08-26T05:10:40.690Z | Compiling memchr v2.4.0
248 | 2022-08-26T05:10:40.740Z | Compiling lock_api v0.4.5
249 | 2022-08-26T05:10:40.896Z | Compiling illumos-ddi-dki v0.1.0 (/work/oxidecomputer/opte/illumos-ddi-dki)
250 | 2022-08-26T05:10:40.925Z | Compiling const-random v0.1.13
251 | 2022-08-26T05:10:41.105Z | Compiling serde v1.0.127
252 | 2022-08-26T05:10:41.111Z | Compiling hash32 v0.2.1
253 | 2022-08-26T05:10:41.172Z | Compiling zerocopy v0.6.1
254 | 2022-08-26T05:10:41.211Z | Compiling ahash v0.2.19
255 | 2022-08-26T05:10:41.295Z | Compiling itertools v0.10.3
256 | 2022-08-26T05:10:41.354Z | Compiling smoltcp v0.8.0
257 | 2022-08-26T05:10:41.590Z | Compiling spin v0.9.2
258 | 2022-08-26T05:10:41.881Z | Compiling cstr_core v0.2.4
259 | 2022-08-26T05:10:42.163Z | Compiling hashbrown v0.6.3
260 | 2022-08-26T05:10:42.317Z | Compiling heapless v0.7.9
261 | 2022-08-26T05:10:43.242Z | Compiling anymap v0.12.1 (https://github.com/michaelmelanson/anymap?branch=no_std#2957b71e)
262 | 2022-08-26T05:10:48.142Z | Compiling postcard v0.7.2
263 | 2022-08-26T05:10:48.574Z | Compiling opte-api v0.1.0 (/work/oxidecomputer/opte/opte-api)
264 | 2022-08-26T05:10:50.155Z | Compiling opte v0.1.0 (/work/oxidecomputer/opte/opte)
265 | 2022-08-26T05:10:55.224Z | warning: function `dbg` is never used
266 | 2022-08-26T05:10:55.230Z | --> src/engine/mod.rs:146:12
267 | 2022-08-26T05:10:55.235Z | \|
268 | 2022-08-26T05:10:55.241Z | 146 \|         fn dbg<S: AsRef<str> + fmt::Display>(msg: S) {
269 | 2022-08-26T05:10:55.247Z | \|            ^^^
270 | 2022-08-26T05:10:55.252Z | \|
271 | 2022-08-26T05:10:55.258Z | = note: `#[warn(dead_code)]` on by default
272 | 2022-08-26T05:10:55.264Z |  
273 | 2022-08-26T05:10:58.306Z | error: linking with `gcc` failed: exit status: 1
274 | 2022-08-26T05:10:58.312Z | \|
275 | 2022-08-26T05:10:58.325Z | = note: "gcc" "-m64" "-std=c99" "/tmp/rustcU2XRgV/symbols.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.10xu9wzqxs4p1bxi.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.114toxleivk9sfyw.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.14rqbachos274ohv.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.151jeln9thfab3wy.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.15lu5y1fj0xtg6j2.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.17kvws2w92wlfuwt.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.18ly5b3sn3wuetzj.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.19hbi2bctn78kawf.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1aizw21m6v2cvh67.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1biwd3zv11asyr4h.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1byid16ggtgcia0s.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1cyfrcb2i5fustrs.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1fpb89qnlgz97tqp.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1ggcv2c3folokenn.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1h234kag69h9aokz.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1hut7gqcc4st9va1.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1hwp6ua8i8h5t386.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1ikfq8qzyq7yzg04.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1itee1m8i16t6uqc.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1ivbz68582r9akfx.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1j8ldblthb22c0jd.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1jdpls8gr7vcjg1i.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1jh2cvkej5jusx2b.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1kyx9ul4y8arw9zz.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1lmg3wtyx1lcqz4x.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1lwbwzvvvlpr02kl.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1n1r94z207upy1nb.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1orxh8hwqt2jv7la.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1rajbwhn3t2vxjsx.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1rlzs2mo2mgkabia.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1ry204l0ah53oygk.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1scr1virt11xdi4z.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1t22k5play39ho6t.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1tlimpzktzbta40c.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1tw1d9uad0z7wn3y.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1u0xjfcewv1zdjhc.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1wbjq0wvr8r8b16y.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1wj6rm79nzbjs9ss.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1wqhqdaamqd3bc35.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1ys3l85y4oeswajh.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1z738ut40ztk8mcm.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1zhwb4d5ijx68pzj.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.201ldbtqgiv2isod.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.20451oc3z7okhpdf.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.20ej34fljbz4uxwk.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.20kux3prf0q2aix3.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.225n0h9acm4rdn0n.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.246vhkzshtlx7ail.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.25tegzdb473u5y8g.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.26o617o7h1pwtxzw.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.26xxrsuc8p4p4n6z.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.26y3b1bkll0wrzgg.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.28a3l82s5777ikdq.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.28ippuc9tyexo9p2.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.29jng7aqseo8mzly.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2b5uoz0jfiaz62i0.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2bhp6wgthsqxj011.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2cxx1yz03v9kovkq.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2ff20sfbgidk4ps3.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2hczyjm27dlyworu.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2hzg9bv6siykcohl.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2jxmfxrsmgjvxohd.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2l0sj75m9xj6i8xi.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2li63rud1zmc5jhp.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2rwqx1cfib93ffp6.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2sakuvwoewdh4mv5.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2wnu021upx9nbhdy.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2wt4o6fdd3xegpqa.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2xw60ejt7pgh06ly.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.30hhaufx1ztaulnm.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3175no9d5ziwfk8z.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.31k6xm825lz7fz2j.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.31umrlz56ih92xki.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.33eyc7e5zgxlo8xu.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.35nrp21yahj6j0ym.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.36rb6is4vly8norg.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.38ajmxfmsq3b80n6.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.38md833oi80jmleb.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3cwmzfl63rt7viil.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3d7ohqv1mhd0vneb.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3f9fadz36ob17puh.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3j8lt9f20cdzfqd.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3je63xklt6xqgrxy.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3lb1475ttn0xgdtm.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3mgcz76r00mqh3rj.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3n48ujho4ymd04rq.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3oix8au5qgg8jpc5.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3prrt12x3vjwz80r.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3qeekni84lxt0hf5.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3s44baty6xm747cy.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3t41lboai90jsw50.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3tmlxi20ecyejhkc.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3vjmgwfr0e1xaqln.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3y8mro89oi9xgvt3.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.40938zfsgu876f9v.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.41ufzweihq3ivzet.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.438io7bpsli2j6w8.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.48yd2ogjuxzj1bho.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.49j8848f91oz4sc5.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4a0q22dd4343hico.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4bfrge3i9q6x77sj.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4cfskac7hoyl1pom.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4cgr8lv6orjojyjs.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4djl95bw84e0gw1q.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4eaoyzbwo4ljehr3.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4go1bns7m5gtj10f.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4go49q4fqzgjp98a.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4iv8hxi02epuiq0z.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4lsdkhceuv55z43s.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4nzqks4rb0rzr5c3.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4puj0jzrnny5wxv4.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4rr1ddrnund8xdsh.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4t4241zpqtp28iqa.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4vunodga95khwv2v.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4ye0x43xbulbwik3.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.5030bcx4dslffaxn.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.50tba9jhfrtmev16.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.50w9kfljgih6svks.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.51hwctfijn2a5ms5.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.53bw7owx715y2sg8.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.54cp9b8z5gbbxcnm.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.55m5ht4x42sze7gs.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.565hcw30lvwfriim.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.59rzfdzhdchwwjso.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.5a0rto1cwrpyenep.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.5av19kdc49c804ak.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.5g4b9gyxt2oc8aqx.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.8klxjv2bwui3xtb.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.8um4j0mev8k8l1i.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.9chop0hlkyzf0kn.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.9eg5f4c3x0yz341.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.ad509oyfd2i5t87.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.aig95cos94onlz0.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.bgh001e1k1faezf.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.ec1ulsksmfx4ucn.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.kbaw714si7p9bba.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.kenpokrglmqa4qb.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.lbzmdip8xz2rpgu.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.ngrdw6x5yfabzxo.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.nyjm6pz3ha5g00p.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.pgp37kxd38c4qi2.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.phzb0afv6bo9qdm.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.rvikrihtus3u0i5.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.turtvr7b3u1dlgr.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.wo674kc30lit4z1.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.wuw2207j1d08hy2.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.x4y4vpqe98u78wx.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.xnwoudugfvolnq0.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.yjmzrj6dd37itn9.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.yjundjw73jjv8j7.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.ym40lqa4ea9v44x.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.z348rc4zs6t1vge.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.z6zwjhnaw2y3wfz.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.17uxfys9svin9a88.rcgu.o" "-Wl,-z,ignore" "-L" "/work/oxidecomputer/opte/opte/target/debug/deps" "-L" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib" "-Wl,-Bstatic" "/work/oxidecomputer/opte/opte/target/debug/deps/libanymap-9743f76e328b5d5d.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libhashbrown-120d51a7d879ae9a.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libahash-3d3189e98fb0ddb0.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libconst_random-718485045dce7ba0.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libtest-4462fde08acc67a2.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libgetopts-19cf109645cc4762.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libunicode_width-f764212eaf61bf9f.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/librustc_std_workspace_std-e1a9ac5c891a08ea.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libillumos_ddi_dki-4b0e51a96dd739fa.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libitertools-fd79b4d08f57d3fb.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libeither-a09274185eba24a0.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libheapless-84553f44d6482a53.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libstable_deref_trait-4cb687aceacb3a68.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libspin-7aa575c1b3159059.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/liblock_api-100013025eceba94.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libscopeguard-565e32347529b480.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libhash32-d0c190669e230bb4.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libcstr_core-c96a9297096c0de3.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libmemchr-5a64fd2ccfe5e199.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libcty-7b39d99f84a5d428.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libzerocopy-3108f4902620867b.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libopte_api-4a8ac531550f9ea8.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libpostcard-f630bb9f78b4ec7d.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libpostcard_cobs-4ead32620f584b18.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libsmoltcp-46eea35ab553c7ab.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libbitflags-fdf541b814e8090e.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libbyteorder-29a584d9778948bf.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libmanaged-e2cfc91f6b787f02.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libillumos_sys_hdrs-fd171113961d3e1b.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libserde-83ef59629b13ee75.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libcfg_if-2f8775f3389269f7.rlib" "-Wl,--start-group" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libstd-9df55ef76d941b5a.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libpanic_unwind-a2059ba85579c254.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libobject-77e4698485290d93.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libmemchr-6ae5986aa597da36.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libaddr2line-c5d0657b8c74c387.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libgimli-baa56fee5da75bdb.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/librustc_demangle-72349ac6ee7e64a9.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libstd_detect-bbe92073517e5be3.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libhashbrown-31c708d5d0e58c89.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libminiz_oxide-ae8405dac6f408ec.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libadler-6996af3c7ede920f.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/librustc_std_workspace_alloc-04152de3380d2b08.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libunwind-29d6de09b1962974.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libcfg_if-7f08aa3b6ffd867a.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/liblibc-b7a9c143545d19e9.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/liballoc-d9bd0ac608b57007.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/librustc_std_workspace_core-84ced6c8cb83d90a.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libcore-2484684c9862f88f.rlib" "-Wl,--end-group" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libcompiler_builtins-bcd5959460eb1037.rlib" "-Wl,-Bdynamic" "-lsocket" "-lposix4" "-lpthread" "-lresolv" "-lnsl" "-lumem" "-lgcc_s" "-lm" "-lrt" "-lpthread" "-lsendfile" "-llgrp" "-lc" "-lssp" "-L" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib" "-o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3" "-nodefaultlibs"
276 | 2022-08-26T05:10:58.331Z | = note: Undefinedfirst referenced
277 | 2022-08-26T05:10:58.336Z | symbol      in file
278 | 2022-08-26T05:10:58.342Z | nodev                               /work/oxidecomputer/opte/opte/target/debug/deps/libillumos_ddi_dki-4b0e51a96dd739fa.rlib(illumos_ddi_dki-4b0e51a96dd739fa.2loxot6muepe06m8.rcgu.o)
279 | 2022-08-26T05:10:58.348Z | nulldev                             /work/oxidecomputer/opte/opte/target/debug/deps/libillumos_ddi_dki-4b0e51a96dd739fa.rlib(illumos_ddi_dki-4b0e51a96dd739fa.2loxot6muepe06m8.rcgu.o)
280 | 2022-08-26T05:10:58.354Z | ld: fatal: symbol referencing errors. No output written to /work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3
281 | 2022-08-26T05:10:58.360Z | collect2: error: ld returned 1 exit status
282 | 2022-08-26T05:10:58.366Z |  
283 | 2022-08-26T05:10:58.371Z |  
284 | 2022-08-26T05:10:58.506Z | warning: `opte` (lib test) generated 1 warning
285 | 2022-08-26T05:10:58.512Z | error: could not compile `opte` due to previous error; 1 warning emitted

I also reproduced this locally on my Helios box. An additional data point I noticed:

  • I can run cargo build --release of the opte crate just fine.
  • However, cargo build test of the opte crate fails with the above linker error.

The rust version being used:

rpz@kalm:~/oxidecomputer/opte/opte$ cargo version
cargo 1.65.0-nightly (4fd148c47 2022-08-03)

@rzezeski rzezeski reopened this Aug 26, 2022
@rzezeski rzezeski changed the title Linking failures when using crate as a git dependency Linking failures Aug 26, 2022
@rzezeski rzezeski self-assigned this Aug 26, 2022
@rzezeski
Copy link
Contributor

rzezeski commented Aug 27, 2022

By the powers of truss -f -t exec -a and the dtrace pause action I have finally arrived at an answer to this years biggest OPTE mystery.

264 | 2022-08-26T05:10:50.155Z | Compiling opte v0.1.0 (/work/oxidecomputer/opte/opte)
265 | 2022-08-26T05:10:55.224Z | warning: function `dbg` is never used
266 | 2022-08-26T05:10:55.230Z | --> src/engine/mod.rs:146:12
267 | 2022-08-26T05:10:55.235Z | \|
268 | 2022-08-26T05:10:55.241Z | 146 \|         fn dbg<S: AsRef<str> + fmt::Display>(msg: S) {
269 | 2022-08-26T05:10:55.247Z | \|            ^^^
270 | 2022-08-26T05:10:55.252Z | \|
271 | 2022-08-26T05:10:55.258Z | = note: `#[warn(dead_code)]` on by default
272 | 2022-08-26T05:10:55.264Z |  
273 | 2022-08-26T05:10:58.306Z | error: linking with `gcc` failed: exit status: 1
274 | 2022-08-26T05:10:58.312Z | \|
275 | 2022-08-26T05:10:58.325Z | = note: "gcc" "-m64" "-std=c99" "/tmp/rustcU2XRgV/symbols.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.10xu9wzqxs4p1bxi.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.114toxleivk9sfyw.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.14rqbachos274ohv.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.151jeln9thfab3wy.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.15lu5y1fj0xtg6j2.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.17kvws2w92wlfuwt.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.18ly5b3sn3wuetzj.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.19hbi2bctn78kawf.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1aizw21m6v2cvh67.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1biwd3zv11asyr4h.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1byid16ggtgcia0s.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1cyfrcb2i5fustrs.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1fpb89qnlgz97tqp.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1ggcv2c3folokenn.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1h234kag69h9aokz.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1hut7gqcc4st9va1.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1hwp6ua8i8h5t386.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1ikfq8qzyq7yzg04.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1itee1m8i16t6uqc.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1ivbz68582r9akfx.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1j8ldblthb22c0jd.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1jdpls8gr7vcjg1i.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1jh2cvkej5jusx2b.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1kyx9ul4y8arw9zz.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1lmg3wtyx1lcqz4x.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1lwbwzvvvlpr02kl.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1n1r94z207upy1nb.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1orxh8hwqt2jv7la.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1rajbwhn3t2vxjsx.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1rlzs2mo2mgkabia.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1ry204l0ah53oygk.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1scr1virt11xdi4z.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1t22k5play39ho6t.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1tlimpzktzbta40c.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1tw1d9uad0z7wn3y.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1u0xjfcewv1zdjhc.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1wbjq0wvr8r8b16y.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1wj6rm79nzbjs9ss.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1wqhqdaamqd3bc35.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1ys3l85y4oeswajh.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1z738ut40ztk8mcm.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.1zhwb4d5ijx68pzj.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.201ldbtqgiv2isod.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.20451oc3z7okhpdf.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.20ej34fljbz4uxwk.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.20kux3prf0q2aix3.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.225n0h9acm4rdn0n.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.246vhkzshtlx7ail.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.25tegzdb473u5y8g.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.26o617o7h1pwtxzw.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.26xxrsuc8p4p4n6z.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.26y3b1bkll0wrzgg.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.28a3l82s5777ikdq.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.28ippuc9tyexo9p2.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.29jng7aqseo8mzly.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2b5uoz0jfiaz62i0.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2bhp6wgthsqxj011.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2cxx1yz03v9kovkq.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2ff20sfbgidk4ps3.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2hczyjm27dlyworu.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2hzg9bv6siykcohl.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2jxmfxrsmgjvxohd.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2l0sj75m9xj6i8xi.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2li63rud1zmc5jhp.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2rwqx1cfib93ffp6.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2sakuvwoewdh4mv5.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2wnu021upx9nbhdy.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2wt4o6fdd3xegpqa.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.2xw60ejt7pgh06ly.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.30hhaufx1ztaulnm.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3175no9d5ziwfk8z.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.31k6xm825lz7fz2j.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.31umrlz56ih92xki.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.33eyc7e5zgxlo8xu.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.35nrp21yahj6j0ym.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.36rb6is4vly8norg.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.38ajmxfmsq3b80n6.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.38md833oi80jmleb.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3cwmzfl63rt7viil.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3d7ohqv1mhd0vneb.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3f9fadz36ob17puh.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3j8lt9f20cdzfqd.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3je63xklt6xqgrxy.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3lb1475ttn0xgdtm.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3mgcz76r00mqh3rj.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3n48ujho4ymd04rq.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3oix8au5qgg8jpc5.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3prrt12x3vjwz80r.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3qeekni84lxt0hf5.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3s44baty6xm747cy.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3t41lboai90jsw50.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3tmlxi20ecyejhkc.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3vjmgwfr0e1xaqln.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.3y8mro89oi9xgvt3.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.40938zfsgu876f9v.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.41ufzweihq3ivzet.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.438io7bpsli2j6w8.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.48yd2ogjuxzj1bho.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.49j8848f91oz4sc5.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4a0q22dd4343hico.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4bfrge3i9q6x77sj.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4cfskac7hoyl1pom.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4cgr8lv6orjojyjs.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4djl95bw84e0gw1q.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4eaoyzbwo4ljehr3.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4go1bns7m5gtj10f.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4go49q4fqzgjp98a.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4iv8hxi02epuiq0z.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4lsdkhceuv55z43s.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4nzqks4rb0rzr5c3.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4puj0jzrnny5wxv4.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4rr1ddrnund8xdsh.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4t4241zpqtp28iqa.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4vunodga95khwv2v.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.4ye0x43xbulbwik3.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.5030bcx4dslffaxn.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.50tba9jhfrtmev16.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.50w9kfljgih6svks.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.51hwctfijn2a5ms5.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.53bw7owx715y2sg8.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.54cp9b8z5gbbxcnm.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.55m5ht4x42sze7gs.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.565hcw30lvwfriim.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.59rzfdzhdchwwjso.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.5a0rto1cwrpyenep.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.5av19kdc49c804ak.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.5g4b9gyxt2oc8aqx.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.8klxjv2bwui3xtb.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.8um4j0mev8k8l1i.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.9chop0hlkyzf0kn.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.9eg5f4c3x0yz341.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.ad509oyfd2i5t87.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.aig95cos94onlz0.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.bgh001e1k1faezf.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.ec1ulsksmfx4ucn.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.kbaw714si7p9bba.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.kenpokrglmqa4qb.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.lbzmdip8xz2rpgu.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.ngrdw6x5yfabzxo.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.nyjm6pz3ha5g00p.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.pgp37kxd38c4qi2.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.phzb0afv6bo9qdm.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.rvikrihtus3u0i5.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.turtvr7b3u1dlgr.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.wo674kc30lit4z1.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.wuw2207j1d08hy2.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.x4y4vpqe98u78wx.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.xnwoudugfvolnq0.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.yjmzrj6dd37itn9.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.yjundjw73jjv8j7.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.ym40lqa4ea9v44x.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.z348rc4zs6t1vge.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.z6zwjhnaw2y3wfz.rcgu.o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3.17uxfys9svin9a88.rcgu.o" "-Wl,-z,ignore" "-L" "/work/oxidecomputer/opte/opte/target/debug/deps" "-L" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib" "-Wl,-Bstatic" "/work/oxidecomputer/opte/opte/target/debug/deps/libanymap-9743f76e328b5d5d.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libhashbrown-120d51a7d879ae9a.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libahash-3d3189e98fb0ddb0.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libconst_random-718485045dce7ba0.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libtest-4462fde08acc67a2.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libgetopts-19cf109645cc4762.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libunicode_width-f764212eaf61bf9f.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/librustc_std_workspace_std-e1a9ac5c891a08ea.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libillumos_ddi_dki-4b0e51a96dd739fa.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libitertools-fd79b4d08f57d3fb.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libeither-a09274185eba24a0.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libheapless-84553f44d6482a53.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libstable_deref_trait-4cb687aceacb3a68.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libspin-7aa575c1b3159059.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/liblock_api-100013025eceba94.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libscopeguard-565e32347529b480.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libhash32-d0c190669e230bb4.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libcstr_core-c96a9297096c0de3.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libmemchr-5a64fd2ccfe5e199.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libcty-7b39d99f84a5d428.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libzerocopy-3108f4902620867b.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libopte_api-4a8ac531550f9ea8.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libpostcard-f630bb9f78b4ec7d.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libpostcard_cobs-4ead32620f584b18.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libsmoltcp-46eea35ab553c7ab.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libbitflags-fdf541b814e8090e.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libbyteorder-29a584d9778948bf.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libmanaged-e2cfc91f6b787f02.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libillumos_sys_hdrs-fd171113961d3e1b.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libserde-83ef59629b13ee75.rlib" "/work/oxidecomputer/opte/opte/target/debug/deps/libcfg_if-2f8775f3389269f7.rlib" "-Wl,--start-group" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libstd-9df55ef76d941b5a.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libpanic_unwind-a2059ba85579c254.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libobject-77e4698485290d93.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libmemchr-6ae5986aa597da36.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libaddr2line-c5d0657b8c74c387.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libgimli-baa56fee5da75bdb.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/librustc_demangle-72349ac6ee7e64a9.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libstd_detect-bbe92073517e5be3.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libhashbrown-31c708d5d0e58c89.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libminiz_oxide-ae8405dac6f408ec.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libadler-6996af3c7ede920f.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/librustc_std_workspace_alloc-04152de3380d2b08.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libunwind-29d6de09b1962974.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libcfg_if-7f08aa3b6ffd867a.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/liblibc-b7a9c143545d19e9.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/liballoc-d9bd0ac608b57007.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/librustc_std_workspace_core-84ced6c8cb83d90a.rlib" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libcore-2484684c9862f88f.rlib" "-Wl,--end-group" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib/libcompiler_builtins-bcd5959460eb1037.rlib" "-Wl,-Bdynamic" "-lsocket" "-lposix4" "-lpthread" "-lresolv" "-lnsl" "-lumem" "-lgcc_s" "-lm" "-lrt" "-lpthread" "-lsendfile" "-llgrp" "-lc" "-lssp" "-L" "/home/build/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-illumos/lib/rustlib/x86_64-unknown-illumos/lib" "-o" "/work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3" "-nodefaultlibs"
276 | 2022-08-26T05:10:58.331Z | = note: Undefinedfirst referenced
277 | 2022-08-26T05:10:58.336Z | symbol      in file
278 | 2022-08-26T05:10:58.342Z | nodev                               /work/oxidecomputer/opte/opte/target/debug/deps/libillumos_ddi_dki-4b0e51a96dd739fa.rlib(illumos_ddi_dki-4b0e51a96dd739fa.2loxot6muepe06m8.rcgu.o)
279 | 2022-08-26T05:10:58.348Z | nulldev                             /work/oxidecomputer/opte/opte/target/debug/deps/libillumos_ddi_dki-4b0e51a96dd739fa.rlib(illumos_ddi_dki-4b0e51a96dd739fa.2loxot6muepe06m8.rcgu.o)
280 | 2022-08-26T05:10:58.354Z | ld: fatal: symbol referencing errors. No output written to /work/oxidecomputer/opte/opte/target/debug/deps/opte-271fc75cb8b695e3
281 | 2022-08-26T05:10:58.360Z | collect2: error: ld returned 1 exit status
  • This failure occurs while trying to run cargo test for the opte crate.
  • First thing I do is verify this locally on my own Helios machine: it fails in same manner.
  • Then I try cargo build, that succeeds just fine. Okay so it builds just fine, but I can't run test. What's the difference?
  • Then the obvious hits me: in order to run tests a binary must be compiled and linked; you know...to run the tests. (in the case of cargo build you're just getting a shared library/archive/rlib, but since cargo says "compiling" for both that obvious fact got lost on me).
  • The nodev() symbol it's talking about is a kernel-only symbol, so it makes sense why the linker won't find it when trying to compile a userland test program.
  • But wait, why does this work with the older toolchain and not the newer one? How the hell could the toolchain be involved?
  • So I throw some truss -f -t exec -a at cargo test to see exactly what it's executing and what it's passing to ld. I run this for both the older and newer toolchain and compare the output.
  • For the newer toolchain I notice one difference, a very suspicious file: /tmp/rust<XXX>/objects.o.
  • WTF is this?
  • Another suspicious thing about the truss output: I just see a temporary objects.o being referenced, I see nothing for it being generated (I would have expected some gcc/ld exec somewhere).
  • So I grab my sharpest cutlery:
rpz@kalm:~/oxidecomputer/opte/opte$ pfexec dtrace -wn 'BEGIN { n=0; } syscall::open:entry { this->path = copyinstr(arg0); } syscall::open:entry /strstr(this->path, "symbols") != 0/ { n += 1; if (n == 2) { stop(); }; printf("execname: %s\n", execname); printf("path: %s\n", this->path); ustack(); } '
dtrace: description 'BEGIN ' matched 9 probes
dtrace: allowing destructive actions
dtrace: error on enabled probe ID 2 (ID 22: syscall::open:entry): invalid address (0x12b212a) in action #1 at DIF offset 12
CPU     ID                    FUNCTION:NAME
  1     22                       open:entry execname: rustc
path: /tmp/rustcv9mu39/symbols.o

              libc.so.1`_syscall6+0x1b
              libc.so.1`open+0x77
              libstd-9df55ef76d941b5a.so`_ZN3std3sys4unix2fs4File6open_c17h78581fba5883ba5cE+0xf0
              libstd-9df55ef76d941b5a.so`_ZN3std2fs11OpenOptions5_open17h43c4ddcc9f865de3E+0x85
              libstd-9df55ef76d941b5a.so`_ZN3std2fs5write5inner17hc13e845d5f9bea6eE+0x51
              librustc_driver-3b9ac44170c84052.so`_RNvNtNtCsjS2BwOEIkKI_17rustc_codegen_ssa4back4link13link_natively+0x9e3
              librustc_driver-3b9ac44170c84052.so`_RNvNtNtCsjS2BwOEIkKI_17rustc_codegen_ssa4back4link11link_binary+0x3c4
              librustc_driver-3b9ac44170c84052.so`_RNvXs5_Cs1UJZfPtkj40_18rustc_codegen_llvmNtB5_18LlvmCodegenBackendNtNtNtCsjS2BwOEIkKI_17rustc_codegen_ssa6traits7backend14CodegenBackend4link+0x26
              librustc_driver-3b9ac44170c84052.so`_RNvMs1_NtCsdlcImBjz8uf_15rustc_interface7queriesNtB5_6Linker4link+0x6ab
              librustc_driver-3b9ac44170c84052.so`_RINvCs46EJof5o40o_10rustc_span15with_source_mapINtNtCshIWsdEqrRGm_4core6result6ResultuNtCscyAZOJRaQC0_12rustc_errors15ErrorGuaranteedENCINvNtCsdlcImBjz8uf_15rustc_interface9interface23create_compiler_and_runBJ_NCNvCs7qq2sCL60Hh_12rustc_driver12run_compilers_0Es_0EB3q_+0x40a
              librustc_driver-3b9ac44170c84052.so`_RINvNtCsdlcImBjz8uf_15rustc_interface9interface23create_compiler_and_runINtNtCshIWsdEqrRGm_4core6result6ResultuNtCscyAZOJRaQC0_12rustc_errors15ErrorGuaranteedENCNvCs7qq2sCL60Hh_12rustc_driver12run_compilers_0EB2B_+0x43c
              librustc_driver-3b9ac44170c84052.so`_RINvMs_Cs21CYlSpggjI_10scoped_tlsINtB5_9ScopedKeyNtCs46EJof5o40o_10rustc_span14SessionGlobalsE3setNCINvNtCsdlcImBjz8uf_15rustc_interface9interface12run_compilerINtNtCshIWsdEqrRGm_4core6result6ResultuNtCscyAZOJRaQC0_12rustc_errors15ErrorGuaranteedENCNvCs7qq2sCL60Hh_12rustc_driver12run_compilers_0E0B2y_EB41_+0x65
              librustc_driver-3b9ac44170c84052.so`_RINvNtNtCs9Yv4628cqot_3std10sys_common9backtrace28___rust_begin_short_backtraceNCINvNtCsdlcImBjz8uf_15rustc_interface4util31run_in_thread_pool_with_globalsNCINvNtB1m_9interface12run_compilerINtNtCshIWsdEqrRGm_4core6result6ResultuNtCscyAZOJRaQC0_12rustc_errors15ErrorGuaranteedENCNvCs7qq2sCL60Hh_12rustc_driver12run_compilers_0E0B32_E0B32_EB4v_+0x83
              librustc_driver-3b9ac44170c84052.so`_RNSNvYNCINvMNtCs9Yv4628cqot_3std6threadNtBa_7Builder16spawn_unchecked_NCINvNtCsdlcImBjz8uf_15rustc_interface4util31run_in_thread_pool_with_globalsNCINvNtB1d_9interface12run_compilerINtNtCshIWsdEqrRGm_4core6result6ResultuNtCscyAZOJRaQC0_12rustc_errors15ErrorGuaranteedENCNvCs7qq2sCL60Hh_12rustc_driver12run_compilers_0E0B2T_E0B2T_Es_0INtNtNtB2Y_3ops8function6FnOnceuE9call_once6vtableB4m_+0xa7
              libstd-9df55ef76d941b5a.so`_ZN3std3sys4unix6thread6Thread3new12thread_start17h7f18aed085441cdcE+0x27
              libc.so.1`_thrp_setup+0x6c
              libc.so.1`_lwp_start

  2     22                       open:entry execname: ld
path: /tmp/rustcv9mu39/symbols.o

              libc.so.1`_syscall6+0x1b
              libc.so.1`open+0xaf
              libld.so.4`process_files_com+0xfc
              libld.so.4`ld64_process_files+0x60
              libld.so.4`ld64_main+0x45f
              ld`main+0xa8
              ld`_start_crt+0x87
              ld`_start+0x18

  6     22                       open:entry execname: elfdump
path: /tmp/rustcv9mu39/symbols.o

              0xfffffc7fee928c1b
              0xfffffc7fee911eaf
              0x40e70c
              0x40d197
              0x40d0f8
  • With the cargo and child processes paused, I can now get a glimpse at this mysterious symbols.o:
rpz@kalm:~$ elfdump /tmp/rustcv9mu39/symbols.o 

ELF Header
  ei_magic:   { 0x7f, E, L, F }
  ei_class:   ELFCLASS64          ei_data:       ELFDATA2LSB
  ei_osabi:   ELFOSABI_NONE       ei_abiversion: 0
  e_machine:  EM_AMD64            e_version:     EV_CURRENT
  e_type:     ET_REL
  e_flags:                     0
  e_entry:                     0  e_ehsize:     64  e_shstrndx:  3
  e_shoff:                 0x280  e_shentsize:  64  e_shnum:     4
  e_phoff:                     0  e_phentsize:   0  e_phnum:     0

Section Header[1]:  sh_name: .symtab
    sh_addr:      0                   sh_flags:   0
    sh_size:      0x168               sh_type:    [ SHT_SYMTAB ]
    sh_offset:    0x40                sh_entsize: 0x18 (15 entries)
    sh_link:      2                   sh_info:    1
    sh_addralign: 0x8               

Section Header[2]:  sh_name: .strtab
    sh_addr:      0                   sh_flags:   0
    sh_size:      0xb8                sh_type:    [ SHT_STRTAB ]
    sh_offset:    0x1a8               sh_entsize: 0
    sh_link:      0                   sh_info:    0
    sh_addralign: 0x1               

Section Header[3]:  sh_name: .shstrtab
    sh_addr:      0                   sh_flags:   0
    sh_size:      0x1b                sh_type:    [ SHT_STRTAB ]
    sh_offset:    0x260               sh_entsize: 0
    sh_link:      0                   sh_info:    0
    sh_addralign: 0x1               

Symbol Table Section:  .symtab
     index    value              size              type bind oth ver shndx          name
       [0]  0x0000000000000000 0x0000000000000000  NOTY LOCL  D    0 UNDEF          
       [1]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          main
       [2]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          opte_panic_debug
       [3]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          rust_eh_personality
       [4]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          nodev_getinfo
       [5]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          nodev_ioctl
       [6]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          nodev_power
       [7]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          nodev_read
       [8]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          nodev_reset
       [9]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          nodev_write
      [10]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          nulldev_close
      [11]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          nulldev_identify
      [12]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          nulldev_open
      [13]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          nulldev_probe
      [14]  0x0000000000000000 0x0000000000000000  NOTY GLOB  D    0 UNDEF          hash_test
  • What? WTF is going on here? Sigh, the only thing I can figure about these symbols is 1) they are all UNDEF and 2) many of them are the no_mangle symbols I expose in illumos-ddi-dki.
  • In desperation I decide to grep the rustc source code for symbols.o.
rpz@sector5 [~/src/rust-lang/rust]
$ egrep -nr 'symbols\.o' compiler/*
compiler/rustc_codegen_ssa/src/back/link.rs:1781:    let path = tmpdir.join("symbols.o");
  • Oh thank the gods, there's a chance I'll get to the bottom of this. Okay so what does this function look like?
/// Add a synthetic object file that contains reference to all symbols that we want to expose to
/// the linker.
///
/// Background: we implement rlibs as static library (archives). Linkers treat archives
/// differently from object files: all object files participate in linking, while archives will
/// only participate in linking if they can satisfy at least one undefined reference (version
/// scripts doesn't count). This causes `#[no_mangle]` or `#[used]` items to be ignored by the
/// linker, and since they never participate in the linking, using `KEEP` in the linker scripts
/// can't keep them either. This causes #47384.
///
/// To keep them around, we could use `--whole-archive` and equivalents to force rlib to
/// participate in linking like object files, but this proves to be expensive (#93791). Therefore
/// we instead just introduce an undefined reference to them. This could be done by `-u` command
/// line option to the linker or `EXTERN(...)` in linker scripts, however they does not only
/// introduce an undefined reference, but also make them the GC roots, preventing `--gc-sections`
/// from removing them, and this is especially problematic for embedded programming where every
/// byte counts.
///
/// This method creates a synthetic object file, which contains undefined references to all symbols
/// that are necessary for the linking. They are only present in symbol table but not actually
/// used in any sections, so the linker will therefore pick relevant rlibs for linking, but
/// unused `#[no_mangle]` or `#[used]` can still be discard by GC sections.
fn add_linked_symbol_object(
    cmd: &mut dyn Linker,
    sess: &Session,
    tmpdir: &Path,
    symbols: &[(String, SymbolExportKind)],
) {
    if symbols.is_empty() {
        return;
    }

    let Some(mut file) = super::metadata::create_object_file(sess) else {
        return;
    };

    // NOTE(nbdd0121): MSVC will hang if the input object file contains no sections,
    // so add an empty section.
    if file.format() == object::BinaryFormat::Coff {
        file.add_section(Vec::new(), ".text".into(), object::SectionKind::Text);

        // We handle the name decoration of COFF targets in `symbol_export.rs`, so disable the
        // default mangler in `object` crate.
        file.set_mangling(object::write::Mangling::None);

        // Add feature flags to the object file. On MSVC this is optional but LLD will complain if
        // not present.
        let mut feature = 0;

        if file.architecture() == object::Architecture::I386 {
            // Indicate that all SEH handlers are registered in .sxdata section.
            // We don't have generate any code, so we don't need .sxdata section but LLD still
            // expects us to set this bit (see #96498).
            // Reference: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
            feature |= 1;
        }

        file.add_symbol(object::write::Symbol {
            name: "@feat.00".into(),
            value: feature,
            size: 0,
            kind: object::SymbolKind::Data,
            scope: object::SymbolScope::Compilation,
            weak: false,
            section: object::write::SymbolSection::Absolute,
            flags: object::SymbolFlags::None,
        });
    }

    for (sym, kind) in symbols.iter() {
        file.add_symbol(object::write::Symbol {
            name: sym.clone().into(),
            value: 0,
            size: 0,
            kind: match kind {
                SymbolExportKind::Text => object::SymbolKind::Text,
                SymbolExportKind::Data => object::SymbolKind::Data,
                SymbolExportKind::Tls => object::SymbolKind::Tls,
            },
            scope: object::SymbolScope::Unknown,
            weak: false,
            section: object::write::SymbolSection::Undefined,
            flags: object::SymbolFlags::None,
        });
    }

    let path = tmpdir.join("symbols.o");
    let result = std::fs::write(&path, file.write().unwrap());
    if let Err(e) = result {
        sess.fatal(&format!("failed to write {}: {}", path.display(), e));
    }
    cmd.add_object(&path);
}
  • A synthetic hwat?
  • Okay, so this comment made all the pieces fall together:
    • cargo test fails, with the linker saying it can't find nodev(), that makes sense, but how did I get here?
    • based on the comment in the rustc code, I got here by this "synthetic object"
    • the compiler creates this synthetic object, with an UNDEF entry for each no_mangle symbol, in an attempt to force the linker to resolve them from the archives that follow (as arguments to the linker)
    • these symbols are no_mangle symbols that I have declared in illumos-ddi-dki, which is a dep of opte, and cargo test is trying to compile/link it so that it can run the test program
    • these symbols are just extern "C" functions defined in Rust in order to satisfy the type system, but they all map to the illumos kernel nodev() symbol.
    • the linker resolves these synthetic object symbols to illumos-ddi-dki, which when calls out to nulldev(), so now the linker needs to track that down...but it can't because we are compiling this as a userland executable

In short, this has always been a problem with the way I structured things in illumos-ddi-dki and exposed them to opte, but this problem wasn't exposed until the rust toolchain got this new "synthetic object" hack. This is obvious in hindsight, but was easy to miss thanks to many confounding factors.

The solution will involve restructuring how symbols are exposed from illumos-ddi-dki. I haven't thought out the specifics yet. One option might be to only have it as a dep in a non-std/non-test compilation env, but there are a few types that opte relies on during testing which would have to be replicated, like the mblk_t. Another option is to add a std feature and only expose those few types needed for testing, and then hide everything else. Then make sure that std is enabled when being compiled for the purposes of testing by opte (I think there's a way to tell cargo to do this). There may be other options too, I just haven't thought it through enough yet.

rzezeski added a commit that referenced this issue Aug 30, 2022
The crux of the problem was that illumos-ddi-dki was exposing all
symbols, all the time. This meant that even when compiled for the
purposes of testing it was exposing kernel-only symbols, resulting in
ld failing to find them. This was always a problem, but it wasn't
exposed until rustc made it's "synthetic object" change:

commit 773f533eae25129cea7241b74e54f26ce5eebb62
Author: Gary Guo <[email protected]>
Date:   Sat Apr 2 22:54:51 2022 +0100

    Synthesis object file for `#[used]` and exported symbols

This commit contains the following changes:

- Update rust toolchain to nightly 2022-07-14. I tried using newer
  nightly but it resulted in compiler asserts.

- Move all illumos-ddi-dki bits into ilumos-sys-hdrs. If you look at
  the illumos `uts/common/sys` headers, you'll see they contain the
  DDI types and API; so moving everything under one crate made more
  sense (and in fact my reason for separating them in the past was a
  naive attempt at trying to tease apart the types/symbols visible in
  userspace vs. those only in the kernel -- but clearly I failed at
  that).

- Add a `kernel` feature to illumos-sys-hdrs. This feature enables the
  exposure of kernel-only types and symbols, and maps to the `_KERNEL`
  define found in illumos. With that in place it's a matter of wiring
  up the `kernel` feature in opte as well as xde, so that only the xde
  crate enables this feature, whereas running `cargo test` in opte
  should not enable it.

- Update the various imports to map to `illumos_sys_hdrs` (that's the
  reason for the big churn in `ip.rs`, a purely mechanical change).
rzezeski added a commit that referenced this issue Aug 30, 2022
The crux of the problem was that illumos-ddi-dki was exposing all
symbols, all the time. This meant that even when compiled for the
purposes of testing it was exposing kernel-only symbols, resulting in
ld failing to find them. This was always a problem, but it wasn't
exposed until rustc made it's "synthetic object" change:

commit 773f533eae25129cea7241b74e54f26ce5eebb62
Author: Gary Guo <[email protected]>
Date:   Sat Apr 2 22:54:51 2022 +0100

    Synthesis object file for `#[used]` and exported symbols

This commit contains the following changes:

- Update rust toolchain to nightly 2022-07-14. I tried using newer
  nightly but it resulted in compiler asserts.

- Move all illumos-ddi-dki bits into ilumos-sys-hdrs. If you look at
  the illumos `uts/common/sys` headers, you'll see they contain the
  DDI types and API; so moving everything under one crate made more
  sense (and in fact my reason for separating them in the past was a
  naive attempt at trying to tease apart the types/symbols visible in
  userspace vs. those only in the kernel -- but clearly I failed at
  that).

- Add a `kernel` feature to illumos-sys-hdrs. This feature enables the
  exposure of kernel-only types and symbols, and maps to the `_KERNEL`
  define found in illumos. With that in place it's a matter of wiring
  up the `kernel` feature in opte as well as xde, so that only the xde
  crate enables this feature, whereas running `cargo test` in opte
  should not enable it.

- Update the various imports to map to `illumos_sys_hdrs` (that's the
  reason for the big churn in `ip.rs`, a purely mechanical change).
rzezeski added a commit that referenced this issue Aug 30, 2022
The crux of the problem was that illumos-ddi-dki was exposing all
symbols, all the time. This meant that even when compiled for the
purposes of testing it was exposing kernel-only symbols, resulting in
ld failing to find them. This was always a problem, but it wasn't
exposed until rustc made it's "synthetic object" change:

commit 773f533eae25129cea7241b74e54f26ce5eebb62
Author: Gary Guo <[email protected]>
Date:   Sat Apr 2 22:54:51 2022 +0100

    Synthesis object file for `#[used]` and exported symbols

This commit contains the following changes:

- Update rust toolchain to nightly 2022-07-14. I tried using newer
  nightly but it resulted in compiler asserts.

- Move all illumos-ddi-dki bits into ilumos-sys-hdrs. If you look at
  the illumos `uts/common/sys` headers, you'll see they contain the
  DDI types and API; so moving everything under one crate made more
  sense (and in fact my reason for separating them in the past was a
  naive attempt at trying to tease apart the types/symbols visible in
  userspace vs. those only in the kernel -- but clearly I failed at
  that).

- Add a `kernel` feature to illumos-sys-hdrs. This feature enables the
  exposure of kernel-only types and symbols, and maps to the `_KERNEL`
  define found in illumos. With that in place it's a matter of wiring
  up the `kernel` feature in opte as well as xde, so that only the xde
  crate enables this feature, whereas running `cargo test` in opte
  should not enable it.

- Update the various imports to map to `illumos_sys_hdrs` (that's the
  reason for the big churn in `ip.rs`, a purely mechanical change).
@rzezeski
Copy link
Contributor

Addressed in 365cfd6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants