Skip to content

Commit 17159a9

Browse files
committed
cli: Fix parsing of --export flags
Those flags, even when passed multiple times, are always prepend with `--export` when they come from rustc. Delimiter can be used, but we shouldn't include any positional arguments after the flag as a part of that flag. Therefore, we use the combination of `use_value_delimiter = true` and `num_args = 1` options to ensure that. That bug can be reproduced by running bpf-linker together with rustc after rust-lang/rust@7f06d51 which passes the following sequence of arguments to the linker: ``` [...] --export connect --export some_dep /tmp/rusdep /tmp/rustcwUehHK/symbols.o /tmp/bin.bin.3b77bbea-cgu.0.rcgu.o -L /tmp -L /home/vadorovsky/repos/bpf-linker/target/debug/deps [...] ``` `/tmp/rustdep`, `symbols.o` and `*.rcgu.o` are inputs, but bpf-linker was parsing them as symbols to export. Therefore, `symbols.o` and `*.rcgu.o` were not linked, bpf-linker was ending up just linking dependencies / external crates together and not including the main program. Fixes: aya-rs#27 Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
1 parent 3f080bd commit 17159a9

File tree

3 files changed

+127
-66
lines changed

3 files changed

+127
-66
lines changed

Cargo.lock

Lines changed: 24 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ edition = "2021"
1212

1313
[dependencies]
1414
# cli deps
15-
clap = { version = "3.2", optional = true, features = ["derive"] }
15+
clap = { version = "4.0", optional = true, features = ["derive"] }
1616
simplelog = {version = "0.7.6", optional = true}
1717

1818
# lib deps

0 commit comments

Comments
 (0)