elf.rs 524 B

123456789101112131415161718192021
  1. use object::{Object, ObjectSymbol};
  2. #[test]
  3. fn test_maps() {
  4. let obj_file = object::File::parse(integration_test::MAP_TEST).unwrap();
  5. if obj_file.section_by_name("maps").is_none() {
  6. panic!("No 'maps' ELF section");
  7. }
  8. let mut found = false;
  9. for sym in obj_file.symbols() {
  10. if let Ok(name) = sym.name() {
  11. if name == "BAR" {
  12. found = true;
  13. break;
  14. }
  15. }
  16. }
  17. if !found {
  18. panic!("No symbol 'BAR' in ELF file")
  19. }
  20. }