-
Notifications
You must be signed in to change notification settings - Fork 45
cli: Fix parsing of --export
flags
#28
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
Conversation
aed121b
to
f3ced12
Compare
Signed-off-by: Michal Rostecki <[email protected]>
Using nightly for running clippy often causes warnings which are about non-stabilized features. Since we support building bpf-linker with stable, let's use it for clippy as well. Signed-off-by: Michal Rostecki <[email protected]>
Signed-off-by: Michal Rostecki <[email protected]>
All assembly tests depend on FileCheck, which has to be installed through the llvm-tools package. Signed-off-by: Michal Rostecki <[email protected]>
Signed-off-by: Michal Rostecki <[email protected]>
efd305a
to
e5b949a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for doing this. Looks good, see nits.
@@ -75,6 +75,15 @@ jobs: | |||
sudo apt-get update | |||
sudo apt-get install llvm-${{ matrix.llvm }}-dev libclang-${{ matrix.llvm }}-dev | |||
|
|||
- name: Install LLVM tools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the rustup component llvm-tools-preview
not include filecheck?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like no
$ docker run --rm -it rust:1.66 bash
root@629bf09695e7:/# rustup component add llvm-tools-preview
info: downloading component 'llvm-tools-preview'
info: installing component 'llvm-tools-preview'
32.9 MiB / 32.9 MiB (100 %) 22.3 MiB/s in 1s ETA: 0s
root@629bf09695e7:/# FileCheck
bash: FileCheck: command not found
root@629bf09695e7:/# find / -name "*FileCheck*"
root@629bf09695e7:/#
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 <[email protected]>
e5b949a
to
17159a9
Compare
Those flags, even when passed multiple times, are always prepend with
--export
when they come from rustc. Delimiter can be used, but weshouldn't include any positional arguments after the flag as a part of
that flag. Therefore, we use the combination of
use_value_delimiter = true
andnum_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:
/tmp/rustdep
,symbols.o
and*.rcgu.o
are inputs, butbpf-linker was parsing them as symbols to export. Therefore,
symbols.o
and
*.rcgu.o
were not linked, bpf-linker was ending up just linkingdependencies / external crates together and not including the main
program.
Fixes: #27
Signed-off-by: Michal Rostecki [email protected]