@@ -14,7 +14,7 @@ use std::{
1414    feature = "rust-llvm-21"  
1515) ) ] 
1616use  aya_rustc_llvm_proxy as  _; 
17- use  bpf_linker:: { Cpu ,  Linker ,  LinkerOptions ,  OptLevel ,  OutputType } ; 
17+ use  bpf_linker:: { Cpu ,  Linker ,  LinkerInput ,   LinkerOptions ,  OptLevel ,  OutputType } ; 
1818use  clap:: { 
1919    builder:: { PathBufValueParser ,  TypedValueParser  as  _} , 
2020    error:: ErrorKind , 
@@ -271,15 +271,11 @@ fn main() -> anyhow::Result<()> {
271271
272272    let  export_symbols = export_symbols. map ( fs:: read_to_string) . transpose ( ) ?; 
273273
274-     // TODO: the data is owned by this call frame; we could make this zero-alloc. 
275274    let  export_symbols = export_symbols
276275        . as_deref ( ) 
277276        . into_iter ( ) 
278277        . flat_map ( str:: lines) 
279-         . map ( str:: to_owned) 
280-         . chain ( export) 
281-         . map ( Into :: into) 
282-         . collect ( ) ; 
278+         . chain ( export. iter ( ) . map ( String :: as_str) ) ; 
283279
284280    let  output_type = match  * emit. as_slice ( )  { 
285281        [ ]  => unreachable ! ( "emit has a default value" ) , 
@@ -294,11 +290,7 @@ fn main() -> anyhow::Result<()> {
294290        target, 
295291        cpu, 
296292        cpu_features, 
297-         inputs, 
298-         output, 
299-         output_type, 
300293        optimize, 
301-         export_symbols, 
302294        unroll_loops, 
303295        ignore_inline_never, 
304296        llvm_args, 
@@ -312,7 +304,11 @@ fn main() -> anyhow::Result<()> {
312304        linker. set_dump_module_path ( path) ; 
313305    } 
314306
315-     linker. link ( ) ?; 
307+     let  inputs = inputs
308+         . iter ( ) 
309+         . map ( |p| LinkerInput :: new_from_file ( p. as_path ( ) ) ) ; 
310+ 
311+     linker. link_to_file ( inputs,  & output,  output_type,  export_symbols) ?; 
316312
317313    if  fatal_errors && linker. has_errors ( )  { 
318314        return  Err ( anyhow:: anyhow!( 
0 commit comments