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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ files with embedded bitcode (.o), optionally stored inside ar archives (.a).
The linker requires LLVM 21. It can use the same LLVM used by the rust compiler,
or it can use an external LLVM installation.

If your target is `aarch64-unknown-linux-gnu` (i.e. Linux on Apple Silicon) you
If your target is `aarch64-unknown-linux-gnu` (i.e. Linux on Apple Silicon) you
will have to use the *external LLVM* method.

### Using LLVM provided by rustc
Expand Down
22 changes: 12 additions & 10 deletions src/bin/bpf-linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::{
feature = "rust-llvm-21"
))]
use aya_rustc_llvm_proxy as _;
use bpf_linker::{Cpu, Linker, LinkerOptions, OptLevel, OutputType};
use bpf_linker::{Cpu, Linker, LinkerInput, LinkerOptions, OptLevel, OutputType};
use clap::{
builder::{PathBufValueParser, TypedValueParser as _},
error::ErrorKind,
Expand Down Expand Up @@ -212,7 +212,6 @@ fn main() -> anyhow::Result<()> {
emit,
btf,
allow_bpf_trap,
libs,
optimize,
export_symbols,
log_file,
Expand All @@ -227,6 +226,7 @@ fn main() -> anyhow::Result<()> {
export,
fatal_errors,
_debug,
libs: _libs, // NOTE: not used right now
} = match Parser::try_parse_from(args) {
Ok(command_line) => command_line,
Err(err) => match err.kind() {
Expand Down Expand Up @@ -294,23 +294,25 @@ fn main() -> anyhow::Result<()> {
target,
cpu,
cpu_features,
inputs,
output,
output_type,
libs,
optimize,
export_symbols,
unroll_loops,
ignore_inline_never,
dump_module,
llvm_args,
disable_expand_memcpy_in_order,
disable_memory_builtins,
btf,
allow_bpf_trap,
});
})?;

if let Some(path) = dump_module {
linker.set_dump_module_path(path);
}

let inputs = inputs
.iter()
.map(|p| LinkerInput::new_from_file(p.as_path()));

linker.link()?;
linker.link_to_file(inputs, &output, output_type, &export_symbols)?;

if fatal_errors && linker.has_errors() {
return Err(anyhow::anyhow!(
Expand Down
Loading