File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,7 +106,21 @@ fn main() {
106106 Some ( built) if built. exists ( ) => {
107107 std:: fs:: copy ( & built, & obj_out) . expect ( "stage BPF ELF into OUT_DIR" ) ;
108108 println ! ( "cargo::rustc-cfg=packetframe_bpf_built" ) ;
109- println ! ( "cargo::warning=BPF ELF built from {}" , built. display( ) ) ;
109+ // Debug: dump the first 16 bytes + size. ELF magic
110+ // is 7f 45 4c 46 ("..ELF"); anything else is not a
111+ // parseable ELF and aya will reject it.
112+ if let Ok ( bytes) = std:: fs:: read ( & built) {
113+ let head: Vec < String > =
114+ bytes. iter ( ) . take ( 16 ) . map ( |b| format ! ( "{b:02x}" ) ) . collect ( ) ;
115+ println ! (
116+ "cargo::warning=BPF ELF built from {} ({} bytes); first 16: {}" ,
117+ built. display( ) ,
118+ bytes. len( ) ,
119+ head. join( " " )
120+ ) ;
121+ } else {
122+ println ! ( "cargo::warning=BPF ELF built from {}" , built. display( ) ) ;
123+ }
110124 }
111125 Some ( built) => {
112126 forward_output ( & [ ] , & out. stderr ) ;
You can’t perform that action at this time.
0 commit comments