Skip to content

Commit

Permalink
Add a synthetic symbol for the entry point.
Browse files Browse the repository at this point in the history
This gives me a symbol for the caller of dl_start in ld-linux-x86-64.so.2.
  • Loading branch information
mstange committed Mar 1, 2024
1 parent 4bab5e0 commit 6662529
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions samply-symbols/src/symbol_map_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,12 @@ where
);
}

// 5. End addresses from text section ends
// 5. A placeholder symbol for the entry point.
if let Some(entry_point) = object_file.entry().checked_sub(base_address) {
entries.push((entry_point as u32, FullSymbolListEntry::Synthesized));
}

// 6. End addresses from text section ends
// These entries serve to "terminate" the last function of each section,
// so that addresses in the following section are not considered
// to be part of the last function of that previous section.
Expand All @@ -320,7 +325,7 @@ where
}),
);

// 6. End addresses for sized symbols
// 7. End addresses for sized symbols
// These addresses serve to "terminate" functions symbols.
entries.extend(
object_file
Expand All @@ -342,7 +347,7 @@ where
}),
);

// 7. End addresses for known functions ends
// 8. End addresses for known functions ends
// These addresses serve to "terminate" functions from function_start_addresses.
// They come from .eh_frame or .pdata info, which has the function size.
if let Some(function_end_addresses) = function_end_addresses {
Expand Down

0 comments on commit 6662529

Please sign in to comment.